@backstage/plugin-techdocs 1.10.8-next.0 → 1.10.8-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @backstage/plugin-techdocs
2
2
 
3
+ ## 1.10.8-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 69bd940: Use annotation constants from new techdocs-common package.
8
+ - 6349099: Added config input type to the extensions
9
+ - Updated dependencies
10
+ - @backstage/plugin-catalog-react@1.12.3-next.1
11
+ - @backstage/plugin-techdocs-common@0.1.0-next.0
12
+ - @backstage/frontend-plugin-api@0.6.8-next.1
13
+ - @backstage/core-compat-api@0.2.8-next.1
14
+ - @backstage/plugin-search-react@1.7.14-next.1
15
+ - @backstage/integration@1.14.0-next.0
16
+ - @backstage/plugin-search-common@1.2.14-next.0
17
+ - @backstage/catalog-model@1.5.0
18
+ - @backstage/config@1.2.0
19
+ - @backstage/core-components@0.14.10-next.0
20
+ - @backstage/core-plugin-api@1.9.3
21
+ - @backstage/errors@1.2.4
22
+ - @backstage/integration-react@1.1.30-next.0
23
+ - @backstage/theme@0.5.6
24
+ - @backstage/plugin-auth-react@0.1.5-next.0
25
+ - @backstage/plugin-techdocs-react@1.2.7-next.0
26
+
3
27
  ## 1.10.8-next.0
4
28
 
5
29
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-techdocs__alpha",
3
- "version": "1.10.8-next.0",
3
+ "version": "1.10.8-next.1",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
@@ -1,10 +1,10 @@
1
1
  import { getCompoundEntityRef, parseEntityRef } from '@backstage/catalog-model';
2
+ import { TECHDOCS_EXTERNAL_ANNOTATION } from '@backstage/plugin-techdocs-common';
2
3
  import React from 'react';
3
4
  import { TechDocsReaderPage } from './plugin.esm.js';
4
5
  import { TechDocsReaderPageContent } from './reader/components/TechDocsReaderPageContent/TechDocsReaderPageContent.esm.js';
5
6
  import { TechDocsReaderPageSubheader } from './reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.esm.js';
6
7
 
