@backstage-community/plugin-explore 0.8.0 → 0.9.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 +18 -0
- package/dist/components/CatalogKindExploreContent/CatalogKindExploreContent.esm.js +17 -10
- package/dist/components/CatalogKindExploreContent/CatalogKindExploreContent.esm.js.map +1 -1
- package/dist/components/DefaultExplorePage/DefaultExplorePage.esm.js +9 -7
- package/dist/components/DefaultExplorePage/DefaultExplorePage.esm.js.map +1 -1
- package/dist/components/DomainCard/DomainCard.esm.js +16 -9
- package/dist/components/DomainCard/DomainCard.esm.js.map +1 -1
- package/dist/components/DomainExplorerContent/DomainExplorerContent.esm.js +13 -10
- package/dist/components/DomainExplorerContent/DomainExplorerContent.esm.js.map +1 -1
- package/dist/components/EntityCard/EntityCard.esm.js +16 -9
- package/dist/components/EntityCard/EntityCard.esm.js.map +1 -1
- package/dist/components/ExploreLayout/ExploreLayout.esm.js +11 -8
- package/dist/components/ExploreLayout/ExploreLayout.esm.js.map +1 -1
- package/dist/components/ExplorePage/ExplorePage.esm.js +2 -2
- package/dist/components/ExplorePage/ExplorePage.esm.js.map +1 -1
- package/dist/components/GroupsExplorerContent/GroupsDiagram.esm.js +70 -57
- package/dist/components/GroupsExplorerContent/GroupsDiagram.esm.js.map +1 -1
- package/dist/components/GroupsExplorerContent/GroupsExplorerContent.esm.js +12 -9
- package/dist/components/GroupsExplorerContent/GroupsExplorerContent.esm.js.map +1 -1
- package/dist/components/ToolCard/ToolCard.esm.js +33 -21
- package/dist/components/ToolCard/ToolCard.esm.js.map +1 -1
- package/dist/components/ToolExplorerContent/ToolExplorerContent.esm.js +9 -6
- package/dist/components/ToolExplorerContent/ToolExplorerContent.esm.js.map +1 -1
- package/dist/components/ToolSearchResultListItem/ToolSearchResultListItem.esm.js +28 -22
- package/dist/components/ToolSearchResultListItem/ToolSearchResultListItem.esm.js.map +1 -1
- package/dist/index.d.ts +14 -14
- package/package.json +16 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @backstage-community/plugin-explore
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 849c872: Backstage version bump to v1.38.1
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [849c872]
|
|
12
|
+
- @backstage-community/plugin-explore-common@0.4.0
|
|
13
|
+
- @backstage-community/plugin-explore-react@0.4.0
|
|
14
|
+
|
|
15
|
+
## 0.8.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 4aad9f3: remove unused devDependency `canvas`
|
|
20
|
+
|
|
3
21
|
## 0.8.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
1
2
|
import { catalogApiRef } from '@backstage/plugin-catalog-react';
|
|
2
3
|
import Button from '@material-ui/core/Button';
|
|
3
|
-
import React from 'react';
|
|
4
4
|
import useAsync from 'react-use/esm/useAsync';
|
|
5
5
|
import { EntityCard } from '../EntityCard/EntityCard.esm.js';
|
|
6
6
|
import { Content, ContentHeader, SupportButton, Progress, WarningPanel, EmptyState, ItemCardGrid } from '@backstage/core-components';
|
|
@@ -22,37 +22,44 @@ const Body = (props) => {
|
|
|
22
22
|
return response.items;
|
|
23
23
|
}, [kind]);
|
|
24
24
|
if (loading) {
|
|
25
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ jsx(Progress, {});
|
|
26
26
|
}
|
|
27
27
|
if (error) {
|
|
28
|
-
return /* @__PURE__ */
|
|
28
|
+
return /* @__PURE__ */ jsx(WarningPanel, { severity: "error", title: `Could not load ${kindPlural}.`, children: error.message });
|
|
29
29
|
}
|
|
30
30
|
if (!entities?.length) {
|
|
31
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
32
|
EmptyState,
|
|
33
33
|
{
|
|
34
34
|
missing: "info",
|
|
35
35
|
title: `No ${kindPlural} to display`,
|
|
36
36
|
description: `You haven't added any ${kindPlural} yet.`,
|
|
37
|
-
action: /* @__PURE__ */
|
|
37
|
+
action: /* @__PURE__ */ jsx(
|
|
38
38
|
Button,
|
|
39
39
|
{
|
|
40
40
|
variant: "contained",
|
|
41
41
|
color: "primary",
|
|
42
|
-
href: `https://backstage.io/docs/features/software-catalog/descriptor-format#kind-${kind}
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
href: `https://backstage.io/docs/features/software-catalog/descriptor-format#kind-${kind}`,
|
|
43
|
+
children: "Read more"
|
|
44
|
+
}
|
|
45
45
|
)
|
|
46
46
|
}
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ jsx(ItemCardGrid, { children: entities.map((entity, index) => /* @__PURE__ */ jsx(EntityCard, { entity }, index)) });
|
|
50
50
|
};
|
|
51
51
|
const CatalogKindExploreContent = (props) => {
|
|
52
52
|
const { kind, title } = props;
|
|
53
53
|
const kindLowercase = kind.toLocaleLowerCase();
|
|
54
54
|
const kindCapitalized = `${kind[0].toLocaleUpperCase()}${kind.substring(1)}`;
|
|
55
|
-
return /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ jsxs(Content, { noPadding: true, children: [
|
|
56
|
+
/* @__PURE__ */ jsx(ContentHeader, { title: title || `${pluralize(kindCapitalized)}`, children: /* @__PURE__ */ jsx(SupportButton, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
57
|
+
"Discover the ",
|
|
58
|
+
pluralize(kindLowercase),
|
|
59
|
+
" in your ecosystem."
|
|
60
|
+
] }) }) }),
|
|
61
|
+
/* @__PURE__ */ jsx(Body, { kind: kindLowercase })
|
|
62
|
+
] });
|
|
56
63
|
};
|
|
57
64
|
|
|
58
65
|
export { CatalogKindExploreContent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CatalogKindExploreContent.esm.js","sources":["../../../src/components/CatalogKindExploreContent/CatalogKindExploreContent.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport Button from '@material-ui/core/Button';\nimport
|
|
1
|
+
{"version":3,"file":"CatalogKindExploreContent.esm.js","sources":["../../../src/components/CatalogKindExploreContent/CatalogKindExploreContent.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport Button from '@material-ui/core/Button';\nimport useAsync from 'react-use/esm/useAsync';\nimport { EntityCard } from '../EntityCard';\nimport {\n Content,\n ContentHeader,\n EmptyState,\n ItemCardGrid,\n Progress,\n SupportButton,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport pluralize from 'pluralize';\n\nconst Body = (props: { kind: string }) => {\n const { kind } = props;\n const kindPlural = pluralize(kind);\n const catalogApi = useApi(catalogApiRef);\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: { kind },\n });\n return response.items as Entity[];\n }, [kind]);\n\n if (loading) {\n return <Progress />;\n }\n\n if (error) {\n return (\n <WarningPanel severity=\"error\" title={`Could not load ${kindPlural}.`}>\n {error.message}\n </WarningPanel>\n );\n }\n\n if (!entities?.length) {\n return (\n <EmptyState\n missing=\"info\"\n title={`No ${kindPlural} to display`}\n description={`You haven't added any ${kindPlural} yet.`}\n action={\n <Button\n variant=\"contained\"\n color=\"primary\"\n href={`https://backstage.io/docs/features/software-catalog/descriptor-format#kind-${kind}`}\n >\n Read more\n </Button>\n }\n />\n );\n }\n\n return (\n <ItemCardGrid>\n {entities.map((entity, index) => (\n <EntityCard key={index} entity={entity} />\n ))}\n </ItemCardGrid>\n );\n};\n\n/** @public */\nexport const CatalogKindExploreContent = (props: {\n title?: string;\n kind: string;\n}) => {\n const { kind, title } = props;\n const kindLowercase = kind.toLocaleLowerCase();\n const kindCapitalized = `${kind[0].toLocaleUpperCase()}${kind.substring(1)}`;\n return (\n <Content noPadding>\n <ContentHeader title={title || `${pluralize(kindCapitalized)}`}>\n <SupportButton>\n <>Discover the {pluralize(kindLowercase)} in your ecosystem.</>\n </SupportButton>\n </ContentHeader>\n <Body kind={kindLowercase} />\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAiCA,MAAM,IAAA,GAAO,CAAC,KAA4B,KAAA;AACxC,EAAM,MAAA,EAAE,MAAS,GAAA,KAAA;AACjB,EAAM,MAAA,UAAA,GAAa,UAAU,IAAI,CAAA;AACjC,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA;AACvC,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,QAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACF,GAAI,SAAS,YAAY;AACvB,IAAM,MAAA,QAAA,GAAW,MAA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A,aAAA,GAAgB,KAAK,iBAAkB,EAAA;AAC7C,EAAM,MAAA,eAAA,GAAkB,CAAG,EAAA,IAAA,CAAK,CAAC,CAAA,CAAE,iBAAkB,EAAC,CAAG,EAAA,IAAA,CAAK,SAAU,CAAA,CAAC,CAAC,CAAA,CAAA;AAC1E,EACE,uBAAA,IAAA,CAAC,OAAQ,EAAA,EAAA,SAAA,EAAS,IAChB,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,aAAA,EAAA,EAAc,KAAO,EAAA,KAAA,IAAS,CAAG,EAAA,SAAA,CAAU,eAAe,CAAC,CAAA,CAAA,EAC1D,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EACC,QAAE,kBAAA,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,MAAA,eAAA;AAAA,MAAc,UAAU,aAAa,CAAA;AAAA,MAAE;AAAA,KAAA,EAAmB,GAC9D,CACF,EAAA,CAAA;AAAA,oBACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAM,aAAe,EAAA;AAAA,GAC7B,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { ExploreLayout } from '../ExploreLayout/ExploreLayout.esm.js';
|
|
3
3
|
import { GroupsExplorerContent } from '../GroupsExplorerContent/GroupsExplorerContent.esm.js';
|
|
4
4
|
import { ToolExplorerContent } from '../ToolExplorerContent/ToolExplorerContent.esm.js';
|
|
@@ -8,15 +8,17 @@ import { CatalogKindExploreContent } from '../CatalogKindExploreContent/CatalogK
|
|
|
8
8
|
const DefaultExplorePage = () => {
|
|
9
9
|
const configApi = useApi(configApiRef);
|
|
10
10
|
const organizationName = configApi.getOptionalString("organization.name") ?? "Backstage";
|
|
11
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ jsxs(
|
|
12
12
|
ExploreLayout,
|
|
13
13
|
{
|
|
14
14
|
title: `Explore the ${organizationName} ecosystem`,
|
|
15
|
-
subtitle: "Discover solutions available in your ecosystem"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
subtitle: "Discover solutions available in your ecosystem",
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx(ExploreLayout.Route, { path: "domains", title: "Domains", children: /* @__PURE__ */ jsx(CatalogKindExploreContent, { kind: "domain" }) }),
|
|
18
|
+
/* @__PURE__ */ jsx(ExploreLayout.Route, { path: "groups", title: "Groups", children: /* @__PURE__ */ jsx(GroupsExplorerContent, {}) }),
|
|
19
|
+
/* @__PURE__ */ jsx(ExploreLayout.Route, { path: "tools", title: "Tools", children: /* @__PURE__ */ jsx(ToolExplorerContent, {}) })
|
|
20
|
+
]
|
|
21
|
+
}
|
|
20
22
|
);
|
|
21
23
|
};
|
|
22
24
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultExplorePage.esm.js","sources":["../../../src/components/DefaultExplorePage/DefaultExplorePage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"DefaultExplorePage.esm.js","sources":["../../../src/components/DefaultExplorePage/DefaultExplorePage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ExploreLayout } from '../ExploreLayout';\nimport { GroupsExplorerContent } from '../GroupsExplorerContent';\nimport { ToolExplorerContent } from '../ToolExplorerContent';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { CatalogKindExploreContent } from '../CatalogKindExploreContent';\n\nexport const DefaultExplorePage = () => {\n const configApi = useApi(configApiRef);\n const organizationName =\n configApi.getOptionalString('organization.name') ?? 'Backstage';\n\n return (\n <ExploreLayout\n title={`Explore the ${organizationName} ecosystem`}\n subtitle=\"Discover solutions available in your ecosystem\"\n >\n <ExploreLayout.Route path=\"domains\" title=\"Domains\">\n <CatalogKindExploreContent kind=\"domain\" />\n </ExploreLayout.Route>\n <ExploreLayout.Route path=\"groups\" title=\"Groups\">\n <GroupsExplorerContent />\n </ExploreLayout.Route>\n <ExploreLayout.Route path=\"tools\" title=\"Tools\">\n <ToolExplorerContent />\n </ExploreLayout.Route>\n </ExploreLayout>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAsBO,MAAM,qBAAqB,MAAM;AACtC,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAA,MAAM,gBACJ,GAAA,SAAA,CAAU,iBAAkB,CAAA,mBAAmB,CAAK,IAAA,WAAA;AAEtD,EACE,uBAAA,IAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,eAAe,gBAAgB,CAAA,UAAA,CAAA;AAAA,MACtC,QAAS,EAAA,gDAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,aAAA,CAAc,KAAd,EAAA,EAAoB,IAAK,EAAA,SAAA,EAAU,KAAM,EAAA,SAAA,EACxC,QAAC,kBAAA,GAAA,CAAA,yBAAA,EAAA,EAA0B,IAAK,EAAA,QAAA,EAAS,CAC3C,EAAA,CAAA;AAAA,wBACA,GAAA,CAAC,aAAc,CAAA,KAAA,EAAd,EAAoB,IAAA,EAAK,UAAS,KAAM,EAAA,QAAA,EACvC,QAAC,kBAAA,GAAA,CAAA,qBAAA,EAAA,EAAsB,CACzB,EAAA,CAAA;AAAA,wBACA,GAAA,CAAC,aAAc,CAAA,KAAA,EAAd,EAAoB,IAAA,EAAK,SAAQ,KAAM,EAAA,OAAA,EACtC,QAAC,kBAAA,GAAA,CAAA,mBAAA,EAAA,EAAoB,CACvB,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { RELATION_OWNED_BY } from '@backstage/catalog-model';
|
|
2
3
|
import { entityRouteRef, getEntityRelations, entityRouteParams, EntityRefLinks } from '@backstage/plugin-catalog-react';
|
|
3
4
|
import Box from '@material-ui/core/Box';
|
|
@@ -6,7 +7,6 @@ import CardActions from '@material-ui/core/CardActions';
|
|
|
6
7
|
import CardContent from '@material-ui/core/CardContent';
|
|
7
8
|
import CardMedia from '@material-ui/core/CardMedia';
|
|
8
9
|
import Chip from '@material-ui/core/Chip';
|
|
9
|
-
import React from 'react';
|
|
10
10
|
import { ItemCardHeader, LinkButton } from '@backstage/core-components';
|
|
11
11
|
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ const DomainCard = (props) => {
|
|
|
15
15
|
const catalogEntityRoute = useRouteRef(entityRouteRef);
|
|
16
16
|
const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);
|
|
17
17
|
const url = catalogEntityRoute(entityRouteParams(entity));
|
|
18
|
-
const owner = /* @__PURE__ */
|
|
18
|
+
const owner = /* @__PURE__ */ jsx(
|
|
19
19
|
EntityRefLinks,
|
|
20
20
|
{
|
|
21
21
|
entityRefs: ownedByRelations,
|
|
@@ -23,13 +23,20 @@ const DomainCard = (props) => {
|
|
|
23
23
|
color: "inherit"
|
|
24
24
|
}
|
|
25
25
|
);
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
27
|
+
/* @__PURE__ */ jsx(CardMedia, { children: /* @__PURE__ */ jsx(
|
|
28
|
+
ItemCardHeader,
|
|
29
|
+
{
|
|
30
|
+
title: entity.metadata.title ?? entity.metadata.name,
|
|
31
|
+
subtitle: owner
|
|
32
|
+
}
|
|
33
|
+
) }),
|
|
34
|
+
/* @__PURE__ */ jsxs(CardContent, { children: [
|
|
35
|
+
entity.metadata.tags?.length ? /* @__PURE__ */ jsx(Box, { children: entity.metadata.tags.map((tag) => /* @__PURE__ */ jsx(Chip, { size: "small", label: tag }, tag)) }) : null,
|
|
36
|
+
entity.metadata.description
|
|
37
|
+
] }),
|
|
38
|
+
/* @__PURE__ */ jsx(CardActions, { children: /* @__PURE__ */ jsx(LinkButton, { to: url, color: "primary", children: "Explore" }) })
|
|
39
|
+
] });
|
|
33
40
|
};
|
|
34
41
|
|
|
35
42
|
export { DomainCard };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DomainCard.esm.js","sources":["../../../src/components/DomainCard/DomainCard.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DomainEntity, RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n entityRouteParams,\n getEntityRelations,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport Box from '@material-ui/core/Box';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardMedia from '@material-ui/core/CardMedia';\nimport Chip from '@material-ui/core/Chip';\
|
|
1
|
+
{"version":3,"file":"DomainCard.esm.js","sources":["../../../src/components/DomainCard/DomainCard.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DomainEntity, RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n entityRouteParams,\n getEntityRelations,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport Box from '@material-ui/core/Box';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardMedia from '@material-ui/core/CardMedia';\nimport Chip from '@material-ui/core/Chip';\n\nimport { LinkButton, ItemCardHeader } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\n/** @public */\nexport const DomainCard = (props: { entity: DomainEntity }) => {\n const { entity } = props;\n\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);\n const url = catalogEntityRoute(entityRouteParams(entity));\n\n const owner = (\n <EntityRefLinks\n entityRefs={ownedByRelations}\n defaultKind=\"group\"\n color=\"inherit\"\n />\n );\n\n return (\n <Card>\n <CardMedia>\n <ItemCardHeader\n title={entity.metadata.title ?? entity.metadata.name}\n subtitle={owner}\n />\n </CardMedia>\n <CardContent>\n {entity.metadata.tags?.length ? (\n <Box>\n {entity.metadata.tags.map(tag => (\n <Chip size=\"small\" label={tag} key={tag} />\n ))}\n </Box>\n ) : null}\n {entity.metadata.description}\n </CardContent>\n <CardActions>\n <LinkButton to={url} color=\"primary\">\n Explore\n </LinkButton>\n </CardActions>\n </Card>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAkCa,MAAA,UAAA,GAAa,CAAC,KAAoC,KAAA;AAC7D,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AAEnB,EAAM,MAAA,kBAAA,GAAqB,YAAY,cAAc,CAAA;AACrD,EAAM,MAAA,gBAAA,GAAmB,kBAAmB,CAAA,MAAA,EAAQ,iBAAiB,CAAA;AACrE,EAAA,MAAM,GAAM,GAAA,kBAAA,CAAmB,iBAAkB,CAAA,MAAM,CAAC,CAAA;AAExD,EAAA,MAAM,KACJ,mBAAA,GAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,gBAAA;AAAA,MACZ,WAAY,EAAA,OAAA;AAAA,MACZ,KAAM,EAAA;AAAA;AAAA,GACR;AAGF,EAAA,4BACG,IACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,SACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,cAAA;AAAA,MAAA;AAAA,QACC,KAAO,EAAA,MAAA,CAAO,QAAS,CAAA,KAAA,IAAS,OAAO,QAAS,CAAA,IAAA;AAAA,QAChD,QAAU,EAAA;AAAA;AAAA,KAEd,EAAA,CAAA;AAAA,yBACC,WACE,EAAA,EAAA,QAAA,EAAA;AAAA,MAAA,MAAA,CAAO,SAAS,IAAM,EAAA,MAAA,uBACpB,GACE,EAAA,EAAA,QAAA,EAAA,MAAA,CAAO,SAAS,IAAK,CAAA,GAAA,CAAI,yBACvB,GAAA,CAAA,IAAA,EAAA,EAAK,MAAK,OAAQ,EAAA,KAAA,EAAO,OAAU,GAAK,CAC1C,GACH,CACE,GAAA,IAAA;AAAA,MACH,OAAO,QAAS,CAAA;AAAA,KACnB,EAAA,CAAA;AAAA,oBACA,GAAA,CAAC,eACC,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,IAAI,GAAK,EAAA,KAAA,EAAM,SAAU,EAAA,QAAA,EAAA,SAAA,EAErC,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { catalogApiRef } from '@backstage/plugin-catalog-react';
|
|
2
3
|
import Button from '@material-ui/core/Button';
|
|
3
|
-
import React from 'react';
|
|
4
4
|
import useAsync from 'react-use/esm/useAsync';
|
|
5
5
|
import { Content, ContentHeader, SupportButton, Progress, WarningPanel, EmptyState, ItemCardGrid } from '@backstage/core-components';
|
|
6
6
|
import { useApi } from '@backstage/core-plugin-api';
|
|
@@ -19,34 +19,37 @@ const Body = () => {
|
|
|
19
19
|
return response.items;
|
|
20
20
|
}, [catalogApi]);
|
|
21
21
|
if (loading) {
|
|
22
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ jsx(Progress, {});
|
|
23
23
|
}
|
|
24
24
|
if (error) {
|
|
25
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ jsx(WarningPanel, { severity: "error", title: "Could not load domains.", children: error.message });
|
|
26
26
|
}
|
|
27
27
|
if (!entities?.length) {
|
|
28
|
-
return /* @__PURE__ */
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
29
|
EmptyState,
|
|
30
30
|
{
|
|
31
31
|
missing: "info",
|
|
32
32
|
title: "No domains to display",
|
|
33
33
|
description: "You haven't added any domains yet.",
|
|
34
|
-
action: /* @__PURE__ */
|
|
34
|
+
action: /* @__PURE__ */ jsx(
|
|
35
35
|
Button,
|
|
36
36
|
{
|
|
37
37
|
variant: "contained",
|
|
38
38
|
color: "primary",
|
|
39
|
-
href: "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-domain"
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
href: "https://backstage.io/docs/features/software-catalog/descriptor-format#kind-domain",
|
|
40
|
+
children: "Read more"
|
|
41
|
+
}
|
|
42
42
|
)
|
|
43
43
|
}
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ jsx(ItemCardGrid, { children: entities.map((entity, index) => /* @__PURE__ */ jsx(EntityCard, { entity }, index)) });
|
|
47
47
|
};
|
|
48
48
|
const DomainExplorerContent = (props) => {
|
|
49
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ jsxs(Content, { noPadding: true, children: [
|
|
50
|
+
/* @__PURE__ */ jsx(ContentHeader, { title: props.title ?? "Domains", children: /* @__PURE__ */ jsx(SupportButton, { children: "Discover the domains in your ecosystem." }) }),
|
|
51
|
+
/* @__PURE__ */ jsx(Body, {})
|
|
52
|
+
] });
|
|
50
53
|
};
|
|
51
54
|
|
|
52
55
|
export { DomainExplorerContent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DomainExplorerContent.esm.js","sources":["../../../src/components/DomainExplorerContent/DomainExplorerContent.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DomainEntity } from '@backstage/catalog-model';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport Button from '@material-ui/core/Button';\nimport
|
|
1
|
+
{"version":3,"file":"DomainExplorerContent.esm.js","sources":["../../../src/components/DomainExplorerContent/DomainExplorerContent.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DomainEntity } from '@backstage/catalog-model';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport Button from '@material-ui/core/Button';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n Content,\n ContentHeader,\n EmptyState,\n ItemCardGrid,\n Progress,\n SupportButton,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { EntityCard } from '../EntityCard';\n\nconst Body = () => {\n const catalogApi = useApi(catalogApiRef);\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: { kind: 'domain' },\n });\n return response.items as DomainEntity[];\n }, [catalogApi]);\n\n if (loading) {\n return <Progress />;\n }\n\n if (error) {\n return (\n <WarningPanel severity=\"error\" title=\"Could not load domains.\">\n {error.message}\n </WarningPanel>\n );\n }\n\n if (!entities?.length) {\n return (\n <EmptyState\n missing=\"info\"\n title=\"No domains to display\"\n description=\"You haven't added any domains yet.\"\n action={\n <Button\n variant=\"contained\"\n color=\"primary\"\n href=\"https://backstage.io/docs/features/software-catalog/descriptor-format#kind-domain\"\n >\n Read more\n </Button>\n }\n />\n );\n }\n\n return (\n <ItemCardGrid>\n {entities.map((entity, index) => (\n <EntityCard key={index} entity={entity} />\n ))}\n </ItemCardGrid>\n );\n};\n\n/** @public */\nexport const DomainExplorerContent = (props: { title?: string }) => {\n return (\n <Content noPadding>\n <ContentHeader title={props.title ?? 'Domains'}>\n <SupportButton>Discover the domains in your ecosystem.</SupportButton>\n </ContentHeader>\n <Body />\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAgCA,MAAM,OAAO,MAAM;AACjB,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA;AACvC,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,QAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACF,GAAI,SAAS,YAAY;AACvB,IAAM,MAAA,QAAA,GAAW,MAAM,UAAA,CAAW,WAAY,CAAA;AAAA,MAC5C,MAAA,EAAQ,EAAE,IAAA,EAAM,QAAS;AAAA,KAC1B,CAAA;AACD,IAAA,OAAO,QAAS,CAAA,KAAA;AAAA,GAClB,EAAG,CAAC,UAAU,CAAC,CAAA;AAEf,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA;AAGnB,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,2BACG,YAAa,EAAA,EAAA,QAAA,EAAS,SAAQ,KAAM,EAAA,yBAAA,EAClC,gBAAM,OACT,EAAA,CAAA;AAAA;AAIJ,EAAI,IAAA,CAAC,UAAU,MAAQ,EAAA;AACrB,IACE,uBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,MAAA;AAAA,QACR,KAAM,EAAA,uBAAA;AAAA,QACN,WAAY,EAAA,oCAAA;AAAA,QACZ,MACE,kBAAA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,OAAQ,EAAA,WAAA;AAAA,YACR,KAAM,EAAA,SAAA;AAAA,YACN,IAAK,EAAA,mFAAA;AAAA,YACN,QAAA,EAAA;AAAA;AAAA;AAED;AAAA,KAEJ;AAAA;AAIJ,EAAA,uBACG,GAAA,CAAA,YAAA,EAAA,EACE,QAAS,EAAA,QAAA,CAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,KACrB,qBAAA,GAAA,CAAC,UAAuB,EAAA,EAAA,MAAA,EAAA,EAAP,KAAuB,CACzC,CACH,EAAA,CAAA;AAEJ,CAAA;AAGa,MAAA,qBAAA,GAAwB,CAAC,KAA8B,KAAA;AAClE,EACE,uBAAA,IAAA,CAAC,OAAQ,EAAA,EAAA,SAAA,EAAS,IAChB,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,aAAA,EAAA,EAAc,OAAO,KAAM,CAAA,KAAA,IAAS,WACnC,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAc,qDAAuC,CACxD,EAAA,CAAA;AAAA,wBACC,IAAK,EAAA,EAAA;AAAA,GACR,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { RELATION_OWNED_BY } from '@backstage/catalog-model';
|
|
2
3
|
import { entityRouteRef, getEntityRelations, entityRouteParams, EntityRefLinks } from '@backstage/plugin-catalog-react';
|
|
3
4
|
import Box from '@material-ui/core/Box';
|
|
@@ -6,7 +7,6 @@ import CardActions from '@material-ui/core/CardActions';
|
|
|
6
7
|
import CardContent from '@material-ui/core/CardContent';
|
|
7
8
|
import CardMedia from '@material-ui/core/CardMedia';
|
|
8
9
|
import Chip from '@material-ui/core/Chip';
|
|
9
|
-
import React from 'react';
|
|
10
10
|
import { ItemCardHeader, LinkButton } from '@backstage/core-components';
|
|
11
11
|
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
12
12
|
|
|
@@ -15,7 +15,7 @@ const EntityCard = (props) => {
|
|
|
15
15
|
const catalogEntityRoute = useRouteRef(entityRouteRef);
|
|
16
16
|
const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);
|
|
17
17
|
const url = catalogEntityRoute(entityRouteParams(entity));
|
|
18
|
-
const owner = /* @__PURE__ */
|
|
18
|
+
const owner = /* @__PURE__ */ jsx(
|
|
19
19
|
EntityRefLinks,
|
|
20
20
|
{
|
|
21
21
|
entityRefs: ownedByRelations,
|
|
@@ -23,13 +23,20 @@ const EntityCard = (props) => {
|
|
|
23
23
|
color: "inherit"
|
|
24
24
|
}
|
|
25
25
|
);
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
27
|
+
/* @__PURE__ */ jsx(CardMedia, { children: /* @__PURE__ */ jsx(
|
|
28
|
+
ItemCardHeader,
|
|
29
|
+
{
|
|
30
|
+
title: entity.metadata.title ?? entity.metadata.name,
|
|
31
|
+
subtitle: owner
|
|
32
|
+
}
|
|
33
|
+
) }),
|
|
34
|
+
/* @__PURE__ */ jsxs(CardContent, { children: [
|
|
35
|
+
entity.metadata.tags?.length ? /* @__PURE__ */ jsx(Box, { children: entity.metadata.tags.map((tag) => /* @__PURE__ */ jsx(Chip, { size: "small", label: tag }, tag)) }) : null,
|
|
36
|
+
entity.metadata.description
|
|
37
|
+
] }),
|
|
38
|
+
/* @__PURE__ */ jsx(CardActions, { children: /* @__PURE__ */ jsx(LinkButton, { to: url, color: "primary", children: "Explore" }) })
|
|
39
|
+
] });
|
|
33
40
|
};
|
|
34
41
|
|
|
35
42
|
export { EntityCard };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityCard.esm.js","sources":["../../../src/components/EntityCard/EntityCard.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity, RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n entityRouteParams,\n getEntityRelations,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport Box from '@material-ui/core/Box';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardMedia from '@material-ui/core/CardMedia';\nimport Chip from '@material-ui/core/Chip';\
|
|
1
|
+
{"version":3,"file":"EntityCard.esm.js","sources":["../../../src/components/EntityCard/EntityCard.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity, RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n entityRouteParams,\n getEntityRelations,\n entityRouteRef,\n} from '@backstage/plugin-catalog-react';\nimport Box from '@material-ui/core/Box';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardMedia from '@material-ui/core/CardMedia';\nimport Chip from '@material-ui/core/Chip';\n\nimport { LinkButton, ItemCardHeader } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\n/** @public */\nexport const EntityCard = (props: { entity: Entity }) => {\n const { entity } = props;\n\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);\n const url = catalogEntityRoute(entityRouteParams(entity));\n\n const owner = (\n <EntityRefLinks\n entityRefs={ownedByRelations}\n defaultKind=\"group\"\n color=\"inherit\"\n />\n );\n\n return (\n <Card>\n <CardMedia>\n <ItemCardHeader\n title={entity.metadata.title ?? entity.metadata.name}\n subtitle={owner}\n />\n </CardMedia>\n <CardContent>\n {entity.metadata.tags?.length ? (\n <Box>\n {entity.metadata.tags.map(tag => (\n <Chip size=\"small\" label={tag} key={tag} />\n ))}\n </Box>\n ) : null}\n {entity.metadata.description}\n </CardContent>\n <CardActions>\n <LinkButton to={url} color=\"primary\">\n Explore\n </LinkButton>\n </CardActions>\n </Card>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAkCa,MAAA,UAAA,GAAa,CAAC,KAA8B,KAAA;AACvD,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AAEnB,EAAM,MAAA,kBAAA,GAAqB,YAAY,cAAc,CAAA;AACrD,EAAM,MAAA,gBAAA,GAAmB,kBAAmB,CAAA,MAAA,EAAQ,iBAAiB,CAAA;AACrE,EAAA,MAAM,GAAM,GAAA,kBAAA,CAAmB,iBAAkB,CAAA,MAAM,CAAC,CAAA;AAExD,EAAA,MAAM,KACJ,mBAAA,GAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,gBAAA;AAAA,MACZ,WAAY,EAAA,OAAA;AAAA,MACZ,KAAM,EAAA;AAAA;AAAA,GACR;AAGF,EAAA,4BACG,IACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,SACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,cAAA;AAAA,MAAA;AAAA,QACC,KAAO,EAAA,MAAA,CAAO,QAAS,CAAA,KAAA,IAAS,OAAO,QAAS,CAAA,IAAA;AAAA,QAChD,QAAU,EAAA;AAAA;AAAA,KAEd,EAAA,CAAA;AAAA,yBACC,WACE,EAAA,EAAA,QAAA,EAAA;AAAA,MAAA,MAAA,CAAO,SAAS,IAAM,EAAA,MAAA,uBACpB,GACE,EAAA,EAAA,QAAA,EAAA,MAAA,CAAO,SAAS,IAAK,CAAA,GAAA,CAAI,yBACvB,GAAA,CAAA,IAAA,EAAA,EAAK,MAAK,OAAQ,EAAA,KAAA,EAAO,OAAU,GAAK,CAC1C,GACH,CACE,GAAA,IAAA;AAAA,MACH,OAAO,QAAS,CAAA;AAAA,KACnB,EAAA,CAAA;AAAA,oBACA,GAAA,CAAC,eACC,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,IAAI,GAAK,EAAA,KAAA,EAAM,SAAU,EAAA,QAAA,EAAA,SAAA,EAErC,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { Page, Header, RoutedTabs } from '@backstage/core-components';
|
|
2
3
|
import { attachComponentData, useElementFilter } from '@backstage/core-plugin-api';
|
|
3
|
-
import React from 'react';
|
|
4
4
|
|
|
5
5
|
const dataKey = "plugin.explore.exploreLayoutRoute";
|
|
6
6
|
const Route = () => null;
|
|
@@ -15,13 +15,16 @@ const ExploreLayout = (props) => {
|
|
|
15
15
|
withStrictError: "Child of ExploreLayout must be an ExploreLayout.Route"
|
|
16
16
|
}).getElements().map((child) => child.props)
|
|
17
17
|
);
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
return /* @__PURE__ */ jsxs(Page, { themeId: "home", children: [
|
|
19
|
+
/* @__PURE__ */ jsx(
|
|
20
|
+
Header,
|
|
21
|
+
{
|
|
22
|
+
title: title ?? "Explore our ecosystem",
|
|
23
|
+
subtitle: subtitle ?? "Discover solutions available in our ecosystem"
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
/* @__PURE__ */ jsx(RoutedTabs, { routes })
|
|
27
|
+
] });
|
|
25
28
|
};
|
|
26
29
|
ExploreLayout.Route = Route;
|
|
27
30
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExploreLayout.esm.js","sources":["../../../src/components/ExploreLayout/ExploreLayout.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 { Header, Page, RoutedTabs } from '@backstage/core-components';\nimport {\n attachComponentData,\n useElementFilter,\n} from '@backstage/core-plugin-api';\nimport { TabProps } from '@material-ui/core/Tab';\nimport { default as React } from 'react';\n\n// TODO: This layout could be a shared based component if it was possible to create custom TabbedLayouts\n// A generalized version of createSubRoutesFromChildren, etc. would be required\n/** @public */\nexport type SubRoute = {\n path: string;\n title: string;\n children: JSX.Element;\n tabProps?: TabProps<React.ElementType, { component?: React.ElementType }>;\n};\n\nconst dataKey = 'plugin.explore.exploreLayoutRoute';\n\nconst Route: (props: SubRoute) => null = () => null;\nattachComponentData(Route, dataKey, true);\n\n// This causes all mount points that are discovered within this route to use the path of the route itself\nattachComponentData(Route, 'core.gatherMountPoints', true);\n\n/** @public */\nexport type ExploreLayoutProps = {\n title?: string;\n subtitle?: string;\n children?: React.ReactNode;\n};\n\n/**\n * Explore is a compound component, which allows you to define a custom layout\n *\n * @example\n * ```jsx\n * <ExploreLayout title=\"Explore ACME's ecosystem\">\n * <ExploreLayout.Route path=\"/example\" title=\"Example tab\">\n * <div>This is rendered under /example/anything-here route</div>\n * </ExploreLayout.Route>\n * </ExploreLayout>\n * ```\n *\n * @public\n */\nexport const ExploreLayout = (props: ExploreLayoutProps) => {\n const { title, subtitle, children } = props;\n\n const routes = useElementFilter(children, elements =>\n elements\n .selectByComponentData({\n key: dataKey,\n withStrictError:\n 'Child of ExploreLayout must be an ExploreLayout.Route',\n })\n .getElements<SubRoute>()\n .map(child => child.props),\n );\n\n return (\n <Page themeId=\"home\">\n <Header\n title={title ?? 'Explore our ecosystem'}\n subtitle={subtitle ?? 'Discover solutions available in our ecosystem'}\n />\n <RoutedTabs routes={routes} />\n </Page>\n );\n};\n\nExploreLayout.Route = Route;\n"],"names":[],"mappings":";;;;AAkCA,MAAM,OAAU,GAAA,mCAAA;AAEhB,MAAM,QAAmC,MAAM,IAAA;AAC/C,mBAAoB,CAAA,KAAA,EAAO,SAAS,IAAI,CAAA;AAGxC,mBAAoB,CAAA,KAAA,EAAO,0BAA0B,IAAI,CAAA;AAuB5C,MAAA,aAAA,GAAgB,CAAC,KAA8B,KAAA;AAC1D,EAAA,MAAM,EAAE,KAAA,EAAO,QAAU,EAAA,QAAA,EAAa,GAAA,KAAA;AAEtC,EAAA,MAAM,MAAS,GAAA,gBAAA;AAAA,IAAiB,QAAA;AAAA,IAAU,CAAA,QAAA,KACxC,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA,OAAA;AAAA,MACL,eACE,EAAA;AAAA,KACH,CACA,CAAA,WAAA,GACA,GAAI,CAAA,CAAA,KAAA,KAAS,MAAM,KAAK;AAAA,GAC7B;AAEA,EACE,uBAAA,
|
|
1
|
+
{"version":3,"file":"ExploreLayout.esm.js","sources":["../../../src/components/ExploreLayout/ExploreLayout.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 { Header, Page, RoutedTabs } from '@backstage/core-components';\nimport {\n attachComponentData,\n useElementFilter,\n} from '@backstage/core-plugin-api';\nimport { TabProps } from '@material-ui/core/Tab';\nimport { default as React } from 'react';\n\n// TODO: This layout could be a shared based component if it was possible to create custom TabbedLayouts\n// A generalized version of createSubRoutesFromChildren, etc. would be required\n/** @public */\nexport type SubRoute = {\n path: string;\n title: string;\n children: JSX.Element;\n tabProps?: TabProps<React.ElementType, { component?: React.ElementType }>;\n};\n\nconst dataKey = 'plugin.explore.exploreLayoutRoute';\n\nconst Route: (props: SubRoute) => null = () => null;\nattachComponentData(Route, dataKey, true);\n\n// This causes all mount points that are discovered within this route to use the path of the route itself\nattachComponentData(Route, 'core.gatherMountPoints', true);\n\n/** @public */\nexport type ExploreLayoutProps = {\n title?: string;\n subtitle?: string;\n children?: React.ReactNode;\n};\n\n/**\n * Explore is a compound component, which allows you to define a custom layout\n *\n * @example\n * ```jsx\n * <ExploreLayout title=\"Explore ACME's ecosystem\">\n * <ExploreLayout.Route path=\"/example\" title=\"Example tab\">\n * <div>This is rendered under /example/anything-here route</div>\n * </ExploreLayout.Route>\n * </ExploreLayout>\n * ```\n *\n * @public\n */\nexport const ExploreLayout = (props: ExploreLayoutProps) => {\n const { title, subtitle, children } = props;\n\n const routes = useElementFilter(children, elements =>\n elements\n .selectByComponentData({\n key: dataKey,\n withStrictError:\n 'Child of ExploreLayout must be an ExploreLayout.Route',\n })\n .getElements<SubRoute>()\n .map(child => child.props),\n );\n\n return (\n <Page themeId=\"home\">\n <Header\n title={title ?? 'Explore our ecosystem'}\n subtitle={subtitle ?? 'Discover solutions available in our ecosystem'}\n />\n <RoutedTabs routes={routes} />\n </Page>\n );\n};\n\nExploreLayout.Route = Route;\n"],"names":[],"mappings":";;;;AAkCA,MAAM,OAAU,GAAA,mCAAA;AAEhB,MAAM,QAAmC,MAAM,IAAA;AAC/C,mBAAoB,CAAA,KAAA,EAAO,SAAS,IAAI,CAAA;AAGxC,mBAAoB,CAAA,KAAA,EAAO,0BAA0B,IAAI,CAAA;AAuB5C,MAAA,aAAA,GAAgB,CAAC,KAA8B,KAAA;AAC1D,EAAA,MAAM,EAAE,KAAA,EAAO,QAAU,EAAA,QAAA,EAAa,GAAA,KAAA;AAEtC,EAAA,MAAM,MAAS,GAAA,gBAAA;AAAA,IAAiB,QAAA;AAAA,IAAU,CAAA,QAAA,KACxC,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA,OAAA;AAAA,MACL,eACE,EAAA;AAAA,KACH,CACA,CAAA,WAAA,GACA,GAAI,CAAA,CAAA,KAAA,KAAS,MAAM,KAAK;AAAA,GAC7B;AAEA,EACE,uBAAA,IAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAO,KAAS,IAAA,uBAAA;AAAA,QAChB,UAAU,QAAY,IAAA;AAAA;AAAA,KACxB;AAAA,oBACA,GAAA,CAAC,cAAW,MAAgB,EAAA;AAAA,GAC9B,EAAA,CAAA;AAEJ;AAEA,aAAA,CAAc,KAAQ,GAAA,KAAA;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useOutlet } from 'react-router-dom';
|
|
3
3
|
import { DefaultExplorePage } from '../DefaultExplorePage/DefaultExplorePage.esm.js';
|
|
4
4
|
|
|
5
5
|
const ExplorePage = () => {
|
|
6
6
|
const outlet = useOutlet();
|
|
7
|
-
return /* @__PURE__ */
|
|
7
|
+
return /* @__PURE__ */ jsx(Fragment, { children: outlet || /* @__PURE__ */ jsx(DefaultExplorePage, {}) });
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export { ExplorePage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExplorePage.esm.js","sources":["../../../src/components/ExplorePage/ExplorePage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"ExplorePage.esm.js","sources":["../../../src/components/ExplorePage/ExplorePage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useOutlet } from 'react-router-dom';\nimport { DefaultExplorePage } from '../DefaultExplorePage';\n\nexport const ExplorePage = () => {\n const outlet = useOutlet();\n\n return <>{outlet || <DefaultExplorePage />}</>;\n};\n"],"names":[],"mappings":";;;;AAmBO,MAAM,cAAc,MAAM;AAC/B,EAAA,MAAM,SAAS,SAAU,EAAA;AAEzB,EAAA,uBAAU,GAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA,MAAA,oBAAW,GAAA,CAAA,kBAAA,EAAA,EAAmB,CAAG,EAAA,CAAA;AAC7C;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { stringifyEntityRef, RELATION_CHILD_OF, parseEntityRef } from '@backstage/catalog-model';
|
|
2
3
|
import { Progress, ResponseErrorPanel, DependencyGraph, DependencyGraphTypes, Link } from '@backstage/core-components';
|
|
3
4
|
import { useApi, configApiRef, useRouteRef } from '@backstage/core-plugin-api';
|
|
@@ -6,7 +7,6 @@ import Typography from '@material-ui/core/Typography';
|
|
|
6
7
|
import { makeStyles, useTheme } from '@material-ui/core/styles';
|
|
7
8
|
import ZoomOutMap from '@material-ui/icons/ZoomOutMap';
|
|
8
9
|
import classNames from 'classnames';
|
|
9
|
-
import React from 'react';
|
|
10
10
|
import useAsync from 'react-use/esm/useAsync';
|
|
11
11
|
|
|
12
12
|
const useStyles = makeStyles(
|
|
@@ -72,45 +72,53 @@ function RenderNode(props) {
|
|
|
72
72
|
const classes = useStyles();
|
|
73
73
|
const catalogEntityRoute = useRouteRef(entityRouteRef);
|
|
74
74
|
if (props.node.id === "root") {
|
|
75
|
-
return /* @__PURE__ */
|
|
75
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
"rect",
|
|
78
|
+
{
|
|
79
|
+
width: nodeWidth,
|
|
80
|
+
height: nodeHeight,
|
|
81
|
+
rx: theme.shape.borderRadius,
|
|
82
|
+
className: classes.organizationNode
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ jsx("title", { children: props.node.name }),
|
|
86
|
+
/* @__PURE__ */ jsx("foreignObject", { width: nodeWidth, height: nodeHeight, children: /* @__PURE__ */ jsx("div", { className: classes.centeredContent, children: /* @__PURE__ */ jsx(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
className: classNames(
|
|
90
|
+
classes.textWrapper,
|
|
91
|
+
classes.textOrganization
|
|
92
|
+
),
|
|
93
|
+
children: props.node.name
|
|
94
|
+
}
|
|
95
|
+
) }) })
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
const ref = parseEntityRef(props.node.id);
|
|
99
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
100
|
+
/* @__PURE__ */ jsx(
|
|
76
101
|
"rect",
|
|
77
102
|
{
|
|
78
103
|
width: nodeWidth,
|
|
79
104
|
height: nodeHeight,
|
|
80
105
|
rx: theme.shape.borderRadius,
|
|
81
|
-
className: classes.
|
|
106
|
+
className: classes.groupNode
|
|
82
107
|
}
|
|
83
|
-
),
|
|
84
|
-
|
|
108
|
+
),
|
|
109
|
+
/* @__PURE__ */ jsx("title", { children: /* @__PURE__ */ jsx(EntityDisplayName, { entityRef: props.node.id, hideIcon: true, disableTooltip: true }) }),
|
|
110
|
+
/* @__PURE__ */ jsx(
|
|
111
|
+
Link,
|
|
85
112
|
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement(
|
|
96
|
-
"rect",
|
|
97
|
-
{
|
|
98
|
-
width: nodeWidth,
|
|
99
|
-
height: nodeHeight,
|
|
100
|
-
rx: theme.shape.borderRadius,
|
|
101
|
-
className: classes.groupNode
|
|
102
|
-
}
|
|
103
|
-
), /* @__PURE__ */ React.createElement("title", null, /* @__PURE__ */ React.createElement(EntityDisplayName, { entityRef: props.node.id, hideIcon: true, disableTooltip: true })), /* @__PURE__ */ React.createElement(
|
|
104
|
-
Link,
|
|
105
|
-
{
|
|
106
|
-
to: catalogEntityRoute({
|
|
107
|
-
kind: ref.kind,
|
|
108
|
-
namespace: ref.namespace,
|
|
109
|
-
name: ref.name
|
|
110
|
-
})
|
|
111
|
-
},
|
|
112
|
-
/* @__PURE__ */ React.createElement("foreignObject", { width: nodeWidth, height: nodeHeight }, /* @__PURE__ */ React.createElement("div", { className: classes.centeredContent }, /* @__PURE__ */ React.createElement("div", { className: classNames(classes.textWrapper, classes.textGroup) }, /* @__PURE__ */ React.createElement(EntityDisplayName, { entityRef: props.node.id, hideIcon: true }))))
|
|
113
|
-
));
|
|
113
|
+
to: catalogEntityRoute({
|
|
114
|
+
kind: ref.kind,
|
|
115
|
+
namespace: ref.namespace,
|
|
116
|
+
name: ref.name
|
|
117
|
+
}),
|
|
118
|
+
children: /* @__PURE__ */ jsx("foreignObject", { width: nodeWidth, height: nodeHeight, children: /* @__PURE__ */ jsx("div", { className: classes.centeredContent, children: /* @__PURE__ */ jsx("div", { className: classNames(classes.textWrapper, classes.textGroup), children: /* @__PURE__ */ jsx(EntityDisplayName, { entityRef: props.node.id, hideIcon: true }) }) }) })
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] });
|
|
114
122
|
}
|
|
115
123
|
function GroupsDiagram(props) {
|
|
116
124
|
const nodes = new Array();
|
|
@@ -131,9 +139,9 @@ function GroupsDiagram(props) {
|
|
|
131
139
|
return catalogApi.getEntities({ filter });
|
|
132
140
|
}, [catalogApi, props.namespace]);
|
|
133
141
|
if (loading) {
|
|
134
|
-
return /* @__PURE__ */
|
|
142
|
+
return /* @__PURE__ */ jsx(Progress, {});
|
|
135
143
|
} else if (error) {
|
|
136
|
-
return /* @__PURE__ */
|
|
144
|
+
return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
|
|
137
145
|
}
|
|
138
146
|
nodes.push({
|
|
139
147
|
id: "root",
|
|
@@ -167,28 +175,33 @@ function GroupsDiagram(props) {
|
|
|
167
175
|
});
|
|
168
176
|
});
|
|
169
177
|
}
|
|
170
|
-
return /* @__PURE__ */
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
178
|
+
return /* @__PURE__ */ jsxs("div", { className: classes.graphWrapper, children: [
|
|
179
|
+
/* @__PURE__ */ jsx(
|
|
180
|
+
DependencyGraph,
|
|
181
|
+
{
|
|
182
|
+
nodes,
|
|
183
|
+
edges,
|
|
184
|
+
nodeMargin: 10,
|
|
185
|
+
direction: props.direction || DependencyGraphTypes.Direction.RIGHT_LEFT,
|
|
186
|
+
renderNode: RenderNode,
|
|
187
|
+
className: classes.graph,
|
|
188
|
+
fit: "contain"
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ jsxs(
|
|
192
|
+
Typography,
|
|
193
|
+
{
|
|
194
|
+
variant: "caption",
|
|
195
|
+
color: "textSecondary",
|
|
196
|
+
display: "block",
|
|
197
|
+
className: classes.legend,
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ jsx(ZoomOutMap, { className: "icon" }),
|
|
200
|
+
" Use pinch & zoom to move around the diagram."
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
] });
|
|
192
205
|
}
|
|
193
206
|
|
|
194
207
|
export { GroupsDiagram };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupsDiagram.esm.js","sources":["../../../src/components/GroupsExplorerContent/GroupsDiagram.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n parseEntityRef,\n RELATION_CHILD_OF,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n DependencyGraph,\n DependencyGraphTypes,\n Link,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n entityRouteRef,\n getEntityRelations,\n EntityDisplayName,\n} from '@backstage/plugin-catalog-react';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles, useTheme } from '@material-ui/core/styles';\nimport ZoomOutMap from '@material-ui/icons/ZoomOutMap';\nimport classNames from 'classnames';\nimport React from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { EntityFilterQuery } from '@backstage/catalog-client';\n\nconst useStyles = makeStyles(\n theme => ({\n graph: {\n minHeight: '100%',\n flex: 1,\n },\n graphWrapper: {\n display: 'flex',\n height: '100%',\n },\n organizationNode: {\n fill: theme.palette.secondary.light,\n stroke: theme.palette.secondary.light,\n },\n groupNode: {\n fill: theme.palette.primary.light,\n stroke: theme.palette.primary.light,\n },\n centeredContent: {\n padding: theme.spacing(1),\n height: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n color: theme.palette.common.black,\n },\n legend: {\n position: 'absolute',\n bottom: 0,\n right: 0,\n padding: theme.spacing(1),\n '& .icon': {\n verticalAlign: 'bottom',\n },\n },\n textOrganization: {\n color: theme.palette.secondary.contrastText,\n },\n textGroup: {\n color: theme.palette.primary.contrastText,\n },\n textWrapper: {\n display: '-webkit-box',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: 2,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n textAlign: 'center',\n fontWeight: 'bold',\n fontSize: '20px',\n },\n }),\n {\n name: 'ExploreGroupsDiagram',\n },\n);\n\nfunction RenderNode(props: DependencyGraphTypes.RenderNodeProps<any>) {\n const nodeWidth = 180;\n const nodeHeight = 60;\n const theme = useTheme();\n const classes = useStyles();\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n\n if (props.node.id === 'root') {\n return (\n <g>\n <rect\n width={nodeWidth}\n height={nodeHeight}\n rx={theme.shape.borderRadius}\n className={classes.organizationNode}\n />\n <title>{props.node.name}</title>\n <foreignObject width={nodeWidth} height={nodeHeight}>\n <div className={classes.centeredContent}>\n <div\n className={classNames(\n classes.textWrapper,\n classes.textOrganization,\n )}\n >\n {props.node.name}\n </div>\n </div>\n </foreignObject>\n </g>\n );\n }\n\n const ref = parseEntityRef(props.node.id);\n\n return (\n <g>\n <rect\n width={nodeWidth}\n height={nodeHeight}\n rx={theme.shape.borderRadius}\n className={classes.groupNode}\n />\n <title>\n <EntityDisplayName entityRef={props.node.id} hideIcon disableTooltip />\n </title>\n\n <Link\n to={catalogEntityRoute({\n kind: ref.kind,\n namespace: ref.namespace,\n name: ref.name,\n })}\n >\n <foreignObject width={nodeWidth} height={nodeHeight}>\n <div className={classes.centeredContent}>\n <div className={classNames(classes.textWrapper, classes.textGroup)}>\n <EntityDisplayName entityRef={props.node.id} hideIcon />\n </div>\n </div>\n </foreignObject>\n </Link>\n </g>\n );\n}\n\n/**\n * Dynamically generates a diagram of groups registered in the catalog.\n */\nexport function GroupsDiagram(props: {\n direction?: DependencyGraphTypes.Direction;\n hideChildren?: boolean;\n namespace?: string;\n}) {\n const nodes = new Array<{\n id: string;\n kind: string;\n name: string;\n }>();\n const edges = new Array<{ from: string; to: string; label: string }>();\n\n const classes = useStyles();\n const configApi = useApi(configApiRef);\n const catalogApi = useApi(catalogApiRef);\n const organizationName =\n configApi.getOptionalString('organization.name') ?? 'Backstage';\n const {\n loading,\n error,\n value: catalogResponse,\n } = useAsync(() => {\n const filter: EntityFilterQuery = { kind: ['Group'] };\n if (props.namespace) {\n filter['metadata.namespace'] = props.namespace;\n }\n return catalogApi.getEntities({ filter });\n }, [catalogApi, props.namespace]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n // the root of this diagram is the organization\n nodes.push({\n id: 'root',\n kind: 'Organization',\n name: organizationName,\n });\n\n for (const catalogItem of catalogResponse?.items || []) {\n const currentItemId = stringifyEntityRef(catalogItem);\n\n // Edge to parent\n const catalogItemRelations_childOf = getEntityRelations(\n catalogItem,\n RELATION_CHILD_OF,\n );\n\n if (props.hideChildren && catalogItemRelations_childOf.length) continue;\n\n nodes.push({\n id: stringifyEntityRef(catalogItem),\n kind: catalogItem.kind,\n name: '',\n });\n\n // if no parent is found, link the node to the root\n if (catalogItemRelations_childOf.length === 0) {\n edges.push({\n from: currentItemId,\n to: 'root',\n label: '',\n });\n }\n\n catalogItemRelations_childOf.forEach(relation => {\n edges.push({\n from: currentItemId,\n to: stringifyEntityRef(relation),\n label: '',\n });\n });\n }\n\n return (\n <div className={classes.graphWrapper}>\n <DependencyGraph\n nodes={nodes}\n edges={edges}\n nodeMargin={10}\n direction={props.direction || DependencyGraphTypes.Direction.RIGHT_LEFT}\n renderNode={RenderNode}\n className={classes.graph}\n fit=\"contain\"\n />\n\n <Typography\n variant=\"caption\"\n color=\"textSecondary\"\n display=\"block\"\n className={classes.legend}\n >\n <ZoomOutMap className=\"icon\" /> Use pinch & zoom to move around the\n diagram.\n </Typography>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AA2CA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,KAAO,EAAA;AAAA,MACL,SAAW,EAAA,MAAA;AAAA,MACX,IAAM,EAAA;AAAA,KACR;AAAA,IACA,YAAc,EAAA;AAAA,MACZ,OAAS,EAAA,MAAA;AAAA,MACT,MAAQ,EAAA;AAAA,KACV;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,IAAA,EAAM,KAAM,CAAA,OAAA,CAAQ,SAAU,CAAA,KAAA;AAAA,MAC9B,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,SAAU,CAAA;AAAA,KAClC;AAAA,IACA,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,KAAM,CAAA,OAAA,CAAQ,OAAQ,CAAA,KAAA;AAAA,MAC5B,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,OAAQ,CAAA;AAAA,KAChC;AAAA,IACA,eAAiB,EAAA;AAAA,MACf,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MACxB,MAAQ,EAAA,MAAA;AAAA,MACR,OAAS,EAAA,MAAA;AAAA,MACT,UAAY,EAAA,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,CAAA;AAAA,QAC/B,KAAO,EAAA;AAAA,OACR,CAAA;AAAA,KACF,CAAA;AAAA;AAGH,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,OAAA,CAAQ,YACtB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,KAAA;AAAA,MACA,UAAY,EAAA,EAAA;AAAA,MACZ,SAAW,EAAA,KAAA,CAAM,SAAa,IAAA,oBAAA,CAAqB,SAAU,CAAA,UAAA;AAAA,MAC7D,UAAY,EAAA,UAAA;AAAA,MACZ,WAAW,OAAQ,CAAA,KAAA;AAAA,MACnB,GAAI,EAAA;AAAA;AAAA,GAGN,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,SAAA;AAAA,MACR,KAAM,EAAA,eAAA;AAAA,MACN,OAAQ,EAAA,OAAA;AAAA,MACR,WAAW,OAAQ,CAAA;AAAA,KAAA;AAAA,oBAEnB,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,SAAA,EAAU,MAAO,EAAA,CAAA;AAAA,IAAE;AAAA,GAGnC,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"GroupsDiagram.esm.js","sources":["../../../src/components/GroupsExplorerContent/GroupsDiagram.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n parseEntityRef,\n RELATION_CHILD_OF,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n DependencyGraph,\n DependencyGraphTypes,\n Link,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n entityRouteRef,\n getEntityRelations,\n EntityDisplayName,\n} from '@backstage/plugin-catalog-react';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles, useTheme } from '@material-ui/core/styles';\nimport ZoomOutMap from '@material-ui/icons/ZoomOutMap';\nimport classNames from 'classnames';\nimport useAsync from 'react-use/esm/useAsync';\nimport { EntityFilterQuery } from '@backstage/catalog-client';\n\nconst useStyles = makeStyles(\n theme => ({\n graph: {\n minHeight: '100%',\n flex: 1,\n },\n graphWrapper: {\n display: 'flex',\n height: '100%',\n },\n organizationNode: {\n fill: theme.palette.secondary.light,\n stroke: theme.palette.secondary.light,\n },\n groupNode: {\n fill: theme.palette.primary.light,\n stroke: theme.palette.primary.light,\n },\n centeredContent: {\n padding: theme.spacing(1),\n height: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n color: theme.palette.common.black,\n },\n legend: {\n position: 'absolute',\n bottom: 0,\n right: 0,\n padding: theme.spacing(1),\n '& .icon': {\n verticalAlign: 'bottom',\n },\n },\n textOrganization: {\n color: theme.palette.secondary.contrastText,\n },\n textGroup: {\n color: theme.palette.primary.contrastText,\n },\n textWrapper: {\n display: '-webkit-box',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: 2,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n textAlign: 'center',\n fontWeight: 'bold',\n fontSize: '20px',\n },\n }),\n {\n name: 'ExploreGroupsDiagram',\n },\n);\n\nfunction RenderNode(props: DependencyGraphTypes.RenderNodeProps<any>) {\n const nodeWidth = 180;\n const nodeHeight = 60;\n const theme = useTheme();\n const classes = useStyles();\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n\n if (props.node.id === 'root') {\n return (\n <g>\n <rect\n width={nodeWidth}\n height={nodeHeight}\n rx={theme.shape.borderRadius}\n className={classes.organizationNode}\n />\n <title>{props.node.name}</title>\n <foreignObject width={nodeWidth} height={nodeHeight}>\n <div className={classes.centeredContent}>\n <div\n className={classNames(\n classes.textWrapper,\n classes.textOrganization,\n )}\n >\n {props.node.name}\n </div>\n </div>\n </foreignObject>\n </g>\n );\n }\n\n const ref = parseEntityRef(props.node.id);\n\n return (\n <g>\n <rect\n width={nodeWidth}\n height={nodeHeight}\n rx={theme.shape.borderRadius}\n className={classes.groupNode}\n />\n <title>\n <EntityDisplayName entityRef={props.node.id} hideIcon disableTooltip />\n </title>\n\n <Link\n to={catalogEntityRoute({\n kind: ref.kind,\n namespace: ref.namespace,\n name: ref.name,\n })}\n >\n <foreignObject width={nodeWidth} height={nodeHeight}>\n <div className={classes.centeredContent}>\n <div className={classNames(classes.textWrapper, classes.textGroup)}>\n <EntityDisplayName entityRef={props.node.id} hideIcon />\n </div>\n </div>\n </foreignObject>\n </Link>\n </g>\n );\n}\n\n/**\n * Dynamically generates a diagram of groups registered in the catalog.\n */\nexport function GroupsDiagram(props: {\n direction?: DependencyGraphTypes.Direction;\n hideChildren?: boolean;\n namespace?: string;\n}) {\n const nodes = new Array<{\n id: string;\n kind: string;\n name: string;\n }>();\n const edges = new Array<{ from: string; to: string; label: string }>();\n\n const classes = useStyles();\n const configApi = useApi(configApiRef);\n const catalogApi = useApi(catalogApiRef);\n const organizationName =\n configApi.getOptionalString('organization.name') ?? 'Backstage';\n const {\n loading,\n error,\n value: catalogResponse,\n } = useAsync(() => {\n const filter: EntityFilterQuery = { kind: ['Group'] };\n if (props.namespace) {\n filter['metadata.namespace'] = props.namespace;\n }\n return catalogApi.getEntities({ filter });\n }, [catalogApi, props.namespace]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n // the root of this diagram is the organization\n nodes.push({\n id: 'root',\n kind: 'Organization',\n name: organizationName,\n });\n\n for (const catalogItem of catalogResponse?.items || []) {\n const currentItemId = stringifyEntityRef(catalogItem);\n\n // Edge to parent\n const catalogItemRelations_childOf = getEntityRelations(\n catalogItem,\n RELATION_CHILD_OF,\n );\n\n if (props.hideChildren && catalogItemRelations_childOf.length) continue;\n\n nodes.push({\n id: stringifyEntityRef(catalogItem),\n kind: catalogItem.kind,\n name: '',\n });\n\n // if no parent is found, link the node to the root\n if (catalogItemRelations_childOf.length === 0) {\n edges.push({\n from: currentItemId,\n to: 'root',\n label: '',\n });\n }\n\n catalogItemRelations_childOf.forEach(relation => {\n edges.push({\n from: currentItemId,\n to: stringifyEntityRef(relation),\n label: '',\n });\n });\n }\n\n return (\n <div className={classes.graphWrapper}>\n <DependencyGraph\n nodes={nodes}\n edges={edges}\n nodeMargin={10}\n direction={props.direction || DependencyGraphTypes.Direction.RIGHT_LEFT}\n renderNode={RenderNode}\n className={classes.graph}\n fit=\"contain\"\n />\n\n <Typography\n variant=\"caption\"\n color=\"textSecondary\"\n display=\"block\"\n className={classes.legend}\n >\n <ZoomOutMap className=\"icon\" /> Use pinch & zoom to move around the\n diagram.\n </Typography>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AA0CA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,KAAO,EAAA;AAAA,MACL,SAAW,EAAA,MAAA;AAAA,MACX,IAAM,EAAA;AAAA,KACR;AAAA,IACA,YAAc,EAAA;AAAA,MACZ,OAAS,EAAA,MAAA;AAAA,MACT,MAAQ,EAAA;AAAA,KACV;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,IAAA,EAAM,KAAM,CAAA,OAAA,CAAQ,SAAU,CAAA,KAAA;AAAA,MAC9B,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,SAAU,CAAA;AAAA,KAClC;AAAA,IACA,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,KAAM,CAAA,OAAA,CAAQ,OAAQ,CAAA,KAAA;AAAA,MAC5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Header, SupportButton } from '@backstage/core-components';
|
|
4
4
|
import { makeStyles } from '@material-ui/core/styles';
|
|
@@ -15,14 +15,17 @@ const useStyles = makeStyles(
|
|
|
15
15
|
);
|
|
16
16
|
const GroupsExplorerContent = (props) => {
|
|
17
17
|
const classes = useStyles();
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
return /* @__PURE__ */ jsxs(Content, { noPadding: true, stretch: true, className: classes.root, children: [
|
|
19
|
+
/* @__PURE__ */ jsx(ContentHeader, { title: props.title ?? "Groups", children: /* @__PURE__ */ jsx(SupportButton, { children: "Explore your groups." }) }),
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
GroupsDiagram,
|
|
22
|
+
{
|
|
23
|
+
direction: props.direction,
|
|
24
|
+
hideChildren: props.hideChildren,
|
|
25
|
+
namespace: props.namespace
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
] });
|
|
26
29
|
};
|
|
27
30
|
|
|
28
31
|
export { GroupsExplorerContent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupsExplorerContent.esm.js","sources":["../../../src/components/GroupsExplorerContent/GroupsExplorerContent.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"GroupsExplorerContent.esm.js","sources":["../../../src/components/GroupsExplorerContent/GroupsExplorerContent.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { GroupsDiagram } from './GroupsDiagram';\nimport {\n Content,\n ContentHeader,\n DependencyGraphTypes,\n SupportButton,\n} from '@backstage/core-components';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(\n {\n root: {\n height: '100%',\n maxHeight: '100%',\n minHeight: 0,\n },\n },\n { name: 'ExploreGroupsContent' },\n);\n\nexport const GroupsExplorerContent = (props: {\n title?: string;\n direction?: DependencyGraphTypes.Direction;\n hideChildren?: boolean;\n namespace?: string;\n}) => {\n const classes = useStyles();\n\n return (\n <Content noPadding stretch className={classes.root}>\n <ContentHeader title={props.title ?? 'Groups'}>\n <SupportButton>Explore your groups.</SupportButton>\n </ContentHeader>\n <GroupsDiagram\n direction={props.direction}\n hideChildren={props.hideChildren}\n namespace={props.namespace}\n />\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;AAyBA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA,IACE,IAAM,EAAA;AAAA,MACJ,MAAQ,EAAA,MAAA;AAAA,MACR,SAAW,EAAA,MAAA;AAAA,MACX,SAAW,EAAA;AAAA;AACb,GACF;AAAA,EACA,EAAE,MAAM,sBAAuB;AACjC,CAAA;AAEa,MAAA,qBAAA,GAAwB,CAAC,KAKhC,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EACE,uBAAA,IAAA,CAAC,WAAQ,SAAS,EAAA,IAAA,EAAC,SAAO,IAAC,EAAA,SAAA,EAAW,QAAQ,IAC5C,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,aAAA,EAAA,EAAc,OAAO,KAAM,CAAA,KAAA,IAAS,UACnC,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAc,kCAAoB,CACrC,EAAA,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,WAAW,KAAM,CAAA,SAAA;AAAA,QACjB,cAAc,KAAM,CAAA,YAAA;AAAA,QACpB,WAAW,KAAM,CAAA;AAAA;AAAA;AACnB,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import Box from '@material-ui/core/Box';
|
|
2
3
|
import Card from '@material-ui/core/Card';
|
|
3
4
|
import CardActions from '@material-ui/core/CardActions';
|
|
@@ -8,7 +9,6 @@ import Typography from '@material-ui/core/Typography';
|
|
|
8
9
|
import { makeStyles } from '@material-ui/core/styles';
|
|
9
10
|
import { LinkButton } from '@backstage/core-components';
|
|
10
11
|
import classNames from 'classnames';
|
|
11
|
-
import React from 'react';
|
|
12
12
|
|
|
13
13
|
const useStyles = makeStyles(
|
|
14
14
|
(theme) => ({
|
|
@@ -39,26 +39,38 @@ const useStyles = makeStyles(
|
|
|
39
39
|
const ToolCard = ({ card, objectFit }) => {
|
|
40
40
|
const classes = useStyles();
|
|
41
41
|
const { title, description, url, image, lifecycle, tags } = card;
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
42
|
+
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
CardMedia,
|
|
45
|
+
{
|
|
46
|
+
image,
|
|
47
|
+
title,
|
|
48
|
+
className: classNames(classes.media, {
|
|
49
|
+
[classes.mediaContain]: objectFit === "contain"
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ jsxs(CardContent, { children: [
|
|
54
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "h5", children: [
|
|
55
|
+
title,
|
|
56
|
+
" ",
|
|
57
|
+
lifecycle && lifecycle.toLocaleLowerCase("en-US") !== "ga" && /* @__PURE__ */ jsx(
|
|
58
|
+
Chip,
|
|
59
|
+
{
|
|
60
|
+
size: "small",
|
|
61
|
+
label: lifecycle,
|
|
62
|
+
className: classNames(
|
|
63
|
+
classes.lifecycle,
|
|
64
|
+
classes[lifecycle.toLocaleLowerCase("en-US")]
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ jsx(Typography, { children: description || "Description missing" }),
|
|
70
|
+
tags && /* @__PURE__ */ jsx(Box, { marginTop: 2, children: tags.map((item, idx) => /* @__PURE__ */ jsx(Chip, { size: "small", label: item }, idx)) })
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ jsx(CardActions, { children: /* @__PURE__ */ jsx(LinkButton, { color: "primary", to: url, disabled: !url, children: "Explore" }) })
|
|
73
|
+
] }, title);
|
|
62
74
|
};
|
|
63
75
|
|
|
64
76
|
export { ToolCard };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolCard.esm.js","sources":["../../../src/components/ToolCard/ToolCard.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 { ExploreTool } from '@backstage-community/plugin-explore-react';\nimport Box from '@material-ui/core/Box';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardMedia from '@material-ui/core/CardMedia';\nimport Chip from '@material-ui/core/Chip';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport { LinkButton } from '@backstage/core-components';\nimport classNames from 'classnames';\
|
|
1
|
+
{"version":3,"file":"ToolCard.esm.js","sources":["../../../src/components/ToolCard/ToolCard.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 { ExploreTool } from '@backstage-community/plugin-explore-react';\nimport Box from '@material-ui/core/Box';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardMedia from '@material-ui/core/CardMedia';\nimport Chip from '@material-ui/core/Chip';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport { LinkButton } from '@backstage/core-components';\nimport classNames from 'classnames';\n\n// TODO: Align styling between Domain and ToolCard\n\nconst useStyles = makeStyles<Theme>(\n theme => ({\n media: {\n height: 128,\n },\n mediaContain: {\n backgroundSize: 'contain',\n },\n lifecycle: {\n lineHeight: '0.8em',\n color: theme.palette.common.white,\n },\n ga: {\n backgroundColor: theme.palette.status.ok,\n },\n alpha: {\n backgroundColor: theme.palette.status.error,\n },\n beta: {\n backgroundColor: theme.palette.status.warning,\n },\n }),\n {\n name: 'ExploreToolCard',\n },\n);\n\ntype Props = {\n card: ExploreTool;\n objectFit?: 'cover' | 'contain';\n};\n\nexport const ToolCard = ({ card, objectFit }: Props) => {\n const classes = useStyles();\n\n const { title, description, url, image, lifecycle, tags } = card;\n\n return (\n <Card key={title}>\n <CardMedia\n image={image}\n title={title}\n className={classNames(classes.media, {\n [classes.mediaContain]: objectFit === 'contain',\n })}\n />\n <CardContent>\n <Typography variant=\"h5\">\n {title}{' '}\n {lifecycle && lifecycle.toLocaleLowerCase('en-US') !== 'ga' && (\n <Chip\n size=\"small\"\n label={lifecycle}\n className={classNames(\n classes.lifecycle,\n classes[lifecycle.toLocaleLowerCase('en-US')],\n )}\n />\n )}\n </Typography>\n <Typography>{description || 'Description missing'}</Typography>\n {tags && (\n <Box marginTop={2}>\n {tags.map((item, idx) => (\n <Chip size=\"small\" key={idx} label={item} />\n ))}\n </Box>\n )}\n </CardContent>\n <CardActions>\n <LinkButton color=\"primary\" to={url} disabled={!url}>\n Explore\n </LinkButton>\n </CardActions>\n </Card>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AA8BA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,KAAO,EAAA;AAAA,MACL,MAAQ,EAAA;AAAA,KACV;AAAA,IACA,YAAc,EAAA;AAAA,MACZ,cAAgB,EAAA;AAAA,KAClB;AAAA,IACA,SAAW,EAAA;AAAA,MACT,UAAY,EAAA,OAAA;AAAA,MACZ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,KAC9B;AAAA,IACA,EAAI,EAAA;AAAA,MACF,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA;AAAA,KACxC;AAAA,IACA,KAAO,EAAA;AAAA,MACL,eAAA,EAAiB,KAAM,CAAA,OAAA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A;AAAA,MACjD,wBACE,GAAA,CAAA,GAAA,EAAA,EAAI,WAAW,CACb,EAAA,QAAA,EAAA,IAAA,CAAK,IAAI,CAAC,IAAA,EAAM,GACf,qBAAA,GAAA,CAAC,QAAK,IAAK,EAAA,OAAA,EAAkB,OAAO,IAAZ,EAAA,EAAA,GAAkB,CAC3C,CACH,EAAA;AAAA,KAEJ,EAAA,CAAA;AAAA,oBACC,GAAA,CAAA,WAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,KAAM,EAAA,SAAA,EAAU,EAAI,EAAA,GAAA,EAAK,QAAU,EAAA,CAAC,GAAK,EAAA,QAAA,EAAA,SAAA,EAErD,CACF,EAAA;AAAA,GAAA,EAAA,EAnCS,KAoCX,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import useAsync from 'react-use/esm/useAsync';
|
|
3
3
|
import { ToolCard } from '../ToolCard/ToolCard.esm.js';
|
|
4
4
|
import { Content, ContentHeader, SupportButton, Progress, WarningPanel, EmptyState, ItemCardGrid } from '@backstage/core-components';
|
|
@@ -16,13 +16,13 @@ const Body = () => {
|
|
|
16
16
|
return (await exploreApi.getTools())?.tools;
|
|
17
17
|
}, [exploreApi]);
|
|
18
18
|
if (loading) {
|
|
19
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ jsx(Progress, {});
|
|
20
20
|
}
|
|
21
21
|
if (error) {
|
|
22
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ jsx(WarningPanel, { title: "Failed to load tools" });
|
|
23
23
|
}
|
|
24
24
|
if (!tools?.length) {
|
|
25
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
26
|
EmptyState,
|
|
27
27
|
{
|
|
28
28
|
missing: "info",
|
|
@@ -31,9 +31,12 @@ const Body = () => {
|
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ jsx(ItemCardGrid, { children: tools.map((tool, index) => /* @__PURE__ */ jsx(ToolCard, { card: tool }, index)) });
|
|
35
35
|
};
|
|
36
|
-
const ToolExplorerContent = (props) => /* @__PURE__ */
|
|
36
|
+
const ToolExplorerContent = (props) => /* @__PURE__ */ jsxs(Content, { noPadding: true, children: [
|
|
37
|
+
/* @__PURE__ */ jsx(ContentHeader, { title: props.title ?? "Tools", children: /* @__PURE__ */ jsx(SupportButton, { children: "Discover the tools in your ecosystem." }) }),
|
|
38
|
+
/* @__PURE__ */ jsx(Body, {})
|
|
39
|
+
] });
|
|
37
40
|
|
|
38
41
|
export { ToolExplorerContent };
|
|
39
42
|
//# sourceMappingURL=ToolExplorerContent.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolExplorerContent.esm.js","sources":["../../../src/components/ToolExplorerContent/ToolExplorerContent.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"ToolExplorerContent.esm.js","sources":["../../../src/components/ToolExplorerContent/ToolExplorerContent.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport useAsync from 'react-use/esm/useAsync';\nimport { ToolCard } from '../ToolCard';\nimport {\n Content,\n ContentHeader,\n EmptyState,\n ItemCardGrid,\n Progress,\n SupportButton,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { exploreApiRef } from '../../api';\n\nconst Body = () => {\n const exploreApi = useApi(exploreApiRef);\n\n const {\n value: tools,\n loading,\n error,\n } = useAsync(async () => {\n return (await exploreApi.getTools())?.tools;\n }, [exploreApi]);\n\n if (loading) {\n return <Progress />;\n }\n\n if (error) {\n return <WarningPanel title=\"Failed to load tools\" />;\n }\n\n if (!tools?.length) {\n return (\n <EmptyState\n missing=\"info\"\n title=\"No tools to display\"\n description=\"You haven't added any tools yet.\"\n />\n );\n }\n\n return (\n <ItemCardGrid>\n {tools.map((tool, index) => (\n <ToolCard key={index} card={tool} />\n ))}\n </ItemCardGrid>\n );\n};\n\nexport const ToolExplorerContent = (props: { title?: string }) => (\n <Content noPadding>\n <ContentHeader title={props.title ?? 'Tools'}>\n <SupportButton>Discover the tools in your ecosystem.</SupportButton>\n </ContentHeader>\n <Body />\n </Content>\n);\n"],"names":[],"mappings":";;;;;;;;AA8BA,MAAM,OAAO,MAAM;AACjB,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA;AAEvC,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,KAAA;AAAA,IACP,OAAA;AAAA,IACA;AAAA,GACF,GAAI,SAAS,YAAY;AACvB,IAAQ,OAAA,CAAA,MAAM,UAAW,CAAA,QAAA,EAAa,GAAA,KAAA;AAAA,GACxC,EAAG,CAAC,UAAU,CAAC,CAAA;AAEf,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA;AAGnB,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,GAAA,CAAC,YAAa,EAAA,EAAA,KAAA,EAAM,sBAAuB,EAAA,CAAA;AAAA;AAGpD,EAAI,IAAA,CAAC,OAAO,MAAQ,EAAA;AAClB,IACE,uBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,MAAA;AAAA,QACR,KAAM,EAAA,qBAAA;AAAA,QACN,WAAY,EAAA;AAAA;AAAA,KACd;AAAA;AAIJ,EAAA,uBACG,GAAA,CAAA,YAAA,EAAA,EACE,QAAM,EAAA,KAAA,CAAA,GAAA,CAAI,CAAC,IAAA,EAAM,KAChB,qBAAA,GAAA,CAAC,QAAqB,EAAA,EAAA,IAAA,EAAM,IAAb,EAAA,EAAA,KAAmB,CACnC,CACH,EAAA,CAAA;AAEJ,CAAA;AAEO,MAAM,sBAAsB,CAAC,KAAA,qBACjC,IAAA,CAAA,OAAA,EAAA,EAAQ,WAAS,IAChB,EAAA,QAAA,EAAA;AAAA,kBAAC,GAAA,CAAA,aAAA,EAAA,EAAc,OAAO,KAAM,CAAA,KAAA,IAAS,SACnC,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAc,mDAAqC,CACtD,EAAA,CAAA;AAAA,sBACC,IAAK,EAAA,EAAA;AAAA,CACR,EAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Box from '@material-ui/core/Box';
|
|
3
3
|
import Chip from '@material-ui/core/Chip';
|
|
4
4
|
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
|
@@ -24,29 +24,35 @@ function ToolSearchResultListItem(props) {
|
|
|
24
24
|
const result = props.result;
|
|
25
25
|
const classes = useStyles();
|
|
26
26
|
if (!result) return null;
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
primary: /* @__PURE__ */ React.createElement(Link, { noTrack: true, to: result.location }, props.highlight?.fields.title ? /* @__PURE__ */ React.createElement(
|
|
33
|
-
HighlightedSearchResultText,
|
|
27
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
28
|
+
props.icon && /* @__PURE__ */ jsx(ListItemIcon, { children: typeof props.icon === "function" ? props.icon(result) : props.icon }),
|
|
29
|
+
/* @__PURE__ */ jsxs("div", { className: classes.flexContainer, children: [
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
ListItemText,
|
|
34
32
|
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
className: classes.itemText,
|
|
34
|
+
primaryTypographyProps: { variant: "h6" },
|
|
35
|
+
primary: /* @__PURE__ */ jsx(Link, { noTrack: true, to: result.location, children: props.highlight?.fields.title ? /* @__PURE__ */ jsx(
|
|
36
|
+
HighlightedSearchResultText,
|
|
37
|
+
{
|
|
38
|
+
text: props.highlight.fields.title,
|
|
39
|
+
preTag: props.highlight.preTag,
|
|
40
|
+
postTag: props.highlight.postTag
|
|
41
|
+
}
|
|
42
|
+
) : result.title }),
|
|
43
|
+
secondary: props.highlight?.fields.text ? /* @__PURE__ */ jsx(
|
|
44
|
+
HighlightedSearchResultText,
|
|
45
|
+
{
|
|
46
|
+
text: props.highlight.fields.text,
|
|
47
|
+
preTag: props.highlight.preTag,
|
|
48
|
+
postTag: props.highlight.postTag
|
|
49
|
+
}
|
|
50
|
+
) : result.text
|
|
38
51
|
}
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
text: props.highlight.fields.text,
|
|
44
|
-
preTag: props.highlight.preTag,
|
|
45
|
-
postTag: props.highlight.postTag
|
|
46
|
-
}
|
|
47
|
-
) : result.text
|
|
48
|
-
}
|
|
49
|
-
), /* @__PURE__ */ React.createElement(Box, null, result.tags?.map((tag) => /* @__PURE__ */ React.createElement(Chip, { label: tag, size: "small" })))));
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ jsx(Box, { children: result.tags?.map((tag) => /* @__PURE__ */ jsx(Chip, { label: tag, size: "small" })) })
|
|
54
|
+
] })
|
|
55
|
+
] });
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
export { ToolSearchResultListItem };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolSearchResultListItem.esm.js","sources":["../../../src/components/ToolSearchResultListItem/ToolSearchResultListItem.tsx"],"sourcesContent":["/*\n * Copyright 2022 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
|
|
1
|
+
{"version":3,"file":"ToolSearchResultListItem.esm.js","sources":["../../../src/components/ToolSearchResultListItem/ToolSearchResultListItem.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { ReactNode } from 'react';\nimport Box from '@material-ui/core/Box';\nimport Chip from '@material-ui/core/Chip';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Link } from '@backstage/core-components';\nimport {\n IndexableDocument,\n ResultHighlight,\n} from '@backstage/plugin-search-common';\nimport { HighlightedSearchResultText } from '@backstage/plugin-search-react';\n\nconst useStyles = makeStyles(\n {\n flexContainer: {\n flexWrap: 'wrap',\n },\n itemText: {\n width: '100%',\n wordBreak: 'break-all',\n marginBottom: '1rem',\n },\n },\n { name: 'ExploreToolSearchResultListItem' },\n);\n\n/**\n * Props for {@link ToolSearchResultListItem}.\n *\n * @public\n */\nexport interface ToolSearchResultListItemProps {\n icon?: ReactNode | ((result: IndexableDocument) => ReactNode);\n result?: IndexableDocument;\n highlight?: ResultHighlight;\n rank?: number;\n}\n\n/** @public */\nexport function ToolSearchResultListItem(props: ToolSearchResultListItemProps) {\n const result = props.result as any;\n\n const classes = useStyles();\n\n if (!result) return null;\n\n return (\n <>\n {props.icon && (\n <ListItemIcon>\n {typeof props.icon === 'function' ? props.icon(result) : props.icon}\n </ListItemIcon>\n )}\n <div className={classes.flexContainer}>\n <ListItemText\n className={classes.itemText}\n primaryTypographyProps={{ variant: 'h6' }}\n primary={\n <Link noTrack to={result.location}>\n {props.highlight?.fields.title ? (\n <HighlightedSearchResultText\n text={props.highlight.fields.title}\n preTag={props.highlight.preTag}\n postTag={props.highlight.postTag}\n />\n ) : (\n result.title\n )}\n </Link>\n }\n secondary={\n props.highlight?.fields.text ? (\n <HighlightedSearchResultText\n text={props.highlight.fields.text}\n preTag={props.highlight.preTag}\n postTag={props.highlight.postTag}\n />\n ) : (\n result.text\n )\n }\n />\n <Box>\n {result.tags?.map((tag: string) => (\n <Chip label={tag} size=\"small\" />\n ))}\n </Box>\n </div>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AA6BA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA,IACE,aAAe,EAAA;AAAA,MACb,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,QAAU,EAAA;AAAA,MACR,KAAO,EAAA,MAAA;AAAA,MACP,SAAW,EAAA,WAAA;AAAA,MACX,YAAc,EAAA;AAAA;AAChB,GACF;AAAA,EACA,EAAE,MAAM,iCAAkC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U,MAAO,CAAA,IAAA;AAAA,cAC7B,MAAA,EAAQ,MAAM,SAAU,CAAA,MAAA;AAAA,cACxB,OAAA,EAAS,MAAM,SAAU,CAAA;AAAA;AAAA,cAG3B,MAAO,CAAA;AAAA;AAAA,OAGb;AAAA,sBACC,GAAA,CAAA,GAAA,EAAA,EACE,QAAO,EAAA,MAAA,CAAA,IAAA,EAAM,IAAI,CAAC,GAAA,qBAChB,GAAA,CAAA,IAAA,EAAA,EAAK,KAAO,EAAA,GAAA,EAAK,IAAK,EAAA,OAAA,EAAQ,CAChC,CACH,EAAA;AAAA,KACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
|
3
3
|
import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';
|
|
4
4
|
import { GetExploreToolsRequest, GetExploreToolsResponse } from '@backstage-community/plugin-explore-common';
|
|
5
5
|
import { ExploreToolsConfig } from '@backstage-community/plugin-explore-react';
|
|
6
|
-
import * as
|
|
7
|
-
import React__default, { ReactNode } from 'react';
|
|
6
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
7
|
import { TabProps } from '@material-ui/core/Tab';
|
|
8
|
+
import React, { ReactNode } from 'react';
|
|
9
9
|
import { DomainEntity } from '@backstage/catalog-model';
|
|
10
|
-
import * as
|
|
10
|
+
import * as _backstage_core_components from '@backstage/core-components';
|
|
11
11
|
import { SearchResultListItemExtensionProps } from '@backstage/plugin-search-react';
|
|
12
12
|
import { IndexableDocument, ResultHighlight } from '@backstage/plugin-search-common';
|
|
13
13
|
|
|
@@ -56,22 +56,22 @@ declare class ExploreClient implements ExploreApi {
|
|
|
56
56
|
declare const CatalogKindExploreContent: (props: {
|
|
57
57
|
title?: string;
|
|
58
58
|
kind: string;
|
|
59
|
-
}) =>
|
|
59
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
60
60
|
|
|
61
61
|
/** @public */
|
|
62
62
|
type SubRoute = {
|
|
63
63
|
path: string;
|
|
64
64
|
title: string;
|
|
65
65
|
children: JSX.Element;
|
|
66
|
-
tabProps?: TabProps<
|
|
67
|
-
component?:
|
|
66
|
+
tabProps?: TabProps<React.ElementType, {
|
|
67
|
+
component?: React.ElementType;
|
|
68
68
|
}>;
|
|
69
69
|
};
|
|
70
70
|
/** @public */
|
|
71
71
|
type ExploreLayoutProps = {
|
|
72
72
|
title?: string;
|
|
73
73
|
subtitle?: string;
|
|
74
|
-
children?:
|
|
74
|
+
children?: React.ReactNode;
|
|
75
75
|
};
|
|
76
76
|
/**
|
|
77
77
|
* Explore is a compound component, which allows you to define a custom layout
|
|
@@ -88,32 +88,32 @@ type ExploreLayoutProps = {
|
|
|
88
88
|
* @public
|
|
89
89
|
*/
|
|
90
90
|
declare const ExploreLayout: {
|
|
91
|
-
(props: ExploreLayoutProps):
|
|
91
|
+
(props: ExploreLayoutProps): react_jsx_runtime.JSX.Element;
|
|
92
92
|
Route: (props: SubRoute) => null;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
/** @public */
|
|
96
96
|
declare const DomainCard: (props: {
|
|
97
97
|
entity: DomainEntity;
|
|
98
|
-
}) =>
|
|
98
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
99
99
|
|
|
100
100
|
/** @public */
|
|
101
|
-
declare const ExplorePage: () =>
|
|
101
|
+
declare const ExplorePage: () => react_jsx_runtime.JSX.Element;
|
|
102
102
|
/** @public */
|
|
103
103
|
declare const DomainExplorerContent: (props: {
|
|
104
104
|
title?: string | undefined;
|
|
105
|
-
}) =>
|
|
105
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
106
106
|
/** @public */
|
|
107
107
|
declare const GroupsExplorerContent: (props: {
|
|
108
108
|
title?: string | undefined;
|
|
109
|
-
direction?:
|
|
109
|
+
direction?: _backstage_core_components.DependencyGraphTypes.Direction | undefined;
|
|
110
110
|
hideChildren?: boolean | undefined;
|
|
111
111
|
namespace?: string | undefined;
|
|
112
|
-
}) =>
|
|
112
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
113
113
|
/** @public */
|
|
114
114
|
declare const ToolExplorerContent: (props: {
|
|
115
115
|
title?: string | undefined;
|
|
116
|
-
}) =>
|
|
116
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
* Props for {@link ToolSearchResultListItem}.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-explore",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "A Backstage plugin for building an exploration page of your software ecosystem",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"types": "./dist/index.d.ts",
|
|
49
49
|
"typesVersions": {
|
|
50
50
|
"*": {
|
|
51
|
-
"*": [
|
|
52
|
-
"dist/index.d.ts"
|
|
53
|
-
],
|
|
54
51
|
"alpha": [
|
|
55
52
|
"dist/alpha.d.ts"
|
|
53
|
+
],
|
|
54
|
+
"package.json": [
|
|
55
|
+
"package.json"
|
|
56
56
|
]
|
|
57
57
|
}
|
|
58
58
|
},
|
|
@@ -69,17 +69,17 @@
|
|
|
69
69
|
"test": "backstage-cli package test"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@backstage-community/plugin-explore-common": "^0.
|
|
73
|
-
"@backstage-community/plugin-explore-react": "^0.
|
|
72
|
+
"@backstage-community/plugin-explore-common": "^0.4.0",
|
|
73
|
+
"@backstage-community/plugin-explore-react": "^0.4.0",
|
|
74
74
|
"@backstage/catalog-client": "^1.9.1",
|
|
75
75
|
"@backstage/catalog-model": "^1.7.3",
|
|
76
|
-
"@backstage/core-components": "^0.17.
|
|
77
|
-
"@backstage/core-plugin-api": "^1.10.
|
|
76
|
+
"@backstage/core-components": "^0.17.1",
|
|
77
|
+
"@backstage/core-plugin-api": "^1.10.6",
|
|
78
78
|
"@backstage/errors": "^1.2.7",
|
|
79
|
-
"@backstage/frontend-plugin-api": "^0.10.
|
|
80
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
79
|
+
"@backstage/frontend-plugin-api": "^0.10.1",
|
|
80
|
+
"@backstage/plugin-catalog-react": "^1.17.0",
|
|
81
81
|
"@backstage/plugin-search-common": "^1.2.17",
|
|
82
|
-
"@backstage/plugin-search-react": "^1.8.
|
|
82
|
+
"@backstage/plugin-search-react": "^1.8.8",
|
|
83
83
|
"@material-ui/core": "^4.12.2",
|
|
84
84
|
"@material-ui/icons": "^4.9.1",
|
|
85
85
|
"@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
@@ -88,17 +88,16 @@
|
|
|
88
88
|
"react-use": "^17.2.4"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
|
-
"@backstage/cli": "^0.
|
|
92
|
-
"@backstage/core-app-api": "^1.16.
|
|
93
|
-
"@backstage/dev-utils": "^1.1.
|
|
94
|
-
"@backstage/plugin-catalog": "^1.
|
|
95
|
-
"@backstage/test-utils": "^1.7.
|
|
91
|
+
"@backstage/cli": "^0.32.0",
|
|
92
|
+
"@backstage/core-app-api": "^1.16.1",
|
|
93
|
+
"@backstage/dev-utils": "^1.1.9",
|
|
94
|
+
"@backstage/plugin-catalog": "^1.29.0",
|
|
95
|
+
"@backstage/test-utils": "^1.7.7",
|
|
96
96
|
"@testing-library/dom": "^10.0.0",
|
|
97
97
|
"@testing-library/jest-dom": "^6.0.0",
|
|
98
98
|
"@testing-library/react": "^15.0.0",
|
|
99
99
|
"@types/pluralize": "^0.0.33",
|
|
100
100
|
"@types/react-dom": "^18.2.19",
|
|
101
|
-
"canvas": "^2.11.2",
|
|
102
101
|
"msw": "^1.0.0",
|
|
103
102
|
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
104
103
|
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
|