@backstage/plugin-catalog 1.4.0 → 1.5.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/esm/{index-c6279600.esm.js → index-0550248f.esm.js} +12 -9
- package/dist/esm/{index-c6279600.esm.js.map → index-0550248f.esm.js.map} +1 -1
- package/dist/esm/{index-b0b0b077.esm.js → index-2bfd6ae7.esm.js} +251 -149
- package/dist/esm/{index-b0b0b077.esm.js.map → index-2bfd6ae7.esm.js.map} +1 -1
- package/dist/esm/{index-4e6adb42.esm.js → index-46417657.esm.js} +5 -2
- package/dist/esm/{index-4e6adb42.esm.js.map → index-46417657.esm.js.map} +1 -1
- package/dist/esm/{index-1a954f75.esm.js → index-543b1d23.esm.js} +7 -4
- package/dist/esm/index-543b1d23.esm.js.map +1 -0
- package/dist/esm/{index-10cb0abb.esm.js → index-9cdebd35.esm.js} +2 -2
- package/dist/esm/index-9cdebd35.esm.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.esm.js +1 -1
- package/package.json +12 -12
- package/dist/esm/index-10cb0abb.esm.js.map +0 -1
- package/dist/esm/index-1a954f75.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @backstage/plugin-catalog
|
|
2
2
|
|
|
3
|
+
## 1.5.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 80da5162c7: Plugin catalog has been modified to use an experimental feature where you can customize the title of the create button.
|
|
8
|
+
|
|
9
|
+
You can modify it by doing:
|
|
10
|
+
|
|
11
|
+
```typescript jsx
|
|
12
|
+
import { catalogPlugin } from '@backstage/plugin-catalog';
|
|
13
|
+
|
|
14
|
+
catalogPlugin.__experimentalReconfigure({
|
|
15
|
+
createButtonTitle: 'New',
|
|
16
|
+
});
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @backstage/core-plugin-api@1.0.5-next.0
|
|
23
|
+
- @backstage/integration-react@1.1.3-next.0
|
|
24
|
+
- @backstage/plugin-catalog-react@1.1.3-next.0
|
|
25
|
+
- @backstage/core-components@0.10.1-next.0
|
|
26
|
+
- @backstage/plugin-search-react@1.0.1-next.0
|
|
27
|
+
|
|
3
28
|
## 1.4.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
|
@@ -3,7 +3,7 @@ import LanguageIcon from '@material-ui/icons/Language';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { makeStyles, Typography, Button } from '@material-ui/core';
|
|
5
5
|
import { CodeSnippet, InfoCard } from '@backstage/core-components';
|
|
6
|
-
import { L as LinksGridList } from './index-
|
|
6
|
+
import { L as LinksGridList } from './index-2bfd6ae7.esm.js';
|
|
7
7
|
import { useApp } from '@backstage/core-plugin-api';
|
|
8
8
|
import 'zen-observable';
|
|
9
9
|
import '@backstage/catalog-model';
|
|
@@ -33,13 +33,16 @@ const ENTITY_YAML = `metadata:
|
|
|
33
33
|
- url: https://dashboard.example.com
|
|
34
34
|
title: My Dashboard
|
|
35
35
|
icon: dashboard`;
|
|
36
|
-
const useStyles = makeStyles(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
36
|
+
const useStyles = makeStyles(
|
|
37
|
+
(theme) => ({
|
|
38
|
+
code: {
|
|
39
|
+
borderRadius: 6,
|
|
40
|
+
margin: `${theme.spacing(2)}px 0px`,
|
|
41
|
+
background: theme.palette.type === "dark" ? "#444" : "#fff"
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
44
|
+
{ name: "PluginCatalogEntityLinksEmptyState" }
|
|
45
|
+
);
|
|
43
46
|
function EntityLinksEmptyState() {
|
|
44
47
|
const classes = useStyles();
|
|
45
48
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
@@ -84,4 +87,4 @@ function EntityLinksCard(props) {
|
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
export { EntityLinksCard };
|
|
87
|
-
//# sourceMappingURL=index-
|
|
90
|
+
//# sourceMappingURL=index-0550248f.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-0550248f.esm.js","sources":["../../src/components/EntityLinksCard/EntityLinksEmptyState.tsx","../../src/components/EntityLinksCard/EntityLinksCard.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 { BackstageTheme } from '@backstage/theme';\nimport { Button, makeStyles, Typography } from '@material-ui/core';\nimport React from 'react';\nimport { CodeSnippet } from '@backstage/core-components';\n\nconst ENTITY_YAML = `metadata:\n name: example\n links:\n - url: https://dashboard.example.com\n title: My Dashboard\n icon: dashboard`;\n\n/** @public */\nexport type EntityLinksEmptyStateClassKey = 'code';\n\nconst useStyles = makeStyles<BackstageTheme>(\n theme => ({\n code: {\n borderRadius: 6,\n margin: `${theme.spacing(2)}px 0px`,\n background: theme.palette.type === 'dark' ? '#444' : '#fff',\n },\n }),\n { name: 'PluginCatalogEntityLinksEmptyState' },\n);\n\nexport function EntityLinksEmptyState() {\n const classes = useStyles();\n\n return (\n <>\n <Typography variant=\"body1\">\n No links defined for this entity. You can add links to your entity YAML\n as shown in the highlighted example below:\n </Typography>\n <div className={classes.code}>\n <CodeSnippet\n text={ENTITY_YAML}\n language=\"yaml\"\n showLineNumbers\n highlightedNumbers={[3, 4, 5, 6]}\n customStyle={{ background: 'inherit', fontSize: '115%' }}\n />\n </div>\n <Button\n variant=\"contained\"\n color=\"primary\"\n target=\"_blank\"\n href=\"https://backstage.io/docs/features/software-catalog/descriptor-format#links-optional\"\n >\n Read more\n </Button>\n </>\n );\n}\n","/*\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 { useEntity } from '@backstage/plugin-catalog-react';\nimport LanguageIcon from '@material-ui/icons/Language';\nimport React from 'react';\nimport { EntityLinksEmptyState } from './EntityLinksEmptyState';\nimport { LinksGridList } from './LinksGridList';\nimport { ColumnBreakpoints } from './types';\nimport { IconComponent, useApp } from '@backstage/core-plugin-api';\nimport { InfoCard, InfoCardVariants } from '@backstage/core-components';\n\n/** @public */\nexport interface EntityLinksCardProps {\n cols?: ColumnBreakpoints | number;\n variant?: InfoCardVariants;\n}\n\nexport function EntityLinksCard(props: EntityLinksCardProps) {\n const { cols = undefined, variant } = props;\n const { entity } = useEntity();\n const app = useApp();\n\n const iconResolver = (key?: string): IconComponent =>\n key ? app.getSystemIcon(key) ?? LanguageIcon : LanguageIcon;\n\n const links = entity?.metadata?.links;\n\n return (\n <InfoCard title=\"Links\" variant={variant}>\n {!links || links.length === 0 ? (\n <EntityLinksEmptyState />\n ) : (\n <LinksGridList\n cols={cols}\n items={links.map(({ url, title, icon }) => ({\n text: title ?? url,\n href: url,\n Icon: iconResolver(icon),\n }))}\n />\n )}\n </InfoCard>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,WAAW,GAA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ACvC,MAAM,IAAI,EAAE,GAAG;AACf,MAAM,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC;AAC9B,KAAK,CAAC,CAAC;AACP,GAAG,CAAC,CAAC,CAAC;AACN;;;;"}
|
|
@@ -36,8 +36,12 @@ async function performMigrationToTheNewBucket({
|
|
|
36
36
|
if (!isArray(oldStarredEntities)) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
const targetEntities = new Set(
|
|
40
|
-
|
|
39
|
+
const targetEntities = new Set(
|
|
40
|
+
(_a = target.snapshot("entityRefs").value) != null ? _a : []
|
|
41
|
+
);
|
|
42
|
+
oldStarredEntities.filter(isString).map((old) => old.split(":")).filter((split) => split.length === 4 && split[0] === "entity").map(
|
|
43
|
+
([_, kind, namespace, name]) => stringifyEntityRef({ kind, namespace, name })
|
|
44
|
+
).forEach((e) => targetEntities.add(e));
|
|
41
45
|
await target.set("entityRefs", Array.from(targetEntities));
|
|
42
46
|
await source.remove("starredEntities");
|
|
43
47
|
}
|
|
@@ -55,7 +59,9 @@ class DefaultStarredEntitiesApi {
|
|
|
55
59
|
var _a;
|
|
56
60
|
performMigrationToTheNewBucket(opts).then();
|
|
57
61
|
this.settingsStore = opts.storageApi.forBucket("starredEntities");
|
|
58
|
-
this.starredEntities = new Set(
|
|
62
|
+
this.starredEntities = new Set(
|
|
63
|
+
(_a = this.settingsStore.snapshot("entityRefs").value) != null ? _a : []
|
|
64
|
+
);
|
|
59
65
|
this.settingsStore.observe$("entityRefs").subscribe({
|
|
60
66
|
next: (next) => {
|
|
61
67
|
var _a2;
|
|
@@ -70,7 +76,10 @@ class DefaultStarredEntitiesApi {
|
|
|
70
76
|
} else {
|
|
71
77
|
this.starredEntities.add(entityRef);
|
|
72
78
|
}
|
|
73
|
-
await this.settingsStore.set(
|
|
79
|
+
await this.settingsStore.set(
|
|
80
|
+
"entityRefs",
|
|
81
|
+
Array.from(this.starredEntities)
|
|
82
|
+
);
|
|
74
83
|
}
|
|
75
84
|
starredEntitie$() {
|
|
76
85
|
return this.observable;
|
|
@@ -228,9 +237,13 @@ function AboutContent(props) {
|
|
|
228
237
|
const partOfSystemRelations = getEntityRelations(entity, RELATION_PART_OF, {
|
|
229
238
|
kind: "system"
|
|
230
239
|
});
|
|
231
|
-
const partOfComponentRelations = getEntityRelations(
|
|
232
|
-
|
|
233
|
-
|
|
240
|
+
const partOfComponentRelations = getEntityRelations(
|
|
241
|
+
entity,
|
|
242
|
+
RELATION_PART_OF,
|
|
243
|
+
{
|
|
244
|
+
kind: "component"
|
|
245
|
+
}
|
|
246
|
+
);
|
|
234
247
|
const partOfDomainRelations = getEntityRelations(entity, RELATION_PART_OF, {
|
|
235
248
|
kind: "domain"
|
|
236
249
|
});
|
|
@@ -303,7 +316,11 @@ function AboutContent(props) {
|
|
|
303
316
|
var _a2;
|
|
304
317
|
return {
|
|
305
318
|
text: target,
|
|
306
|
-
href: getLocationTargetHref(
|
|
319
|
+
href: getLocationTargetHref(
|
|
320
|
+
target,
|
|
321
|
+
((_a2 = entity == null ? void 0 : entity.spec) == null ? void 0 : _a2.type) || "unknown",
|
|
322
|
+
entitySourceLocation
|
|
323
|
+
)
|
|
307
324
|
};
|
|
308
325
|
})
|
|
309
326
|
})));
|
|
@@ -337,7 +354,10 @@ function AboutCard(props) {
|
|
|
337
354
|
const catalogApi = useApi(catalogApiRef);
|
|
338
355
|
const alertApi = useApi(alertApiRef);
|
|
339
356
|
const viewTechdocLink = useRouteRef(viewTechDocRouteRef);
|
|
340
|
-
const entitySourceLocation = getEntitySourceLocation$1(
|
|
357
|
+
const entitySourceLocation = getEntitySourceLocation$1(
|
|
358
|
+
entity,
|
|
359
|
+
scmIntegrationsApi
|
|
360
|
+
);
|
|
341
361
|
const entityMetadataEditUrl = (_a = entity.metadata.annotations) == null ? void 0 : _a[ANNOTATION_EDIT_URL];
|
|
342
362
|
const viewInSource = {
|
|
343
363
|
label: "View Source",
|
|
@@ -400,11 +420,13 @@ function AboutCard(props) {
|
|
|
400
420
|
})));
|
|
401
421
|
}
|
|
402
422
|
|
|
403
|
-
const useStyles$2 = makeStyles(
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}
|
|
423
|
+
const useStyles$2 = makeStyles(
|
|
424
|
+
(theme) => createStyles({
|
|
425
|
+
root: {
|
|
426
|
+
...theme.typography.h4
|
|
427
|
+
}
|
|
428
|
+
})
|
|
429
|
+
);
|
|
408
430
|
function CatalogKindHeader(props) {
|
|
409
431
|
var _a;
|
|
410
432
|
const { initialFilter = "component", allowedKinds } = props;
|
|
@@ -420,11 +442,16 @@ function CatalogKindHeader(props) {
|
|
|
420
442
|
updateFilters,
|
|
421
443
|
queryParameters: { kind: kindParameter }
|
|
422
444
|
} = useEntityList();
|
|
423
|
-
const queryParamKind = useMemo(
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
445
|
+
const queryParamKind = useMemo(
|
|
446
|
+
() => {
|
|
447
|
+
var _a2;
|
|
448
|
+
return (_a2 = [kindParameter].flat()[0]) == null ? void 0 : _a2.toLocaleLowerCase("en-US");
|
|
449
|
+
},
|
|
450
|
+
[kindParameter]
|
|
451
|
+
);
|
|
452
|
+
const [selectedKind, setSelectedKind] = useState(
|
|
453
|
+
queryParamKind != null ? queryParamKind : initialFilter
|
|
454
|
+
);
|
|
428
455
|
useEffect(() => {
|
|
429
456
|
updateFilters({
|
|
430
457
|
kind: selectedKind ? new EntityKindFilter(selectedKind) : void 0
|
|
@@ -435,7 +462,13 @@ function CatalogKindHeader(props) {
|
|
|
435
462
|
setSelectedKind(queryParamKind);
|
|
436
463
|
}
|
|
437
464
|
}, [queryParamKind]);
|
|
438
|
-
const availableKinds = [capitalize(selectedKind)].concat(
|
|
465
|
+
const availableKinds = [capitalize(selectedKind)].concat(
|
|
466
|
+
(_a = allKinds == null ? void 0 : allKinds.filter(
|
|
467
|
+
(k) => allowedKinds ? allowedKinds.some(
|
|
468
|
+
(a) => a.toLocaleLowerCase("en-US") === k.toLocaleLowerCase("en-US")
|
|
469
|
+
) : true
|
|
470
|
+
)) != null ? _a : []
|
|
471
|
+
);
|
|
439
472
|
const options = availableKinds.sort().reduce((acc, kind) => {
|
|
440
473
|
acc[kind.toLocaleLowerCase("en-US")] = kind;
|
|
441
474
|
return acc;
|
|
@@ -737,9 +770,11 @@ const CatalogTable = (props) => {
|
|
|
737
770
|
}),
|
|
738
771
|
ownedByRelationsTitle: ownedByRelations.map((r) => humanizeEntityRef(r, { defaultKind: "group" })).join(", "),
|
|
739
772
|
ownedByRelations,
|
|
740
|
-
partOfSystemRelationTitle: partOfSystemRelations.map(
|
|
741
|
-
|
|
742
|
-
|
|
773
|
+
partOfSystemRelationTitle: partOfSystemRelations.map(
|
|
774
|
+
(r) => humanizeEntityRef(r, {
|
|
775
|
+
defaultKind: "system"
|
|
776
|
+
})
|
|
777
|
+
).join(", "),
|
|
743
778
|
partOfSystemRelations
|
|
744
779
|
}
|
|
745
780
|
};
|
|
@@ -796,13 +831,16 @@ function UnregisterEntity(props) {
|
|
|
796
831
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, unregisterButton);
|
|
797
832
|
}
|
|
798
833
|
|
|
799
|
-
const useStyles = makeStyles$1(
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
}
|
|
834
|
+
const useStyles = makeStyles$1(
|
|
835
|
+
(theme) => {
|
|
836
|
+
return {
|
|
837
|
+
button: {
|
|
838
|
+
color: theme.page.fontColor
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
},
|
|
842
|
+
{ name: "PluginCatalogEntityContextMenu" }
|
|
843
|
+
);
|
|
806
844
|
function EntityContextMenu(props) {
|
|
807
845
|
const {
|
|
808
846
|
UNSTABLE_extraContextMenuItems,
|
|
@@ -812,7 +850,9 @@ function EntityContextMenu(props) {
|
|
|
812
850
|
} = props;
|
|
813
851
|
const [anchorEl, setAnchorEl] = useState();
|
|
814
852
|
const classes = useStyles();
|
|
815
|
-
const unregisterPermission = useEntityPermission(
|
|
853
|
+
const unregisterPermission = useEntityPermission(
|
|
854
|
+
catalogEntityDeletePermission
|
|
855
|
+
);
|
|
816
856
|
const isAllowed = unregisterPermission.allowed;
|
|
817
857
|
const onOpen = (event) => {
|
|
818
858
|
setAnchorEl(event.currentTarget);
|
|
@@ -934,25 +974,34 @@ const EntityLayout = (props) => {
|
|
|
934
974
|
const { kind, namespace, name } = useRouteRefParams(entityRouteRef);
|
|
935
975
|
const { entity, loading, error } = useAsyncEntity();
|
|
936
976
|
const location = useLocation();
|
|
937
|
-
const routes = useElementFilter(
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
{
|
|
948
|
-
path: elementProps.path,
|
|
949
|
-
title: elementProps.title,
|
|
950
|
-
children: elementProps.children,
|
|
951
|
-
tabProps: elementProps.tabProps
|
|
977
|
+
const routes = useElementFilter(
|
|
978
|
+
children,
|
|
979
|
+
(elements) => elements.selectByComponentData({
|
|
980
|
+
key: dataKey,
|
|
981
|
+
withStrictError: "Child of EntityLayout must be an EntityLayout.Route"
|
|
982
|
+
}).getElements().flatMap(({ props: elementProps }) => {
|
|
983
|
+
if (!entity) {
|
|
984
|
+
return [];
|
|
985
|
+
} else if (elementProps.if && !elementProps.if(entity)) {
|
|
986
|
+
return [];
|
|
952
987
|
}
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
988
|
+
return [
|
|
989
|
+
{
|
|
990
|
+
path: elementProps.path,
|
|
991
|
+
title: elementProps.title,
|
|
992
|
+
children: elementProps.children,
|
|
993
|
+
tabProps: elementProps.tabProps
|
|
994
|
+
}
|
|
995
|
+
];
|
|
996
|
+
}),
|
|
997
|
+
[entity]
|
|
998
|
+
);
|
|
999
|
+
const { headerTitle, headerType } = headerProps(
|
|
1000
|
+
kind,
|
|
1001
|
+
namespace,
|
|
1002
|
+
name,
|
|
1003
|
+
entity
|
|
1004
|
+
);
|
|
956
1005
|
const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false);
|
|
957
1006
|
const [inspectionDialogOpen, setInspectionDialogOpen] = useState(false);
|
|
958
1007
|
const navigate = useNavigate();
|
|
@@ -1076,7 +1125,10 @@ async function hasCatalogProcessingErrors(entity, context) {
|
|
|
1076
1125
|
if (!catalogApi) {
|
|
1077
1126
|
throw new Error(`No implementation available for ${catalogApiRef}`);
|
|
1078
1127
|
}
|
|
1079
|
-
const errors = await getOwnAndAncestorsErrors(
|
|
1128
|
+
const errors = await getOwnAndAncestorsErrors(
|
|
1129
|
+
stringifyEntityRef(entity),
|
|
1130
|
+
catalogApi
|
|
1131
|
+
);
|
|
1080
1132
|
return errors.items.length > 0;
|
|
1081
1133
|
}
|
|
1082
1134
|
function EntityProcessingErrorsPanel() {
|
|
@@ -1116,31 +1168,37 @@ const EntitySwitch = (props) => {
|
|
|
1116
1168
|
var _a, _b;
|
|
1117
1169
|
const { entity, loading } = useAsyncEntity();
|
|
1118
1170
|
const apis = useApiHolder();
|
|
1119
|
-
const results = useElementFilter(
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1171
|
+
const results = useElementFilter(
|
|
1172
|
+
props.children,
|
|
1173
|
+
(collection) => collection.selectByComponentData({
|
|
1174
|
+
key: ENTITY_SWITCH_KEY,
|
|
1175
|
+
withStrictError: "Child of EntitySwitch is not an EntitySwitch.Case"
|
|
1176
|
+
}).getElements().flatMap((element) => {
|
|
1177
|
+
var _a2;
|
|
1178
|
+
if (loading) {
|
|
1179
|
+
return [];
|
|
1180
|
+
}
|
|
1181
|
+
const { if: condition, children: elementsChildren } = element.props;
|
|
1182
|
+
if (!entity) {
|
|
1183
|
+
return [
|
|
1184
|
+
{
|
|
1185
|
+
if: condition === void 0,
|
|
1186
|
+
children: elementsChildren
|
|
1187
|
+
}
|
|
1188
|
+
];
|
|
1189
|
+
}
|
|
1129
1190
|
return [
|
|
1130
1191
|
{
|
|
1131
|
-
if: condition
|
|
1192
|
+
if: (_a2 = condition == null ? void 0 : condition(entity, { apis })) != null ? _a2 : true,
|
|
1132
1193
|
children: elementsChildren
|
|
1133
1194
|
}
|
|
1134
1195
|
];
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
];
|
|
1142
|
-
}), [apis, entity, loading]);
|
|
1143
|
-
const hasAsyncCases = results.some((r) => typeof r.if === "object" && "then" in r.if);
|
|
1196
|
+
}),
|
|
1197
|
+
[apis, entity, loading]
|
|
1198
|
+
);
|
|
1199
|
+
const hasAsyncCases = results.some(
|
|
1200
|
+
(r) => typeof r.if === "object" && "then" in r.if
|
|
1201
|
+
);
|
|
1144
1202
|
if (hasAsyncCases) {
|
|
1145
1203
|
return /* @__PURE__ */ React.createElement(AsyncEntitySwitch, {
|
|
1146
1204
|
results
|
|
@@ -1151,15 +1209,17 @@ const EntitySwitch = (props) => {
|
|
|
1151
1209
|
function AsyncEntitySwitch({ results }) {
|
|
1152
1210
|
const { loading, value } = useAsync(async () => {
|
|
1153
1211
|
var _a;
|
|
1154
|
-
const promises = results.map(
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1212
|
+
const promises = results.map(
|
|
1213
|
+
async ({ if: condition, children: output }) => {
|
|
1214
|
+
try {
|
|
1215
|
+
if (await condition) {
|
|
1216
|
+
return output;
|
|
1217
|
+
}
|
|
1218
|
+
} catch {
|
|
1158
1219
|
}
|
|
1159
|
-
|
|
1220
|
+
return null;
|
|
1160
1221
|
}
|
|
1161
|
-
|
|
1162
|
-
});
|
|
1222
|
+
);
|
|
1163
1223
|
return (_a = (await Promise.all(promises)).find(Boolean)) != null ? _a : null;
|
|
1164
1224
|
}, [results]);
|
|
1165
1225
|
if (loading || !value) {
|
|
@@ -1170,7 +1230,9 @@ function AsyncEntitySwitch({ results }) {
|
|
|
1170
1230
|
EntitySwitch.Case = EntitySwitchCaseComponent;
|
|
1171
1231
|
|
|
1172
1232
|
function strCmp(a, b) {
|
|
1173
|
-
return Boolean(
|
|
1233
|
+
return Boolean(
|
|
1234
|
+
a && (a == null ? void 0 : a.toLocaleLowerCase("en-US")) === (b == null ? void 0 : b.toLocaleLowerCase("en-US"))
|
|
1235
|
+
);
|
|
1174
1236
|
}
|
|
1175
1237
|
function strCmpAll(value, cmpValues) {
|
|
1176
1238
|
return typeof cmpValues === "string" ? strCmp(value, cmpValues) : cmpValues.some((cmpVal) => strCmp(value, cmpVal));
|
|
@@ -1222,78 +1284,118 @@ const catalogPlugin = createPlugin({
|
|
|
1222
1284
|
externalRoutes: {
|
|
1223
1285
|
createComponent: createComponentRouteRef,
|
|
1224
1286
|
viewTechDoc: viewTechDocRouteRef
|
|
1287
|
+
},
|
|
1288
|
+
__experimentalConfigure(options) {
|
|
1289
|
+
const defaultOptions = {
|
|
1290
|
+
createButtonTitle: "Create"
|
|
1291
|
+
};
|
|
1292
|
+
return { ...defaultOptions, ...options };
|
|
1225
1293
|
}
|
|
1226
1294
|
});
|
|
1227
|
-
const CatalogIndexPage = catalogPlugin.provide(
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
const
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
const
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
const
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1295
|
+
const CatalogIndexPage = catalogPlugin.provide(
|
|
1296
|
+
createRoutableExtension({
|
|
1297
|
+
name: "CatalogIndexPage",
|
|
1298
|
+
component: () => import('./index-543b1d23.esm.js').then((m) => m.CatalogPage),
|
|
1299
|
+
mountPoint: rootRouteRef
|
|
1300
|
+
})
|
|
1301
|
+
);
|
|
1302
|
+
const CatalogEntityPage = catalogPlugin.provide(
|
|
1303
|
+
createRoutableExtension({
|
|
1304
|
+
name: "CatalogEntityPage",
|
|
1305
|
+
component: () => import('./index-46417657.esm.js').then((m) => m.CatalogEntityPage),
|
|
1306
|
+
mountPoint: entityRouteRef
|
|
1307
|
+
})
|
|
1308
|
+
);
|
|
1309
|
+
const EntityAboutCard = catalogPlugin.provide(
|
|
1310
|
+
createComponentExtension({
|
|
1311
|
+
name: "EntityAboutCard",
|
|
1312
|
+
component: {
|
|
1313
|
+
lazy: () => import('./index-9cdebd35.esm.js').then((m) => m.AboutCard)
|
|
1314
|
+
}
|
|
1315
|
+
})
|
|
1316
|
+
);
|
|
1317
|
+
const EntityLinksCard = catalogPlugin.provide(
|
|
1318
|
+
createComponentExtension({
|
|
1319
|
+
name: "EntityLinksCard",
|
|
1320
|
+
component: {
|
|
1321
|
+
lazy: () => import('./index-0550248f.esm.js').then((m) => m.EntityLinksCard)
|
|
1322
|
+
}
|
|
1323
|
+
})
|
|
1324
|
+
);
|
|
1325
|
+
const EntityHasSystemsCard = catalogPlugin.provide(
|
|
1326
|
+
createComponentExtension({
|
|
1327
|
+
name: "EntityHasSystemsCard",
|
|
1328
|
+
component: {
|
|
1329
|
+
lazy: () => import('./index-3763491b.esm.js').then((m) => m.HasSystemsCard)
|
|
1330
|
+
}
|
|
1331
|
+
})
|
|
1332
|
+
);
|
|
1333
|
+
const EntityHasComponentsCard = catalogPlugin.provide(
|
|
1334
|
+
createComponentExtension({
|
|
1335
|
+
name: "EntityHasComponentsCard",
|
|
1336
|
+
component: {
|
|
1337
|
+
lazy: () => import('./index-acb3cf04.esm.js').then((m) => m.HasComponentsCard)
|
|
1338
|
+
}
|
|
1339
|
+
})
|
|
1340
|
+
);
|
|
1341
|
+
const EntityHasSubcomponentsCard = catalogPlugin.provide(
|
|
1342
|
+
createComponentExtension({
|
|
1343
|
+
name: "EntityHasSubcomponentsCard",
|
|
1344
|
+
component: {
|
|
1345
|
+
lazy: () => import('./index-41ab53b6.esm.js').then(
|
|
1346
|
+
(m) => m.HasSubcomponentsCard
|
|
1347
|
+
)
|
|
1348
|
+
}
|
|
1349
|
+
})
|
|
1350
|
+
);
|
|
1351
|
+
const EntityHasResourcesCard = catalogPlugin.provide(
|
|
1352
|
+
createComponentExtension({
|
|
1353
|
+
name: "EntityHasResourcesCard",
|
|
1354
|
+
component: {
|
|
1355
|
+
lazy: () => import('./index-b3ad464b.esm.js').then((m) => m.HasResourcesCard)
|
|
1356
|
+
}
|
|
1357
|
+
})
|
|
1358
|
+
);
|
|
1359
|
+
const EntityDependsOnComponentsCard = catalogPlugin.provide(
|
|
1360
|
+
createComponentExtension({
|
|
1361
|
+
name: "EntityDependsOnComponentsCard",
|
|
1362
|
+
component: {
|
|
1363
|
+
lazy: () => import('./index-66fdb6ad.esm.js').then(
|
|
1364
|
+
(m) => m.DependsOnComponentsCard
|
|
1365
|
+
)
|
|
1366
|
+
}
|
|
1367
|
+
})
|
|
1368
|
+
);
|
|
1369
|
+
const EntityDependencyOfComponentsCard = catalogPlugin.provide(
|
|
1370
|
+
createComponentExtension({
|
|
1371
|
+
name: "EntityDependencyOfComponentsCard",
|
|
1372
|
+
component: {
|
|
1373
|
+
lazy: () => import('./index-390fab14.esm.js').then(
|
|
1374
|
+
(m) => m.DependencyOfComponentsCard
|
|
1375
|
+
)
|
|
1376
|
+
}
|
|
1377
|
+
})
|
|
1378
|
+
);
|
|
1379
|
+
const EntityDependsOnResourcesCard = catalogPlugin.provide(
|
|
1380
|
+
createComponentExtension({
|
|
1381
|
+
name: "EntityDependsOnResourcesCard",
|
|
1382
|
+
component: {
|
|
1383
|
+
lazy: () => import('./index-d41abbff.esm.js').then(
|
|
1384
|
+
(m) => m.DependsOnResourcesCard
|
|
1385
|
+
)
|
|
1386
|
+
}
|
|
1387
|
+
})
|
|
1388
|
+
);
|
|
1389
|
+
const RelatedEntitiesCard = catalogPlugin.provide(
|
|
1390
|
+
createComponentExtension({
|
|
1391
|
+
name: "RelatedEntitiesCard",
|
|
1392
|
+
component: {
|
|
1393
|
+
lazy: () => import('./index-c2914273.esm.js').then(
|
|
1394
|
+
(m) => m.RelatedEntitiesCard
|
|
1395
|
+
)
|
|
1396
|
+
}
|
|
1397
|
+
})
|
|
1398
|
+
);
|
|
1297
1399
|
|
|
1298
1400
|
export { AboutCard as A, EntityListContainer as B, CatalogKindHeader as C, DefaultStarredEntitiesApi as D, EntityAboutCard as E, FilteredEntityLayout as F, LinksGridList as L, RelatedEntitiesCard as R, CatalogTable as a, AboutContent as b, createComponentRouteRef as c, AboutField as d, CatalogEntityPage as e, CatalogIndexPage as f, catalogPlugin as g, EntityDependencyOfComponentsCard as h, EntityDependsOnComponentsCard as i, EntityDependsOnResourcesCard as j, EntityHasComponentsCard as k, EntityHasResourcesCard as l, EntityHasSubcomponentsCard as m, EntityHasSystemsCard as n, EntityLinksCard as o, CatalogSearchResultListItem as p, EntityLayout as q, EntityOrphanWarning as r, isOrphan as s, EntityProcessingErrorsPanel as t, hasCatalogProcessingErrors as u, EntitySwitch as v, isKind as w, isNamespace as x, isComponentType as y, FilterContainer as z };
|
|
1299
|
-
//# sourceMappingURL=index-
|
|
1401
|
+
//# sourceMappingURL=index-2bfd6ae7.esm.js.map
|