7
- const TECHDOCS_EXTERNAL_ANNOTATION = "backstage.io/techdocs-entity";
8
8
  const EntityPageDocs = ({ entity }) => {
9
9
  let entityRef = getCompoundEntityRef(entity);
10
10
  if (entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) {
@@ -1 +1 @@
1
- {"version":3,"file":"EntityPageDocs.esm.js","sources":["../src/EntityPageDocs.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 {\n Entity,\n getCompoundEntityRef,\n parseEntityRef,\n} from '@backstage/catalog-model';\n\nimport React from 'react';\nimport { TechDocsReaderPage } from './plugin';\nimport { TechDocsReaderPageContent } from './reader/components/TechDocsReaderPageContent';\nimport { TechDocsReaderPageSubheader } from './reader/components/TechDocsReaderPageSubheader';\n\nconst TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity';\n\ntype EntityPageDocsProps = { entity: Entity };\n\nexport const EntityPageDocs = ({ entity }: EntityPageDocsProps) => {\n let entityRef = getCompoundEntityRef(entity);\n\n if (entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) {\n try {\n entityRef = parseEntityRef(\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION],\n );\n } catch {\n // not a fan of this but we don't care if the parseEntityRef fails\n }\n }\n\n return (\n <TechDocsReaderPage entityRef={entityRef}>\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={false} />\n </TechDocsReaderPage>\n );\n};\n"],"names":[],"mappings":";;;;;;AA2BA,MAAM,4BAA+B,GAAA,8BAAA,CAAA;AAI9B,MAAM,cAAiB,GAAA,CAAC,EAAE,MAAA,EAAkC,KAAA;AACjE,EAAI,IAAA,SAAA,GAAY,qBAAqB,MAAM,CAAA,CAAA;AAE3C,EAAA,IAAI,MAAO,CAAA,QAAA,CAAS,WAAc,GAAA,4BAA4B,CAAG,EAAA;AAC/D,IAAI,IAAA;AACF,MAAY,SAAA,GAAA,cAAA;AAAA,QACV,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,4BAA4B,CAAA;AAAA,OAC5D,CAAA;AAAA,KACM,CAAA,MAAA;AAAA,KAER;AAAA,GACF;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,kBAAmB,EAAA,EAAA,SAAA,EAAA,kBACjB,KAAA,CAAA,aAAA,CAAA,2BAAA,EAAA,IAA4B,mBAC5B,KAAA,CAAA,aAAA,CAAA,yBAAA,EAAA,EAA0B,UAAY,EAAA,KAAA,EAAO,CAChD,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"EntityPageDocs.esm.js","sources":["../src/EntityPageDocs.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 {\n Entity,\n getCompoundEntityRef,\n parseEntityRef,\n} from '@backstage/catalog-model';\nimport { TECHDOCS_EXTERNAL_ANNOTATION } from '@backstage/plugin-techdocs-common';\n\nimport React from 'react';\nimport { TechDocsReaderPage } from './plugin';\nimport { TechDocsReaderPageContent } from './reader/components/TechDocsReaderPageContent';\nimport { TechDocsReaderPageSubheader } from './reader/components/TechDocsReaderPageSubheader';\n\ntype EntityPageDocsProps = { entity: Entity };\n\nexport const EntityPageDocs = ({ entity }: EntityPageDocsProps) => {\n let entityRef = getCompoundEntityRef(entity);\n\n if (entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) {\n try {\n entityRef = parseEntityRef(\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION],\n );\n } catch {\n // not a fan of this but we don't care if the parseEntityRef fails\n }\n }\n\n return (\n <TechDocsReaderPage entityRef={entityRef}>\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={false} />\n </TechDocsReaderPage>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA8BO,MAAM,cAAiB,GAAA,CAAC,EAAE,MAAA,EAAkC,KAAA;AACjE,EAAI,IAAA,SAAA,GAAY,qBAAqB,MAAM,CAAA,CAAA;AAE3C,EAAA,IAAI,MAAO,CAAA,QAAA,CAAS,WAAc,GAAA,4BAA4B,CAAG,EAAA;AAC/D,IAAI,IAAA;AACF,MAAY,SAAA,GAAA,cAAA;AAAA,QACV,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,4BAA4B,CAAA;AAAA,OAC5D,CAAA;AAAA,KACM,CAAA,MAAA;AAAA,KAER;AAAA,GACF;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,kBAAmB,EAAA,EAAA,SAAA,EAAA,kBACjB,KAAA,CAAA,aAAA,CAAA,2BAAA,EAAA,IAA4B,mBAC5B,KAAA,CAAA,aAAA,CAAA,yBAAA,EAAA,EAA0B,UAAY,EAAA,KAAA,EAAO,CAChD,CAAA,CAAA;AAEJ;;;;"}
@@ -4,9 +4,8 @@ import { EntityPageDocs } from './EntityPageDocs.esm.js';
4
4
  import { TechDocsIndexPage } from './home/components/TechDocsIndexPage.esm.js';
5
5
  import { TechDocsReaderPage } from './reader/components/TechDocsReaderPage/TechDocsReaderPage.esm.js';
6
6
  import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
7
+ import { TECHDOCS_ANNOTATION, TECHDOCS_EXTERNAL_ANNOTATION } from '@backstage/plugin-techdocs-common';
7
8
 
8
- const TECHDOCS_ANNOTATION = "backstage.io/techdocs-ref";
9
- const TECHDOCS_EXTERNAL_ANNOTATION = "backstage.io/techdocs-entity";
10
9
  const isTechDocsAvailable = (entity) => Boolean(entity?.metadata?.annotations?.[TECHDOCS_ANNOTATION]) || Boolean(entity?.metadata?.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]);
11
10
  const Router = () => {
12
11
  return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, { path: "/", element: /* @__PURE__ */ React.createElement(TechDocsIndexPage, null) }), /* @__PURE__ */ React.createElement(
@@ -1 +1 @@
1
- {"version":3,"file":"Router.esm.js","sources":["../src/Router.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 React, { PropsWithChildren } from 'react';\nimport { Route, Routes, useRoutes } from 'react-router-dom';\n\nimport { Entity } from '@backstage/catalog-model';\nimport { EntityPageDocs } from './EntityPageDocs';\nimport { TechDocsIndexPage } from './home/components/TechDocsIndexPage';\nimport { TechDocsReaderPage } from './reader/components/TechDocsReaderPage';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\n\nconst TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref';\n\nconst TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity';\n\n/**\n * Helper that takes in entity and returns true/false if TechDocs is available for the entity\n *\n * @public\n */\nexport const isTechDocsAvailable = (entity: Entity) =>\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_ANNOTATION]) ||\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]);\n\n/**\n * Responsible for registering routes for TechDocs, TechDocs Homepage and separate TechDocs page\n *\n * @public\n */\nexport const Router = () => {\n return (\n <Routes>\n <Route path=\"/\" element={<TechDocsIndexPage />} />\n <Route\n path=\"/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n />\n </Routes>\n );\n};\n\n/**\n * Responsible for registering route to view docs on Entity page\n *\n * @public\n */\nexport const EmbeddedDocsRouter = (props: PropsWithChildren<{}>) => {\n const { children } = props;\n const { entity } = useEntity();\n\n // Using objects instead of <Route> elements, otherwise \"outlet\" will be null on sub-pages and add-ons won't render\n const element = useRoutes([\n {\n path: '/*',\n element: <EntityPageDocs entity={entity} />,\n children: [\n {\n path: '*',\n element: children,\n },\n ],\n },\n ]);\n\n const projectId =\n entity.metadata.annotations?.[TECHDOCS_ANNOTATION] ||\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION];\n\n if (!projectId) {\n return <MissingAnnotationEmptyState annotation={[TECHDOCS_ANNOTATION]} />;\n }\n\n return element;\n};\n"],"names":[],"mappings":";;;;;;;AA4BA,MAAM,mBAAsB,GAAA,2BAAA,CAAA;AAE5B,MAAM,4BAA+B,GAAA,8BAAA,CAAA;AAO9B,MAAM,mBAAsB,GAAA,CAAC,MAClC,KAAA,OAAA,CAAQ,QAAQ,QAAU,EAAA,WAAA,GAAc,mBAAmB,CAAC,KAC5D,OAAQ,CAAA,MAAA,EAAQ,QAAU,EAAA,WAAA,GAAc,4BAA4B,CAAC,EAAA;AAOhE,MAAM,SAAS,MAAM;AAC1B,EACE,uBAAA,K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/*\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 React, { PropsWithChildren } from 'react';\nimport { Route, Routes, useRoutes } from 'react-router-dom';\n\nimport { Entity } from '@backstage/catalog-model';\nimport { EntityPageDocs } from './EntityPageDocs';\nimport { TechDocsIndexPage } from './home/components/TechDocsIndexPage';\nimport { TechDocsReaderPage } from './reader/components/TechDocsReaderPage';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport {\n TECHDOCS_ANNOTATION,\n TECHDOCS_EXTERNAL_ANNOTATION,\n} from '@backstage/plugin-techdocs-common';\n\n/**\n * Helper that takes in entity and returns true/false if TechDocs is available for the entity\n *\n * @public\n */\nexport const isTechDocsAvailable = (entity: Entity) =>\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_ANNOTATION]) ||\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]);\n\n/**\n * Responsible for registering routes for TechDocs, TechDocs Homepage and separate TechDocs page\n *\n * @public\n */\nexport const Router = () => {\n return (\n <Routes>\n <Route path=\"/\" element={<TechDocsIndexPage />} />\n <Route\n path=\"/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n />\n </Routes>\n );\n};\n\n/**\n * Responsible for registering route to view docs on Entity page\n *\n * @public\n */\nexport const EmbeddedDocsRouter = (props: PropsWithChildren<{}>) => {\n const { children } = props;\n const { entity } = useEntity();\n\n // Using objects instead of <Route> elements, otherwise \"outlet\" will be null on sub-pages and add-ons won't render\n const element = useRoutes([\n {\n path: '/*',\n element: <EntityPageDocs entity={entity} />,\n children: [\n {\n path: '*',\n element: children,\n },\n ],\n },\n ]);\n\n const projectId =\n entity.metadata.annotations?.[TECHDOCS_ANNOTATION] ||\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION];\n\n if (!projectId) {\n return <MissingAnnotationEmptyState annotation={[TECHDOCS_ANNOTATION]} />;\n }\n\n return element;\n};\n"],"names":[],"mappings":";;;;;;;;AAqCO,MAAM,mBAAsB,GAAA,CAAC,MAClC,KAAA,OAAA,CAAQ,QAAQ,QAAU,EAAA,WAAA,GAAc,mBAAmB,CAAC,KAC5D,OAAQ,CAAA,MAAA,EAAQ,QAAU,EAAA,WAAA,GAAc,4BAA4B,CAAC,EAAA;AAOhE,MAAM,SAAS,MAAM;AAC1B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,MACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAK,KAAI,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,iBAAkB,EAAA,IAAA,CAAA,EAAI,CAChD,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,2BAAA;AAAA,MACL,OAAA,sCAAU,kBAAmB,EAAA,IAAA,CAAA;AAAA,KAAA;AAAA,GAEjC,CAAA,CAAA;AAEJ,EAAA;AAOa,MAAA,kBAAA,GAAqB,CAAC,KAAiC,KAAA;AAClE,EAAM,MAAA,EAAE,UAAa,GAAA,KAAA,CAAA;AACrB,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAG7B,EAAA,MAAM,UAAU,SAAU,CAAA;AAAA,IACxB;AAAA,MACE,IAAM,EAAA,IAAA;AAAA,MACN,OAAA,kBAAU,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,EAAe,MAAgB,EAAA,CAAA;AAAA,MACzC,QAAU,EAAA;AAAA,QACR;AAAA,UACE,IAAM,EAAA,GAAA;AAAA,UACN,OAAS,EAAA,QAAA;AAAA,SACX;AAAA,OACF;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AAED,EAAM,MAAA,SAAA,GACJ,OAAO,QAAS,CAAA,WAAA,GAAc,mBAAmB,CACjD,IAAA,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,4BAA4B,CAAA,CAAA;AAE5D,EAAA,IAAI,CAAC,SAAW,EAAA;AACd,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,2BAAA,EAAA,EAA4B,UAAY,EAAA,CAAC,mBAAmB,CAAG,EAAA,CAAA,CAAA;AAAA,GACzE;AAEA,EAAO,OAAA,OAAA,CAAA;AACT;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -7,6 +7,12 @@ declare const techDocsSearchResultListItemExtension: _backstage_frontend_plugin_
7
7
  asListItem: boolean;
8
8
  asLink: boolean;
9
9
  title?: string | undefined;
10
+ }, {
11
+ lineClamp: number;
12
+ noTrack: boolean;
13
+ asListItem: boolean;
14
+ asLink: boolean;
15
+ title?: string | undefined;
10
16
  }>;
11
17
  /** @alpha */
12
18
  declare const _default: _backstage_frontend_plugin_api.BackstagePlugin<{
@@ -9,6 +9,7 @@ import { Content, Progress, WarningPanel, CodeSnippet, HeaderTabs, ContentHeader
9
9
  import '@material-ui/core/Typography';
10
10
  import { TechDocsPageWrapper } from './TechDocsPageWrapper.esm.js';
11
11
  import { useApi } from '@backstage/core-plugin-api';
12
+ import { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common';
12
13
 
13
14
  const panels = {
14
15
  DocsTable,
@@ -50,7 +51,7 @@ const TechDocsCustomHome = (props) => {
50
51
  } = useAsync(async () => {
51
52
  const response = await catalogApi.getEntities({
52
53
  filter: {
53
- "metadata.annotations.backstage.io/techdocs-ref": CATALOG_FILTER_EXISTS
54
+ [`metadata.annotations.${TECHDOCS_ANNOTATION}`]: CATALOG_FILTER_EXISTS
54
55
  },
55
56
  fields: [
56
57
  "apiVersion",
@@ -62,7 +63,7 @@ const TechDocsCustomHome = (props) => {
62
63
  ]
63
64
  });
64
65
  return response.items.filter((entity) => {
65
- return !!entity.metadata.annotations?.["backstage.io/techdocs-ref"];
66
+ return !!entity.metadata.annotations?.[TECHDOCS_ANNOTATION];
66
67
  });
67
68
  });
68
69
  const currentTabConfig = tabsConfig[selectedTab];
@@ -1 +1 @@
1
- {"version":3,"file":"TechDocsCustomHome.esm.js","sources":["../../../src/home/components/TechDocsCustomHome.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 React, { useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CSSProperties } from '@material-ui/styles/withStyles';\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n CatalogApi,\n useEntityOwnership,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { DocsTable } from './Tables';\nimport { DocsCardGrid } from './Grids';\nimport { TechDocsPageWrapper } from './TechDocsPageWrapper';\n\nimport {\n CodeSnippet,\n Content,\n HeaderTabs,\n Progress,\n WarningPanel,\n SupportButton,\n ContentHeader,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nconst panels = {\n DocsTable: DocsTable,\n DocsCardGrid: DocsCardGrid,\n};\n\n/**\n * Available panel types\n *\n * @public\n */\nexport type PanelType = 'DocsCardGrid' | 'DocsTable';\n\n/**\n * Type representing a TechDocsCustomHome panel.\n *\n * @public\n */\nexport interface PanelConfig {\n title: string;\n description: string;\n panelType: PanelType;\n panelCSS?: CSSProperties;\n filterPredicate: ((entity: Entity) => boolean) | string;\n}\n\n/**\n * Type representing a TechDocsCustomHome tab.\n *\n * @public\n */\nexport interface TabConfig {\n label: string;\n panels: PanelConfig[];\n}\n\n/**\n * Type representing a list of TechDocsCustomHome tabs.\n *\n * @public\n */\nexport type TabsConfig = TabConfig[];\n\nconst CustomPanel = ({\n config,\n entities,\n index,\n}: {\n config: PanelConfig;\n entities: Entity[];\n index: number;\n}) => {\n const useStyles = makeStyles({\n panelContainer: {\n marginBottom: '2rem',\n ...(config.panelCSS ? config.panelCSS : {}),\n },\n });\n const classes = useStyles();\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const Panel = panels[config.panelType];\n\n const shownEntities = entities.filter(entity => {\n if (config.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof config.filterPredicate === 'function' &&\n config.filterPredicate(entity)\n );\n });\n\n return (\n <>\n <ContentHeader title={config.title} description={config.description}>\n {index === 0 ? (\n <SupportButton>\n Discover documentation in your ecosystem.\n </SupportButton>\n ) : null}\n </ContentHeader>\n <div className={classes.panelContainer}>\n <Panel data-testid=\"techdocs-custom-panel\" entities={shownEntities} />\n </div>\n </>\n );\n};\n\n/**\n * Props for {@link TechDocsCustomHome}\n *\n * @public\n */\nexport type TechDocsCustomHomeProps = {\n tabsConfig: TabsConfig;\n};\n\nexport const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {\n const { tabsConfig } = props;\n const [selectedTab, setSelectedTab] = useState<number>(0);\n const catalogApi: CatalogApi = useApi(catalogApiRef);\n\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: {\n 'metadata.annotations.backstage.io/techdocs-ref': CATALOG_FILTER_EXISTS,\n },\n fields: [\n 'apiVersion',\n 'kind',\n 'metadata',\n 'relations',\n 'spec.owner',\n 'spec.type',\n ],\n });\n return response.items.filter((entity: Entity) => {\n return !!entity.metadata.annotations?.['backstage.io/techdocs-ref'];\n });\n });\n\n const currentTabConfig = tabsConfig[selectedTab];\n\n if (loading) {\n return (\n <TechDocsPageWrapper>\n <Content>\n <Progress />\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n if (error) {\n return (\n <TechDocsPageWrapper>\n <Content>\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n return (\n <TechDocsPageWrapper>\n <HeaderTabs\n selectedIndex={selectedTab}\n onChange={index => setSelectedTab(index)}\n tabs={tabsConfig.map(({ label }, index) => ({\n id: index.toString(),\n label,\n }))}\n />\n <Content data-testid=\"techdocs-content\">\n {currentTabConfig.panels.map((config, index) => (\n <CustomPanel\n key={index}\n config={config}\n entities={!!entities ? entities : []}\n index={index}\n />\n ))}\n </Content>\n </TechDocsPageWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AA0CA,MAAM,MAAS,GAAA;AAAA,EACb,SAAA;AAAA,EACA,YAAA;AACF,CAAA,CAAA;AAuCA,MAAM,cAAc,CAAC;AAAA,EACnB,MAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AACF,CAIM,KAAA;AACJ,EAAA,MAAM,YAAY,UAAW,CAAA;AAAA,IAC3B,cAAgB,EAAA;AAAA,MACd,YAAc,EAAA,MAAA;AAAA,MACd,GAAI,MAAA,CAAO,QAAW,GAAA,MAAA,CAAO,WAAW,EAAC;AAAA,KAC3C;AAAA,GACD,CAAA,CAAA;AACD,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,EAAE,OAAA,EAAS,gBAAkB,EAAA,aAAA,KAAkB,kBAAmB,EAAA,CAAA;AAExE,EAAM,MAAA,KAAA,GAAQ,MAAO,CAAA,MAAA,CAAO,SAAS,CAAA,CAAA;AAErC,EAAM,MAAA,aAAA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WAAA;AAAA,MACf,QAAA,EAAU,CAAS,KAAA,KAAA,cAAA,CAAe,KAAK,CAAA;AAAA,MACvC,MAAM,UAAW,CAAA,GAAA,CAAI,CAAC,EAAE,KAAA,IAAS,KAAW,MAAA;AAAA,QAC1C,EAAA,EAAI,MAAM,QAAS,EAAA;AAAA,QACnB,KAAA;AAAA,OACA,CAAA,CAAA;AAAA,KAAA;AAAA,GACJ,kBACC,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,aAAY,EAAA,kBAAA,EAAA,EAClB,iBAAiB,MAAO,CAAA,GAAA,CAAI,CAAC,MAAA,EAAQ,KACpC,qBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,GAAK,EAAA,KAAA;AAAA,MACL,MAAA;AAAA,MACA,QAAU,EAAA,CAAC,CAAC,QAAA,GAAW,WAAW,EAAC;AAAA,MACnC,KAAA;AAAA,KAAA;AAAA,GAEH,CACH,CACF,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TechDocsCustomHome.esm.js","sources":["../../../src/home/components/TechDocsCustomHome.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 React, { useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CSSProperties } from '@material-ui/styles/withStyles';\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n CatalogApi,\n useEntityOwnership,\n} from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\nimport { DocsTable } from './Tables';\nimport { DocsCardGrid } from './Grids';\nimport { TechDocsPageWrapper } from './TechDocsPageWrapper';\n\nimport {\n CodeSnippet,\n Content,\n HeaderTabs,\n Progress,\n WarningPanel,\n SupportButton,\n ContentHeader,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common';\n\nconst panels = {\n DocsTable: DocsTable,\n DocsCardGrid: DocsCardGrid,\n};\n\n/**\n * Available panel types\n *\n * @public\n */\nexport type PanelType = 'DocsCardGrid' | 'DocsTable';\n\n/**\n * Type representing a TechDocsCustomHome panel.\n *\n * @public\n */\nexport interface PanelConfig {\n title: string;\n description: string;\n panelType: PanelType;\n panelCSS?: CSSProperties;\n filterPredicate: ((entity: Entity) => boolean) | string;\n}\n\n/**\n * Type representing a TechDocsCustomHome tab.\n *\n * @public\n */\nexport interface TabConfig {\n label: string;\n panels: PanelConfig[];\n}\n\n/**\n * Type representing a list of TechDocsCustomHome tabs.\n *\n * @public\n */\nexport type TabsConfig = TabConfig[];\n\nconst CustomPanel = ({\n config,\n entities,\n index,\n}: {\n config: PanelConfig;\n entities: Entity[];\n index: number;\n}) => {\n const useStyles = makeStyles({\n panelContainer: {\n marginBottom: '2rem',\n ...(config.panelCSS ? config.panelCSS : {}),\n },\n });\n const classes = useStyles();\n const { loading: loadingOwnership, isOwnedEntity } = useEntityOwnership();\n\n const Panel = panels[config.panelType];\n\n const shownEntities = entities.filter(entity => {\n if (config.filterPredicate === 'ownedByUser') {\n if (loadingOwnership) {\n return false;\n }\n return isOwnedEntity(entity);\n }\n\n return (\n typeof config.filterPredicate === 'function' &&\n config.filterPredicate(entity)\n );\n });\n\n return (\n <>\n <ContentHeader title={config.title} description={config.description}>\n {index === 0 ? (\n <SupportButton>\n Discover documentation in your ecosystem.\n </SupportButton>\n ) : null}\n </ContentHeader>\n <div className={classes.panelContainer}>\n <Panel data-testid=\"techdocs-custom-panel\" entities={shownEntities} />\n </div>\n </>\n );\n};\n\n/**\n * Props for {@link TechDocsCustomHome}\n *\n * @public\n */\nexport type TechDocsCustomHomeProps = {\n tabsConfig: TabsConfig;\n};\n\nexport const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {\n const { tabsConfig } = props;\n const [selectedTab, setSelectedTab] = useState<number>(0);\n const catalogApi: CatalogApi = useApi(catalogApiRef);\n\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: {\n [`metadata.annotations.${TECHDOCS_ANNOTATION}`]: CATALOG_FILTER_EXISTS,\n },\n fields: [\n 'apiVersion',\n 'kind',\n 'metadata',\n 'relations',\n 'spec.owner',\n 'spec.type',\n ],\n });\n return response.items.filter((entity: Entity) => {\n return !!entity.metadata.annotations?.[TECHDOCS_ANNOTATION];\n });\n });\n\n const currentTabConfig = tabsConfig[selectedTab];\n\n if (loading) {\n return (\n <TechDocsPageWrapper>\n <Content>\n <Progress />\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n if (error) {\n return (\n <TechDocsPageWrapper>\n <Content>\n <WarningPanel\n severity=\"error\"\n title=\"Could not load available documentation.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n </Content>\n </TechDocsPageWrapper>\n );\n }\n\n return (\n <TechDocsPageWrapper>\n <HeaderTabs\n selectedIndex={selectedTab}\n onChange={index => setSelectedTab(index)}\n tabs={tabsConfig.map(({ label }, index) => ({\n id: index.toString(),\n label,\n }))}\n />\n <Content data-testid=\"techdocs-content\">\n {currentTabConfig.panels.map((config, index) => (\n <CustomPanel\n key={index}\n config={config}\n entities={!!entities ? entities : []}\n index={index}\n />\n ))}\n </Content>\n </TechDocsPageWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AA2CA,MAAM,MAAS,GAAA;AAAA,EACb,SAAA;AAAA,EACA,YAAA;AACF,CAAA,CAAA;AAuCA,MAAM,cAAc,CAAC;AAAA,EACnB,MAAA;AA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react';
3
+ import { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common';
3
4
 
4
5
  class TechDocsFilter {
5
6
  getCatalogFilters() {
6
7
  return {
7
- "metadata.annotations.backstage.io/techdocs-ref": CATALOG_FILTER_EXISTS
8
+ [`metadata.annotations.${TECHDOCS_ANNOTATION}`]: CATALOG_FILTER_EXISTS
8
9
  };
9
10
  }
10
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TechDocsPicker.esm.js","sources":["../../../src/home/components/TechDocsPicker.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 { useEffect } from 'react';\nimport {\n CATALOG_FILTER_EXISTS,\n DefaultEntityFilters,\n EntityFilter,\n useEntityList,\n} from '@backstage/plugin-catalog-react';\n\nclass TechDocsFilter implements EntityFilter {\n getCatalogFilters(): Record<string, string | symbol | (string | symbol)[]> {\n return {\n 'metadata.annotations.backstage.io/techdocs-ref': CATALOG_FILTER_EXISTS,\n };\n }\n}\n\ntype CustomFilters = DefaultEntityFilters & {\n techdocs?: TechDocsFilter;\n};\n\n/**\n * Component responsible for updating TechDocs filters\n *\n * @public\n */\nexport const TechDocsPicker = () => {\n const { updateFilters } = useEntityList<CustomFilters>();\n\n useEffect(() => {\n updateFilters({\n techdocs: new TechDocsFilter(),\n });\n }, [updateFilters]);\n\n return null;\n};\n"],"names":[],"mappings":";;;AAwBA,MAAM,cAAuC,CAAA;AAAA,EAC3C,iBAA2E,GAAA;AACzE,IAAO,OAAA;AAAA,MACL,gDAAkD,EAAA,qBAAA;AAAA,KACpD,CAAA;AAAA,GACF;AACF,CAAA;AAWO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,EAAE,aAAc,EAAA,GAAI,aAA6B,EAAA,CAAA;AAEvD,EAAA,SAAA,CAAU,MAAM;AACd,IAAc,aAAA,CAAA;AAAA,MACZ,QAAA,EAAU,IAAI,cAAe,EAAA;AAAA,KAC9B,CAAA,CAAA;AAAA,GACH,EAAG,CAAC,aAAa,CAAC,CAAA,CAAA;AAElB,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"TechDocsPicker.esm.js","sources":["../../../src/home/components/TechDocsPicker.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 { useEffect } from 'react';\nimport {\n CATALOG_FILTER_EXISTS,\n DefaultEntityFilters,\n EntityFilter,\n useEntityList,\n} from '@backstage/plugin-catalog-react';\nimport { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common';\n\nclass TechDocsFilter implements EntityFilter {\n getCatalogFilters(): Record<string, string | symbol | (string | symbol)[]> {\n return {\n [`metadata.annotations.${TECHDOCS_ANNOTATION}`]: CATALOG_FILTER_EXISTS,\n };\n }\n}\n\ntype CustomFilters = DefaultEntityFilters & {\n techdocs?: TechDocsFilter;\n};\n\n/**\n * Component responsible for updating TechDocs filters\n *\n * @public\n */\nexport const TechDocsPicker = () => {\n const { updateFilters } = useEntityList<CustomFilters>();\n\n useEffect(() => {\n updateFilters({\n techdocs: new TechDocsFilter(),\n });\n }, [updateFilters]);\n\n return null;\n};\n"],"names":[],"mappings":";;;;AAyBA,MAAM,cAAuC,CAAA;AAAA,EAC3C,iBAA2E,GAAA;AACzE,IAAO,OAAA;AAAA,MACL,CAAC,CAAA,qBAAA,EAAwB,mBAAmB,CAAA,CAAE,GAAG,qBAAA;AAAA,KACnD,CAAA;AAAA,GACF;AACF,CAAA;AAWO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,EAAE,aAAc,EAAA,GAAI,aAA6B,EAAA,CAAA;AAEvD,EAAA,SAAA,CAAU,MAAM;AACd,IAAc,aAAA,CAAA;AAAA,MACZ,QAAA,EAAU,IAAI,cAAe,EAAA;AAAA,KAC9B,CAAA,CAAA;AAAA,GACH,EAAG,CAAC,aAAa,CAAC,CAAA,CAAA;AAElB,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-techdocs",
3
- "version": "1.10.8-next.0",
3
+ "version": "1.10.8-next.1",
4
4
  "description": "The Backstage plugin that renders technical documentation for your components",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -8,6 +8,7 @@
8
8
  "pluginPackages": [
9
9
  "@backstage/plugin-techdocs",
10
10
  "@backstage/plugin-techdocs-backend",
11
+ "@backstage/plugin-techdocs-common",
11
12
  "@backstage/plugin-techdocs-node",
12
13
  "@backstage/plugin-techdocs-react"
13
14
  ]
@@ -59,17 +60,18 @@
59
60
  "dependencies": {
60
61
  "@backstage/catalog-model": "^1.5.0",
61
62
  "@backstage/config": "^1.2.0",
62
- "@backstage/core-compat-api": "^0.2.8-next.0",
63
+ "@backstage/core-compat-api": "^0.2.8-next.1",
63
64
  "@backstage/core-components": "^0.14.10-next.0",
64
65
  "@backstage/core-plugin-api": "^1.9.3",
65
66
  "@backstage/errors": "^1.2.4",
66
- "@backstage/frontend-plugin-api": "^0.6.8-next.0",
67
+ "@backstage/frontend-plugin-api": "^0.6.8-next.1",
67
68
  "@backstage/integration": "^1.14.0-next.0",
68
69
  "@backstage/integration-react": "^1.1.30-next.0",
69
70
  "@backstage/plugin-auth-react": "^0.1.5-next.0",
70
- "@backstage/plugin-catalog-react": "^1.12.3-next.0",
71
- "@backstage/plugin-search-common": "^1.2.13",
72
- "@backstage/plugin-search-react": "^1.7.14-next.0",
71
+ "@backstage/plugin-catalog-react": "^1.12.3-next.1",
72
+ "@backstage/plugin-search-common": "^1.2.14-next.0",
73
+ "@backstage/plugin-search-react": "^1.7.14-next.1",
74
+ "@backstage/plugin-techdocs-common": "^0.1.0-next.0",
73
75
  "@backstage/plugin-techdocs-react": "^1.2.7-next.0",
74
76
  "@backstage/theme": "^0.5.6",
75
77
  "@material-ui/core": "^4.12.2",
@@ -86,11 +88,11 @@
86
88
  "react-use": "^17.2.4"
87
89
  },
88
90
  "devDependencies": {
89
- "@backstage/cli": "^0.27.0-next.0",
90
- "@backstage/core-app-api": "^1.14.1-next.0",
91
- "@backstage/dev-utils": "^1.0.36-next.0",
91
+ "@backstage/cli": "^0.27.0-next.1",
92
+ "@backstage/core-app-api": "^1.14.2-next.0",
93
+ "@backstage/dev-utils": "^1.0.37-next.1",
92
94
  "@backstage/plugin-techdocs-module-addons-contrib": "^1.1.13-next.0",
93
- "@backstage/test-utils": "^1.5.9-next.0",
95
+ "@backstage/test-utils": "^1.5.10-next.1",
94
96
  "@testing-library/dom": "^10.0.0",
95
97
  "@testing-library/jest-dom": "^6.0.0",
96
98
  "@testing-library/react": "^15.0.0",