@techdocs/cli 1.8.10-next.0 → 1.8.11-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,13 @@
1
1
  # @techdocs/cli
2
2
 
3
+ ## 1.8.11-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/backend-common@0.22.0-next.1
9
+ - @backstage/plugin-techdocs-node@1.12.4-next.1
10
+
3
11
  ## 1.8.10-next.0
4
12
 
5
13
  ### Patch Changes
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Backstage is an open source framework for building developer portals"/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.ico"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/><title>Techdocs Preview App</title><meta name="backstage-app-mode" content="public"><script defer="defer" src="/static/runtime.288f262b.js"></script><script defer="defer" src="/static/module-material-ui.1eefc717.js"></script><script defer="defer" src="/static/module-lodash.1a2b8e11.js"></script><script defer="defer" src="/static/module-date-fns.196adaa7.js"></script><script defer="defer" src="/static/module-mui.3056800b.js"></script><script defer="defer" src="/static/module-material-table.892da5bc.js"></script><script defer="defer" src="/static/module-react-dom.3e65b8bc.js"></script><script defer="defer" src="/static/module-react-router.07ec2a81.js"></script><script defer="defer" src="/static/module-react-router-dom.ba9d01bf.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.8a51ed97.js"></script><script defer="defer" src="/static/module-zod.955be94f.js"></script><script defer="defer" src="/static/module-i18next.40b7c233.js"></script><script defer="defer" src="/static/vendor.288f262b.js"></script><script defer="defer" src="/static/main.288f262b.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Backstage is an open source framework for building developer portals"/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.ico"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/><title>Techdocs Preview App</title><meta name="backstage-app-mode" content="public"><script defer="defer" src="/static/runtime.a5f4ad6c.js"></script><script defer="defer" src="/static/module-material-ui.1eefc717.js"></script><script defer="defer" src="/static/module-lodash.1a2b8e11.js"></script><script defer="defer" src="/static/module-date-fns.196adaa7.js"></script><script defer="defer" src="/static/module-mui.3056800b.js"></script><script defer="defer" src="/static/module-material-table.892da5bc.js"></script><script defer="defer" src="/static/module-react-dom.3e65b8bc.js"></script><script defer="defer" src="/static/module-react-router.07ec2a81.js"></script><script defer="defer" src="/static/module-react-router-dom.ba9d01bf.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.8a51ed97.js"></script><script defer="defer" src="/static/module-zod.955be94f.js"></script><script defer="defer" src="/static/module-i18next.40b7c233.js"></script><script defer="defer" src="/static/vendor.a5f4ad6c.js"></script><script defer="defer" src="/static/main.a5f4ad6c.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
@@ -1,3 +1,3 @@
1
1
  "use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[4487],{94487:function(dt,j,e){e.r(j),e.d(j,{TechDocsCustomHome:function(){return rt}});var a=e(31085),m=e(14041),A=e(73466),v=e(58837),I=e(51372),P=e(6820),h=e(72427),B=e(16009),R=e(67871);function H(){const t=(0,h.gf)(B.K),{loading:o,value:n}=(0,A.A)(async()=>{const{ownershipEntityRefs:r}=await t.getBackstageIdentity();return r},[]),s=(0,m.useMemo)(()=>{const r=new Set(n!=null?n:[]);return u=>{const l=(0,R.t)(u,I.vv).map(P.U2);for(const i of l)if(r.has(i))return!0;return!1}},[n]);return{loading:o,isOwnedEntity:s}}var b=e(7341),D=e(86519),E=e(27125),O=e(82779),p=e(95768),W=e(9222),N=e(65461),f=e(10394),S=e(12398);const U=t=>(0,S.A)({root:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(22em, 1fr))",gridAutoRows:"1fr",gridGap:t.spacing(2)}}),G=(0,v.A)(U,{name:"BackstageItemCardGrid"});function L(t){const{children:o,...n}=t,s=G(n);return(0,a.jsx)(f.A,{className:s.root,...n,children:o})}var T=e(72501);const V=t=>(0,S.A)({root:{color:t.palette.common.white,padding:t.spacing(2,2,3),backgroundImage:t.getPageTheme({themeId:"card"}).backgroundImage,backgroundPosition:0,backgroundSize:"inherit"}}),z=(0,v.A)(V,{name:"BackstageItemCardHeader"});function F(t){const{title:o,subtitle:n,children:s}=t,r=z(t);return(0,a.jsxs)(f.A,{className:r.root,children:[n&&(0,a.jsx)(T.A,{variant:"subtitle2",component:"h3",children:n}),o&&(0,a.jsx)(T.A,{variant:"h6",component:"h4",children:o}),s]})}var M=e(73896),K=e(40703),Y=e(59469),$=e(48653),J=e(57369);const Q=t=>{const{entities:o}=t,n=(0,W.S)(O.Oc),s=(0,h.gf)(N.U);return o?(0,a.jsx)(L,{"data-testid":"docs-explore",children:o!=null&&o.length?o.map((r,u)=>{var l,i;return(0,a.jsxs)(K.A,{children:[(0,a.jsx)(J.A,{children:(0,a.jsx)(F,{title:(l=r.metadata.title)!==null&&l!==void 0?l:r.metadata.name})}),(0,a.jsx)($.A,{children:r.metadata.description}),(0,a.jsx)(Y.A,{children:(0,a.jsx)(M.z,{to:n({namespace:(0,p.V)((i=r.metadata.namespace)!==null&&i!==void 0?i:"default",s),kind:(0,p.V)(r.kind,s),name:(0,p.V)(r.metadata.name,s)}),color:"primary","data-testid":"read_docs",children:"Read Docs"})})]},u)}):null}):null};var x=e(81859),X=e(59428),Z=e(27586),y=e(26280),k=e(68146),w=e(88640),q=e(77310),_=e(38605),tt=e(31653),et=e(72072);const at=(0,v.A)(t=>({tabsWrapper:{gridArea:"pageSubheader",backgroundColor:t.palette.background.paper,paddingLeft:t.spacing(3),minWidth:0},defaultTab:{...t.typography.caption,padding:t.spacing(3,3),textTransform:"uppercase",fontWeight:t.typography.fontWeightBold,color:t.palette.text.secondary},selected:{color:t.palette.text.primary},tabRoot:{"&:hover":{backgroundColor:t.palette.background.default,color:t.palette.text.primary}}}),{name:"BackstageHeaderTabs"});function nt(t){const{tabs:o,onChange:n,selectedIndex:s}=t,[r,u]=(0,m.useState)(s!=null?s:0),l=at(),i=(0,m.useCallback)((d,c)=>{s===void 0&&u(c),n&&n(c)},[s,n]);(0,m.useEffect)(()=>{s!==void 0&&u(s)},[s]);function g(d){return d.replace(/^\//,"")}return(0,a.jsx)(f.A,{className:l.tabsWrapper,children:(0,a.jsx)(tt.A,{indicatorColor:"primary",textColor:"inherit",variant:"scrollable",scrollButtons:"auto","aria-label":"tabs",onChange:i,value:r,children:o.map((d,c)=>(0,a.jsx)(_.A,{"data-testid":`header-tab-${c}`,label:d.label,component:et.N_,to:g(d.id),value:c,className:l.defaultTab,classes:{selected:l.selected,root:l.tabRoot},...d.tabProps},d.id))})})}const st={DocsTable:E.o,DocsCardGrid:Q},ot=({config:t,entities:o,index:n})=>{const r=(0,v.A)({panelContainer:{marginBottom:"2rem",...t.panelCSS?t.panelCSS:{}}})(),{loading:u,isOwnedEntity:l}=H(),i=st[t.panelType],g=o.filter(d=>t.filterPredicate==="ownedByUser"?u?!1:l(d):typeof t.filterPredicate=="function"&&t.filterPredicate(d));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(X.d,{title:t.title,description:t.description,children:n===0?(0,a.jsx)(Z.Y,{children:"Discover documentation in your ecosystem."}):null}),(0,a.jsx)("div",{className:r.panelContainer,children:(0,a.jsx)(i,{"data-testid":"techdocs-custom-panel",entities:g})})]})},rt=t=>{const{tabsConfig:o}=t,[n,s]=(0,m.useState)(0),r=(0,h.gf)(b.v),{value:u,loading:l,error:i}=(0,A.A)(async()=>(await r.getEntities({filter:{"metadata.annotations.backstage.io/techdocs-ref":D.c},fields:["apiVersion","kind","metadata","relations","spec.owner","spec.type"]})).items.filter(c=>{var C;return!!(!((C=c.metadata.annotations)===null||C===void 0)&&C["backstage.io/techdocs-ref"])})),g=o[n];return l?(0,a.jsx)(x.S,{children:(0,a.jsx)(y.U,{children:(0,a.jsx)(k.k,{})})}):i?(0,a.jsx)(x.S,{children:(0,a.jsx)(y.U,{children:(0,a.jsx)(w.B,{severity:"error",title:"Could not load available documentation.",children:(0,a.jsx)(q.z,{language:"text",text:i.toString()})})})}):(0,a.jsxs)(x.S,{children:[(0,a.jsx)(nt,{selectedIndex:n,onChange:d=>s(d),tabs:o.map(({label:d},c)=>({id:c.toString(),label:d}))}),(0,a.jsx)(y.U,{"data-testid":"techdocs-content",children:g.panels.map((d,c)=>(0,a.jsx)(ot,{config:d,entities:u||[],index:c},c))})]})}}}]);})();
2
2
 
3
- //# sourceMappingURL=4487.06c23d1b.chunk.js.map
3
+ //# sourceMappingURL=4487.8a9c8ef0.chunk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"static/4487.06c23d1b.chunk.js","mappings":"mTAoCO,SAASA,GAAAA,CAId,MAAMC,KAAcC,EAAAA,IAAOC,EAAAA,CAAcA,EAGnC,CAAEC,QAAAA,EAASC,MAAOC,CAAK,KAAIC,EAAAA,GAC/B,UACE,KAAM,CAAEC,oBAAAA,CAAoB,EAAI,MAAMP,EAAYQ,qBAAqB,EACvE,OAAOD,C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ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ItemCard/ItemCardGrid.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ItemCard/ItemCardHeader.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/Grids/DocsCardGrid.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/HeaderTabs/HeaderTabs.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/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 {\n Entity,\n RELATION_OWNED_BY,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { getEntityRelations } from '../utils/getEntityRelations';\n\n/**\n * Returns a function that checks whether the currently signed-in user is an\n * owner of a given entity. When the hook is initially mounted, the loading\n * flag will be true and the results returned from the function will always be\n * false.\n *\n * @public\n *\n * @returns a function that checks if the signed in user owns an entity\n */\nexport function useEntityOwnership(): {\n loading: boolean;\n isOwnedEntity: (entity: Entity) => boolean;\n} {\n const identityApi = useApi(identityApiRef);\n\n // Trigger load only on mount\n const { loading, value: refs } = useAsync(\n async () => {\n const { ownershipEntityRefs } = await identityApi.getBackstageIdentity();\n return ownershipEntityRefs;\n },\n // load only on mount\n [],\n );\n\n const isOwnedEntity = useMemo(() => {\n const myOwnerRefs = new Set(refs ?? []);\n\n return (entity: Entity) => {\n const entityOwnerRefs = getEntityRelations(entity, RELATION_OWNED_BY).map(\n stringifyEntityRef,\n );\n for (const ref of entityOwnerRefs) {\n if (myOwnerRefs.has(ref)) {\n return true;\n }\n }\n return false;\n };\n }, [refs]);\n\n return { loading, isOwnedEntity };\n}\n","/*\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 */\nimport Box from '@material-ui/core/Box';\nimport {\n createStyles,\n makeStyles,\n Theme,\n WithStyles,\n} from '@material-ui/core/styles';\nimport React from 'react';\n\n/** @public */\nexport type ItemCardGridClassKey = 'root';\n\nconst styles = (theme: Theme) =>\n createStyles({\n root: {\n display: 'grid',\n gridTemplateColumns: 'repeat(auto-fill, minmax(22em, 1fr))',\n gridAutoRows: '1fr',\n gridGap: theme.spacing(2),\n },\n });\n\nconst useStyles = makeStyles(styles, { name: 'BackstageItemCardGrid' });\n\n/** @public */\nexport type ItemCardGridProps = Partial<WithStyles<typeof styles>> & {\n /**\n * The Card items of the grid.\n */\n children?: React.ReactNode;\n};\n\n/**\n * A default grid to use when arranging \"item cards\" - cards that let users\n * select among several options.\n *\n * @remarks\n * The immediate children are expected to be Material UI Card components.\n *\n * Styles for the grid can be overridden using the `classes` prop, e.g.:\n *\n * `<ItemCardGrid title=\"Hello\" classes={{ root: myClassName }} />`\n *\n * This can be useful for e.g. overriding gridTemplateColumns to adapt the\n * minimum size of the cells to fit the content better.\n *\n * @public\n */\nexport function ItemCardGrid(props: ItemCardGridProps) {\n const { children, ...otherProps } = props;\n const classes = useStyles(otherProps);\n return (\n <Box className={classes.root} {...otherProps}>\n {children}\n </Box>\n );\n}\n","/*\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 Box from '@material-ui/core/Box';\nimport {\n createStyles,\n makeStyles,\n Theme,\n WithStyles,\n} from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\n\n/** @public */\nexport type ItemCardHeaderClassKey = 'root';\n\nconst styles = (theme: Theme) =>\n createStyles({\n root: {\n color: theme.palette.common.white,\n padding: theme.spacing(2, 2, 3),\n backgroundImage: theme.getPageTheme({ themeId: 'card' }).backgroundImage,\n backgroundPosition: 0,\n backgroundSize: 'inherit',\n },\n });\n\nconst useStyles = makeStyles(styles, { name: 'BackstageItemCardHeader' });\n\n/** @public */\nexport type ItemCardHeaderProps = Partial<WithStyles<typeof styles>> & {\n /**\n * A large title to show in the header, providing the main heading.\n *\n * Use this if you want to have the default styling and placement of a title.\n */\n title?: React.ReactNode;\n /**\n * A slightly smaller title to show in the header, providing additional\n * details.\n *\n * Use this if you want to have the default styling and placement of a\n * subtitle.\n */\n subtitle?: React.ReactNode;\n /**\n * Custom children to draw in the header.\n *\n * If the title and/or subtitle were specified, the children are drawn below\n * those.\n */\n children?: React.ReactNode;\n};\n\n/**\n * A simple card header, rendering a default look for \"item cards\" - cards that\n * are arranged in a grid for users to select among several options.\n *\n * @remarks\n * This component expects to be placed within a Material UI `<CardMedia>`.\n *\n * Styles for the header can be overridden using the `classes` prop, e.g.:\n *\n * `<ItemCardHeader title=\"Hello\" classes={{ root: myClassName }} />`\n *\n * @public\n */\nexport function ItemCardHeader(props: ItemCardHeaderProps) {\n const { title, subtitle, children } = props;\n const classes = useStyles(props);\n return (\n <Box className={classes.root}>\n {subtitle && (\n <Typography variant=\"subtitle2\" component=\"h3\">\n {subtitle}\n </Typography>\n )}\n {title && (\n <Typography variant=\"h6\" component=\"h4\">\n {title}\n </Typography>\n )}\n {children}\n </Box>\n );\n}\n","/*\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 { rootDocsRouteRef } from '../../../routes';\nimport { toLowerMaybe } from '../../../helpers';\nimport { Entity } from '@backstage/catalog-model';\nimport { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';\nimport {\n LinkButton,\n ItemCardGrid,\n ItemCardHeader,\n} from '@backstage/core-components';\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 React from 'react';\n\n/**\n * Props for {@link DocsCardGrid}\n *\n * @public\n */\nexport type DocsCardGridProps = {\n entities: Entity[] | undefined;\n};\n\n/**\n * Component which accepts a list of entities and renders a item card for each entity\n *\n * @public\n */\nexport const DocsCardGrid = (props: DocsCardGridProps) => {\n const { entities } = props;\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n if (!entities) return null;\n return (\n <ItemCardGrid data-testid=\"docs-explore\">\n {!entities?.length\n ? null\n : entities.map((entity, index: number) => (\n <Card key={index}>\n <CardMedia>\n <ItemCardHeader\n title={entity.metadata.title ?? entity.metadata.name}\n />\n </CardMedia>\n <CardContent>{entity.metadata.description}</CardContent>\n <CardActions>\n <LinkButton\n to={getRouteToReaderPageFor({\n namespace: toLowerMaybe(\n entity.metadata.namespace ?? 'default',\n config,\n ),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n })}\n color=\"primary\"\n data-testid=\"read_docs\"\n >\n Read Docs\n </LinkButton>\n </CardActions>\n </Card>\n ))}\n </ItemCardGrid>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Box from '@material-ui/core/Box';\nimport { makeStyles } from '@material-ui/core/styles';\nimport TabUI, { TabProps } from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { Link } from '@backstage/core-components';\n\n// TODO(blam): Remove this implementation when the Tabs are ready\n// This is just a temporary solution to implementing tabs for now\n\n/** @public */\nexport type HeaderTabsClassKey =\n | 'tabsWrapper'\n | 'defaultTab'\n | 'selected'\n | 'tabRoot';\n\nconst useStyles = makeStyles(\n theme => ({\n tabsWrapper: {\n gridArea: 'pageSubheader',\n backgroundColor: theme.palette.background.paper,\n paddingLeft: theme.spacing(3),\n minWidth: 0,\n },\n defaultTab: {\n ...theme.typography.caption,\n padding: theme.spacing(3, 3),\n textTransform: 'uppercase',\n fontWeight: theme.typography.fontWeightBold,\n color: theme.palette.text.secondary,\n },\n selected: {\n color: theme.palette.text.primary,\n },\n tabRoot: {\n '&:hover': {\n backgroundColor: theme.palette.background.default,\n color: theme.palette.text.primary,\n },\n },\n }),\n { name: 'BackstageHeaderTabs' },\n);\n\nexport type Tab = {\n id: string;\n label: string;\n tabProps?: TabProps<React.ElementType, { component?: React.ElementType }>;\n};\n\ntype HeaderTabsProps = {\n tabs: Tab[];\n onChange?: (index: number) => void;\n selectedIndex?: number;\n};\n\n/**\n * Horizontal Tabs component\n *\n * @public\n *\n */\nexport function HeaderTabs(props: HeaderTabsProps) {\n const { tabs, onChange, selectedIndex } = props;\n const [selectedTab, setSelectedTab] = useState<number>(selectedIndex ?? 0);\n const styles = useStyles();\n\n const handleChange = useCallback(\n (_: React.ChangeEvent<{}>, index: number) => {\n if (selectedIndex === undefined) {\n setSelectedTab(index);\n }\n if (onChange) onChange(index);\n },\n [selectedIndex, onChange],\n );\n\n useEffect(() => {\n if (selectedIndex !== undefined) {\n setSelectedTab(selectedIndex);\n }\n }, [selectedIndex]);\n function removeLeadingSlash(path: string) {\n return path.replace(/^\\//, '');\n }\n return (\n <Box className={styles.tabsWrapper}>\n <Tabs\n indicatorColor=\"primary\"\n textColor=\"inherit\"\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n aria-label=\"tabs\"\n onChange={handleChange}\n value={selectedTab}\n >\n {tabs.map((tab, index) => (\n <TabUI\n data-testid={`header-tab-${index}`}\n label={tab.label}\n key={tab.id}\n component={Link}\n to={removeLeadingSlash(tab.id)}\n value={index}\n className={styles.defaultTab}\n classes={{ selected: styles.selected, root: styles.tabRoot }}\n {...tab.tabProps}\n />\n ))}\n </Tabs>\n </Box>\n );\n}\n","/*\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":["useEntityOwnership","identityApi","useApi","identityApiRef","loading","value","refs","useAsync","ownershipEntityRefs","getBackstageIdentity","isOwnedEntity","useMemo","myOwnerRefs","Set","entity","entityOwnerRefs","getEntityRelations","RELATION_OWNED_BY","map","stringifyEntityRef","ref","has","styles","theme","createStyles","root","display","gridTemplateColumns","gridAutoRows","gridGap","spacing","useStyles","makeStyles","name","ItemCardGrid","props","children","otherProps","classes","Box","className","color","palette","common","white","padding","backgroundImage","getPageTheme","themeId","backgroundPosition","backgroundSize","ItemCardHeader","title","subtitle","Typography","variant","component","DocsCardGrid","entities","getRouteToReaderPageFor","useRouteRef","rootDocsRouteRef","config","configApiRef","data-testid","length","index","Card","CardMedia","metadata","CardContent","description","CardActions","LinkButton","to","namespace","toLowerMaybe","kind","tabsWrapper","gridArea","backgroundColor","background","paper","paddingLeft","minWidth","defaultTab","typography","caption","textTransform","fontWeight","fontWeightBold","text","secondary","selected","primary","tabRoot","default","HeaderTabs","tabs","onChange","selectedIndex","selectedTab","setSelectedTab","useState","handleChange","useCallback","_","undefined","useEffect","removeLeadingSlash","path","replace","Tabs","indicatorColor","textColor","scrollButtons","aria-label","tab","TabUI","label","Link","id","tabProps","panels","DocsTable","CustomPanel","panelContainer","marginBottom","panelCSS","loadingOwnership","Panel","panelType","shownEntities","filter","filterPredicate","ContentHeader","SupportButton","div","TechDocsCustomHome","tabsConfig","catalogApi","catalogApiRef","error","getEntities","CATALOG_FILTER_EXISTS","fields","items","annotations","currentTabConfig","TechDocsPageWrapper","Content","Progress","WarningPanel","severity","CodeSnippet","language","toString"],"sourceRoot":""}
1
+ {"version":3,"file":"static/4487.8a9c8ef0.chunk.js","mappings":"mTAoCO,SAASA,GAAAA,CAId,MAAMC,KAAcC,EAAAA,IAAOC,EAAAA,CAAcA,EAGnC,CAAEC,QAAAA,EAASC,MAAOC,CAAK,KAAIC,EAAAA,GAC/B,UACE,KAAM,CAAEC,oBAAAA,CAAoB,EAAI,MAAMP,EAAYQ,qBAAqB,EACvE,OAAOD,CACT,EAEA,CAAC,CAAC,EAGEE,KAAgBC,EAAAA,SAAQ,KAC5B,MAAMC,EAAc,IAAIC,IAAIP,GAAAA,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,GAAS,UACM,MAAMqI,EAAWG,YAAY,CAC5CV,OAAQ,CACN,iDAAkDW,EAAAA,CACpD,EACAC,OAAQ,CACN,aACA,OACA,WACA,YACA,aACA,W,CAEJ,CAAC,GACeC,MAAMb,OAAQvH,GAAAA,C,IACnBA,EAAT,MAAO,CAAC,EAACA,GAAAA,EAAAA,EAAOuD,SAAS8E,eAAW,MAA3BrI,IAAAA,SAAAA,EAA8B,2BAA2B,EACpE,CAAC,CACF,EAEKsI,EAAmBT,EAAWtC,CAAW,EAE/C,OAAIjG,KAEA,OAACiJ,EAAAA,EAAmBA,C,YAClB,OAACC,EAAAA,EAAOA,C,YACN,OAACC,EAAAA,EAAQA,CAAAA,CAAAA,C,KAMbT,KAEA,OAACO,EAAAA,EAAmBA,C,YAClB,OAACC,EAAAA,EAAOA,C,YACN,OAACE,EAAAA,EAAYA,CACXC,SAAS,QACTrG,MAAM,0C,YAEN,OAACsG,EAAAA,EAAWA,CAACC,SAAS,OAAOhE,KAAMmD,EAAMc,SAAS,C,YAQ1D,QAACP,EAAAA,EAAmBA,C,aAClB,OAACpD,GAAUA,CACTG,cAAeC,EACfF,SAAUjC,GAASoC,EAAepC,CAAK,EACvCgC,KAAMyC,EAAWzH,IAAI,CAAC,CAAEqG,MAAAA,CAAM,EAAGrD,KAAW,CAC1CuD,GAAIvD,EAAM0F,SAAS,EACnBrC,MAAAA,CACF,EAAE,C,MAEJ,OAAC+B,EAAAA,EAAOA,CAACtF,cAAY,mB,SAClBoF,EAAiBzB,OAAOzG,IAAI,CAAC4C,EAAQI,OACpC,OAAC2D,GAAAA,CAEC/D,OAAQA,EACRJ,SAAYA,GAAsB,CAAC,EACnCQ,MAAOA,C,EAHFA,CAAK,CAALA,C,KASjB,C","sources":["webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/hooks/useEntityOwnership.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ItemCard/ItemCardGrid.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ItemCard/ItemCardHeader.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/Grids/DocsCardGrid.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/HeaderTabs/HeaderTabs.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/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 {\n Entity,\n RELATION_OWNED_BY,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { getEntityRelations } from '../utils/getEntityRelations';\n\n/**\n * Returns a function that checks whether the currently signed-in user is an\n * owner of a given entity. When the hook is initially mounted, the loading\n * flag will be true and the results returned from the function will always be\n * false.\n *\n * @public\n *\n * @returns a function that checks if the signed in user owns an entity\n */\nexport function useEntityOwnership(): {\n loading: boolean;\n isOwnedEntity: (entity: Entity) => boolean;\n} {\n const identityApi = useApi(identityApiRef);\n\n // Trigger load only on mount\n const { loading, value: refs } = useAsync(\n async () => {\n const { ownershipEntityRefs } = await identityApi.getBackstageIdentity();\n return ownershipEntityRefs;\n },\n // load only on mount\n [],\n );\n\n const isOwnedEntity = useMemo(() => {\n const myOwnerRefs = new Set(refs ?? []);\n\n return (entity: Entity) => {\n const entityOwnerRefs = getEntityRelations(entity, RELATION_OWNED_BY).map(\n stringifyEntityRef,\n );\n for (const ref of entityOwnerRefs) {\n if (myOwnerRefs.has(ref)) {\n return true;\n }\n }\n return false;\n };\n }, [refs]);\n\n return { loading, isOwnedEntity };\n}\n","/*\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 */\nimport Box from '@material-ui/core/Box';\nimport {\n createStyles,\n makeStyles,\n Theme,\n WithStyles,\n} from '@material-ui/core/styles';\nimport React from 'react';\n\n/** @public */\nexport type ItemCardGridClassKey = 'root';\n\nconst styles = (theme: Theme) =>\n createStyles({\n root: {\n display: 'grid',\n gridTemplateColumns: 'repeat(auto-fill, minmax(22em, 1fr))',\n gridAutoRows: '1fr',\n gridGap: theme.spacing(2),\n },\n });\n\nconst useStyles = makeStyles(styles, { name: 'BackstageItemCardGrid' });\n\n/** @public */\nexport type ItemCardGridProps = Partial<WithStyles<typeof styles>> & {\n /**\n * The Card items of the grid.\n */\n children?: React.ReactNode;\n};\n\n/**\n * A default grid to use when arranging \"item cards\" - cards that let users\n * select among several options.\n *\n * @remarks\n * The immediate children are expected to be Material UI Card components.\n *\n * Styles for the grid can be overridden using the `classes` prop, e.g.:\n *\n * `<ItemCardGrid title=\"Hello\" classes={{ root: myClassName }} />`\n *\n * This can be useful for e.g. overriding gridTemplateColumns to adapt the\n * minimum size of the cells to fit the content better.\n *\n * @public\n */\nexport function ItemCardGrid(props: ItemCardGridProps) {\n const { children, ...otherProps } = props;\n const classes = useStyles(otherProps);\n return (\n <Box className={classes.root} {...otherProps}>\n {children}\n </Box>\n );\n}\n","/*\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 Box from '@material-ui/core/Box';\nimport {\n createStyles,\n makeStyles,\n Theme,\n WithStyles,\n} from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\n\n/** @public */\nexport type ItemCardHeaderClassKey = 'root';\n\nconst styles = (theme: Theme) =>\n createStyles({\n root: {\n color: theme.palette.common.white,\n padding: theme.spacing(2, 2, 3),\n backgroundImage: theme.getPageTheme({ themeId: 'card' }).backgroundImage,\n backgroundPosition: 0,\n backgroundSize: 'inherit',\n },\n });\n\nconst useStyles = makeStyles(styles, { name: 'BackstageItemCardHeader' });\n\n/** @public */\nexport type ItemCardHeaderProps = Partial<WithStyles<typeof styles>> & {\n /**\n * A large title to show in the header, providing the main heading.\n *\n * Use this if you want to have the default styling and placement of a title.\n */\n title?: React.ReactNode;\n /**\n * A slightly smaller title to show in the header, providing additional\n * details.\n *\n * Use this if you want to have the default styling and placement of a\n * subtitle.\n */\n subtitle?: React.ReactNode;\n /**\n * Custom children to draw in the header.\n *\n * If the title and/or subtitle were specified, the children are drawn below\n * those.\n */\n children?: React.ReactNode;\n};\n\n/**\n * A simple card header, rendering a default look for \"item cards\" - cards that\n * are arranged in a grid for users to select among several options.\n *\n * @remarks\n * This component expects to be placed within a Material UI `<CardMedia>`.\n *\n * Styles for the header can be overridden using the `classes` prop, e.g.:\n *\n * `<ItemCardHeader title=\"Hello\" classes={{ root: myClassName }} />`\n *\n * @public\n */\nexport function ItemCardHeader(props: ItemCardHeaderProps) {\n const { title, subtitle, children } = props;\n const classes = useStyles(props);\n return (\n <Box className={classes.root}>\n {subtitle && (\n <Typography variant=\"subtitle2\" component=\"h3\">\n {subtitle}\n </Typography>\n )}\n {title && (\n <Typography variant=\"h6\" component=\"h4\">\n {title}\n </Typography>\n )}\n {children}\n </Box>\n );\n}\n","/*\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 { rootDocsRouteRef } from '../../../routes';\nimport { toLowerMaybe } from '../../../helpers';\nimport { Entity } from '@backstage/catalog-model';\nimport { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';\nimport {\n LinkButton,\n ItemCardGrid,\n ItemCardHeader,\n} from '@backstage/core-components';\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 React from 'react';\n\n/**\n * Props for {@link DocsCardGrid}\n *\n * @public\n */\nexport type DocsCardGridProps = {\n entities: Entity[] | undefined;\n};\n\n/**\n * Component which accepts a list of entities and renders a item card for each entity\n *\n * @public\n */\nexport const DocsCardGrid = (props: DocsCardGridProps) => {\n const { entities } = props;\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n if (!entities) return null;\n return (\n <ItemCardGrid data-testid=\"docs-explore\">\n {!entities?.length\n ? null\n : entities.map((entity, index: number) => (\n <Card key={index}>\n <CardMedia>\n <ItemCardHeader\n title={entity.metadata.title ?? entity.metadata.name}\n />\n </CardMedia>\n <CardContent>{entity.metadata.description}</CardContent>\n <CardActions>\n <LinkButton\n to={getRouteToReaderPageFor({\n namespace: toLowerMaybe(\n entity.metadata.namespace ?? 'default',\n config,\n ),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n })}\n color=\"primary\"\n data-testid=\"read_docs\"\n >\n Read Docs\n </LinkButton>\n </CardActions>\n </Card>\n ))}\n </ItemCardGrid>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Box from '@material-ui/core/Box';\nimport { makeStyles } from '@material-ui/core/styles';\nimport TabUI, { TabProps } from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { Link } from '../../components/Link';\n\n// TODO(blam): Remove this implementation when the Tabs are ready\n// This is just a temporary solution to implementing tabs for now\n\n/** @public */\nexport type HeaderTabsClassKey =\n | 'tabsWrapper'\n | 'defaultTab'\n | 'selected'\n | 'tabRoot';\n\nconst useStyles = makeStyles(\n theme => ({\n tabsWrapper: {\n gridArea: 'pageSubheader',\n backgroundColor: theme.palette.background.paper,\n paddingLeft: theme.spacing(3),\n minWidth: 0,\n },\n defaultTab: {\n ...theme.typography.caption,\n padding: theme.spacing(3, 3),\n textTransform: 'uppercase',\n fontWeight: theme.typography.fontWeightBold,\n color: theme.palette.text.secondary,\n },\n selected: {\n color: theme.palette.text.primary,\n },\n tabRoot: {\n '&:hover': {\n backgroundColor: theme.palette.background.default,\n color: theme.palette.text.primary,\n },\n },\n }),\n { name: 'BackstageHeaderTabs' },\n);\n\nexport type Tab = {\n id: string;\n label: string;\n tabProps?: TabProps<React.ElementType, { component?: React.ElementType }>;\n};\n\ntype HeaderTabsProps = {\n tabs: Tab[];\n onChange?: (index: number) => void;\n selectedIndex?: number;\n};\n\n/**\n * Horizontal Tabs component\n *\n * @public\n *\n */\nexport function HeaderTabs(props: HeaderTabsProps) {\n const { tabs, onChange, selectedIndex } = props;\n const [selectedTab, setSelectedTab] = useState<number>(selectedIndex ?? 0);\n const styles = useStyles();\n\n const handleChange = useCallback(\n (_: React.ChangeEvent<{}>, index: number) => {\n if (selectedIndex === undefined) {\n setSelectedTab(index);\n }\n if (onChange) onChange(index);\n },\n [selectedIndex, onChange],\n );\n\n useEffect(() => {\n if (selectedIndex !== undefined) {\n setSelectedTab(selectedIndex);\n }\n }, [selectedIndex]);\n function removeLeadingSlash(path: string) {\n return path.replace(/^\\//, '');\n }\n return (\n <Box className={styles.tabsWrapper}>\n <Tabs\n indicatorColor=\"primary\"\n textColor=\"inherit\"\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n aria-label=\"tabs\"\n onChange={handleChange}\n value={selectedTab}\n >\n {tabs.map((tab, index) => (\n <TabUI\n data-testid={`header-tab-${index}`}\n label={tab.label}\n key={tab.id}\n component={Link}\n to={removeLeadingSlash(tab.id)}\n value={index}\n className={styles.defaultTab}\n classes={{ selected: styles.selected, root: styles.tabRoot }}\n {...tab.tabProps}\n />\n ))}\n </Tabs>\n </Box>\n );\n}\n","/*\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":["useEntityOwnership","identityApi","useApi","identityApiRef","loading","value","refs","useAsync","ownershipEntityRefs","getBackstageIdentity","isOwnedEntity","useMemo","myOwnerRefs","Set","entity","entityOwnerRefs","getEntityRelations","RELATION_OWNED_BY","map","stringifyEntityRef","ref","has","styles","theme","createStyles","root","display","gridTemplateColumns","gridAutoRows","gridGap","spacing","useStyles","makeStyles","name","ItemCardGrid","props","children","otherProps","classes","Box","className","color","palette","common","white","padding","backgroundImage","getPageTheme","themeId","backgroundPosition","backgroundSize","ItemCardHeader","title","subtitle","Typography","variant","component","DocsCardGrid","entities","getRouteToReaderPageFor","useRouteRef","rootDocsRouteRef","config","configApiRef","data-testid","length","index","Card","CardMedia","metadata","CardContent","description","CardActions","LinkButton","to","namespace","toLowerMaybe","kind","tabsWrapper","gridArea","backgroundColor","background","paper","paddingLeft","minWidth","defaultTab","typography","caption","textTransform","fontWeight","fontWeightBold","text","secondary","selected","primary","tabRoot","default","HeaderTabs","tabs","onChange","selectedIndex","selectedTab","setSelectedTab","useState","handleChange","useCallback","_","undefined","useEffect","removeLeadingSlash","path","replace","Tabs","indicatorColor","textColor","scrollButtons","aria-label","tab","TabUI","label","Link","id","tabProps","panels","DocsTable","CustomPanel","panelContainer","marginBottom","panelCSS","loadingOwnership","Panel","panelType","shownEntities","filter","filterPredicate","ContentHeader","SupportButton","div","TechDocsCustomHome","tabsConfig","catalogApi","catalogApiRef","error","getEntities","CATALOG_FILTER_EXISTS","fields","items","annotations","currentTabConfig","TechDocsPageWrapper","Content","Progress","WarningPanel","severity","CodeSnippet","language","toString"],"sourceRoot":""}
@@ -1,3 +1,3 @@
1
- "use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[73],{60413:function(Q,C,e){e.d(C,{C4:function(){return x},tS:function(){return U}});function t({name:T,attributes:p,resourceType:c}){return c?{type:"resource",name:T,attributes:p,resourceType:c}:{type:"basic",name:T,attributes:p}}const b="catalog-entity",R=t({name:"catalog.entity.read",attributes:{action:"read"},resourceType:b}),x=t({name:"catalog.entity.create",attributes:{action:"create"}}),k=t({name:"catalog.entity.delete",attributes:{action:"delete"},resourceType:b}),U=t({name:"catalog.entity.refresh",attributes:{action:"update"},resourceType:b}),$=t({name:"catalog.location.read",attributes:{action:"read"}}),O=t({name:"catalog.location.create",attributes:{action:"create"}}),N=t({name:"catalog.location.delete",attributes:{action:"delete"}}),A=[R,x,k,U,$,O,N]},99538:function(Q,C,e){e.d(C,{T7:function(){return O},TY:function(){return T},tN:function(){return A}});var t=e(31085),b=e(6820),R=e(25862),x=e(43836),k=e(10602),U=e(14041);const $=(0,x.tK)("entity-context"),O=p=>{const{children:c,entity:u,loading:v,error:m,refresh:y}=p,g={entity:u,loading:v,error:m,refresh:y};return(0,t.jsx)($.Provider,{value:(0,k.B)({1:g}),children:(0,t.jsx)(R.Ig,{attributes:{...u?{entityRef:(0,b.U2)(u)}:void 0},children:c})})},N=p=>_jsx(O,{entity:p.entity,loading:!p.entity,error:void 0,refresh:void 0,children:p.children});function A(){const p=(0,x.qO)("entity-context");if(!p)throw new Error("Entity context is not available");const c=p.atVersion(1);if(!c)throw new Error("EntityContext v1 not available");if(!c.entity)throw new Error("useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.");return{entity:c.entity}}function T(){const p=(0,x.qO)("entity-context");if(!p)throw new Error("Entity context is not available");const c=p.atVersion(1);if(!c)throw new Error("EntityContext v1 not available");const{entity:u,loading:v,error:m,refresh:y}=c;return{entity:u,loading:v,error:m,refresh:y}}},40073:function(Q,C,e){e.r(C),e.d(C,{AboutCard:function(){return nt},AboutContent:function(){return fe},AboutField:function(){return I}});var t=e(31085),b=e(72348),R=e(17736),x=e(6820),k=e(40703),U=e(48653),$=e(45685),O=e(37197),N=e(29365),A=e(58837),T=e(72072),p=e(31129),c=e(14041),u=e(53373),v=e.n(u),m=e(86613),y=e(10394),g=e(72501);const S=(0,A.A)(i=>({link:{display:"grid",justifyItems:"center",gridGap:4,textAlign:"center"},disabled:{color:i.palette.text.secondary,cursor:"default"},primary:{color:i.palette.primary.main},secondary:{color:i.palette.secondary.main},label:{textTransform:"uppercase",fontWeight:i.typography.fontWeightBold,letterSpacing:1.2}}),{name:"BackstageIconLinkVertical"});function E({color:i="primary",disabled:a=!1,href:s="#",icon:o=(0,t.jsx)(m.A,{}),label:r,onClick:l,title:d}){const h=S();return a?(0,t.jsxs)(y.A,{title:d,className:v()(h.link,h.disabled),children:[o,(0,t.jsx)(g.A,{variant:"caption",component:"span",className:h.label,children:r})]}):(0,t.jsxs)(T.N_,{title:d,className:v()(h.link,h[i]),to:s,onClick:l,children:[o,(0,t.jsx)(g.A,{variant:"caption",component:"span",className:h.label,children:r})]})}const f=(0,A.A)(i=>({links:{margin:i.spacing(2,0),display:"grid",gridAutoFlow:"column",gridAutoColumns:"min-content",gridGap:i.spacing(3)}}),{name:"BackstageHeaderIconLinkRow"});function G(i){const{links:a}=i,s=f();return(0,t.jsx)("nav",{className:s.links,children:a.map((o,r)=>(0,t.jsx)(E,{...o},r+1))})}var ee=e(41158),ge=e(13660),le=e(82266);const ve=i=>{const{type:a}=i,s=(0,le.n)(),o=ge.A;var r;const l=a&&(r=s.getSystemIcon(a))!==null&&r!==void 0?r:o;return(0,t.jsx)(l,{})};var J=e(72427),be=e(36017),xe=e(39837),ce=e(9222),de=e(99538),pe=e(7341),me=e(78692);function Ae(i,a){var s;const o=(s=i.metadata.annotations)===null||s===void 0?void 0:s[R.I4];if(o)try{const r=(0,me.aY)(o),l=a.byUrl(r.target);return{locationTargetUrl:r.target,integrationType:l==null?void 0:l.type}}catch{return}}var ue=e(95203),X=e(51372),Z=e(67871),q=e(34428),je=e(67720),he=e(42899),Te=e(4650),Ee=e(82442);const Le=(0,A.A)(i=>({value:{fontWeight:"bold",overflow:"hidden",lineHeight:"24px",wordBreak:"break-word"},label:{color:i.palette.text.secondary,textTransform:"uppercase",fontSize:"10px",fontWeight:"bold",letterSpacing:.5,overflow:"hidden",whiteSpace:"nowrap"}}));function I(i){const{label:a,value:s,gridSizes:o,children:r}=i,l=Le(),d=(0,Ee.O)(r,j=>j.getElements()),h=d.length>0?d:(0,t.jsx)(g.A,{variant:"body2",className:l.value,children:s||"unknown"});return(0,t.jsxs)(he.A,{item:!0,...o,children:[(0,t.jsx)(g.A,{variant:"h2",className:l.label,children:a}),h]})}var Ce=e(18750);const ke=(0,A.A)({description:{wordBreak:"break-word"}});function Se(i,a,s){if(a==="url"||i.includes("://"))return i;const o=s.type==="file"?`file://${s.target}`:s.target;return a==="file"||s.type==="file"?new URL(i,o).href:o}function fe(i){var a,s,o,r,l,d,h,j;const{entity:n}=i,ne=ke(),_=n.kind.toLocaleLowerCase("en-US")==="system",F=n.kind.toLocaleLowerCase("en-US")==="resource",M=n.kind.toLocaleLowerCase("en-US")==="component",D=n.kind.toLocaleLowerCase("en-US")==="api",B=n.kind.toLocaleLowerCase("en-US")==="template",V=n.kind.toLocaleLowerCase("en-US")==="location",ie=n.kind.toLocaleLowerCase("en-US")==="group",L=(0,Z.t)(n,X.jn,{kind:"system"}),z=(0,Z.t)(n,X.jn,{kind:"component"}),P=(0,Z.t)(n,X.jn,{kind:"domain"}),H=(0,Z.t)(n,X.vv);let Y;try{Y=(0,me.Cr)(n)}catch{Y=void 0}return(0,t.jsxs)(he.A,{container:!0,children:[(0,t.jsx)(I,{label:"Description",gridSizes:{xs:12},children:(0,t.jsx)(Te.h,{className:ne.description,content:(n==null||(a=n.metadata)===null||a===void 0?void 0:a.description)||"No description"})}),(0,t.jsx)(I,{label:"Owner",value:"No Owner",gridSizes:{xs:12,sm:6,lg:4},children:H.length>0&&(0,t.jsx)(q.i,{entityRefs:H,defaultKind:"group"})}),(_||P.length>0)&&(0,t.jsx)(I,{label:"Domain",value:"No Domain",gridSizes:{xs:12,sm:6,lg:4},children:P.length>0&&(0,t.jsx)(q.i,{entityRefs:P,defaultKind:"domain"})}),(D||M||F||L.length>0)&&(0,t.jsx)(I,{label:"System",value:"No System",gridSizes:{xs:12,sm:6,lg:4},children:L.length>0&&(0,t.jsx)(q.i,{entityRefs:L,defaultKind:"system"})}),M&&z.length>0&&(0,t.jsx)(I,{label:"Parent Component",value:"No Parent Component",gridSizes:{xs:12,sm:6,lg:4},children:(0,t.jsx)(q.i,{entityRefs:z,defaultKind:"component"})}),(D||M||F||B||ie||V||typeof(n==null||(s=n.spec)===null||s===void 0?void 0:s.type)=="string")&&(0,t.jsx)(I,{label:"Type",value:n==null||(o=n.spec)===null||o===void 0?void 0:o.type,gridSizes:{xs:12,sm:6,lg:4}}),(D||M||typeof(n==null||(r=n.spec)===null||r===void 0?void 0:r.lifecycle)=="string")&&(0,t.jsx)(I,{label:"Lifecycle",value:n==null||(l=n.spec)===null||l===void 0?void 0:l.lifecycle,gridSizes:{xs:12,sm:6,lg:4}}),(0,t.jsx)(I,{label:"Tags",value:"No Tags",gridSizes:{xs:12,sm:6,lg:4},children:((n==null||(d=n.metadata)===null||d===void 0?void 0:d.tags)||[]).map(w=>(0,t.jsx)(je.A,{size:"small",label:w},w))}),V&&((n==null||(h=n.spec)===null||h===void 0?void 0:h.targets)||(n==null||(j=n.spec)===null||j===void 0?void 0:j.target))&&(0,t.jsx)(I,{label:"Targets",gridSizes:{xs:12},children:(0,t.jsx)(Ce.m,{cols:1,items:(n.spec.targets||[n.spec.target]).map(w=>w).map(w=>{var K;return{text:w,href:Se(w,(n==null||(K=n.spec)===null||K===void 0?void 0:K.type)||"unknown",Y)}})})})]})}var Ie=e(74011),Pe=e(25534),we=e(82451),Re=e(75625),Oe=e(11601),Ne=e.n(Oe),Ue=JSON.parse(`{"$schema":"http://json-schema.org/draft-07/schema","$id":"Entity","description":"The parts of the format that's common to all versions/kinds of entity.","examples":[{"apiVersion":"backstage.io/v1alpha1","kind":"Component","metadata":{"name":"LoremService","description":"Creates Lorems like a pro.","labels":{"product_name":"Random value Generator"},"annotations":{"docs":"https://github.com/..../tree/develop/doc"}},"spec":{"type":"service","lifecycle":"production","owner":"tools"}}],"type":"object","required":["apiVersion","kind","metadata"],"additionalProperties":false,"properties":{"apiVersion":{"type":"string","description":"The version of specification format for this particular entity that this is written against.","minLength":1,"examples":["backstage.io/v1alpha1","my-company.net/v1","1.0"]},"kind":{"type":"string","description":"The high level entity type being described.","minLength":1,"examples":["API","Component","Domain","Group","Location","Resource","System","Template","User"]},"metadata":{"$ref":"EntityMeta"},"spec":{"type":"object","description":"The specification data describing the entity itself."},"relations":{"type":"array","description":"The relations that this entity has with other entities.","items":{"$ref":"common#relation"}},"status":{"$ref":"common#status"}}}`),$e=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema","$id":"EntityEnvelope","description":"The envelope skeleton parts of an entity - whatever is necessary to be able to give it a ref and pass to further validation / policy checking.","examples":[{"apiVersion":"backstage.io/v1alpha1","kind":"Component","metadata":{"name":"LoremService"}}],"type":"object","required":["apiVersion","kind","metadata"],"additionalProperties":true,"properties":{"apiVersion":{"type":"string","description":"The version of specification format for this particular entity that this is written against.","minLength":1,"examples":["backstage.io/v1alpha1","my-company.net/v1","1.0"]},"kind":{"type":"string","description":"The high level entity type being described.","minLength":1,"examples":["API","Component","Domain","Group","Location","Resource","System","Template","User"]},"metadata":{"type":"object","required":["name"],"additionalProperties":true,"properties":{"name":{"type":"string","description":"The name of the entity. Must be unique within the catalog at any given point in time, for any given namespace + kind pair.","examples":["metadata-proxy"],"minLength":1},"namespace":{"type":"string","description":"The namespace that the entity belongs to.","default":"default","examples":["default","admin"],"minLength":1}}}}}'),De=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema","$id":"EntityMeta","description":"Metadata fields common to all versions/kinds of entity.","examples":[{"uid":"e01199ab-08cc-44c2-8e19-5c29ded82521","etag":"lsndfkjsndfkjnsdfkjnsd==","name":"my-component-yay","namespace":"the-namespace","labels":{"backstage.io/custom":"ValueStuff"},"annotations":{"example.com/bindings":"are-secret"},"tags":["java","data"]}],"type":"object","required":["name"],"additionalProperties":true,"properties":{"uid":{"type":"string","description":"A globally unique ID for the entity. This field can not be set by the user at creation time, and the server will reject an attempt to do so. The field will be populated in read operations. The field can (optionally) be specified when performing update or delete operations, but the server is free to reject requests that do so in such a way that it breaks semantics.","examples":["e01199ab-08cc-44c2-8e19-5c29ded82521"],"minLength":1},"etag":{"type":"string","description":"An opaque string that changes for each update operation to any part of the entity, including metadata. This field can not be set by the user at creation time, and the server will reject an attempt to do so. The field will be populated in read operations. The field can (optionally) be specified when performing update or delete operations, and the server will then reject the operation if it does not match the current stored value.","examples":["lsndfkjsndfkjnsdfkjnsd=="],"minLength":1},"name":{"type":"string","description":"The name of the entity. Must be unique within the catalog at any given point in time, for any given namespace + kind pair.","examples":["metadata-proxy"],"minLength":1},"namespace":{"type":"string","description":"The namespace that the entity belongs to.","default":"default","examples":["default","admin"],"minLength":1},"title":{"type":"string","description":"A display name of the entity, to be presented in user interfaces instead of the name property, when available.","examples":["React SSR Template"],"minLength":1},"description":{"type":"string","description":"A short (typically relatively few words, on one line) description of the entity."},"labels":{"type":"object","description":"Key/value pairs of identifying information attached to the entity.","additionalProperties":true,"patternProperties":{"^.+$":{"type":"string"}}},"annotations":{"type":"object","description":"Key/value pairs of non-identifying auxiliary information attached to the entity.","additionalProperties":true,"patternProperties":{"^.+$":{"type":"string"}}},"tags":{"type":"array","description":"A list of single-valued strings, to for example classify catalog entities in various ways.","items":{"type":"string","minLength":1}},"links":{"type":"array","description":"A list of external hyperlinks related to the entity. Links can provide additional contextual information that may be located outside of Backstage itself. For example, an admin dashboard or external CMS page.","items":{"type":"object","required":["url"],"properties":{"url":{"type":"string","description":"A url in a standard uri format.","examples":["https://admin.example-org.com"],"minLength":1},"title":{"type":"string","description":"A user friendly display name for the link.","examples":["Admin Dashboard"],"minLength":1},"icon":{"type":"string","description":"A key representing a visual icon to be displayed in the UI.","examples":["dashboard"],"minLength":1},"type":{"type":"string","description":"An optional value to categorize links into specific groups.","examples":["runbook","documentation","logs","dashboard"],"minLength":1}}}}}}'),Me=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema","$id":"common","type":"object","description":"Common definitions to import from other schemas","definitions":{"reference":{"$id":"#reference","type":"object","description":"A reference by name to another entity.","required":["kind","namespace","name"],"additionalProperties":false,"properties":{"kind":{"type":"string","description":"The kind field of the entity.","minLength":1},"namespace":{"type":"string","description":"The metadata.namespace field of the entity.","minLength":1},"name":{"type":"string","description":"The metadata.name field of the entity.","minLength":1}}},"relation":{"$id":"#relation","type":"object","description":"A directed relation from one entity to another.","required":["type","targetRef"],"additionalProperties":false,"properties":{"type":{"type":"string","minLength":1,"pattern":"^\\\\w+$","description":"The type of relation."},"target":{"$ref":"#reference","deprecated":true},"targetRef":{"type":"string","minLength":1,"description":"The entity ref of the target of this relation."}}},"status":{"$id":"#status","type":"object","description":"The current status of the entity, as claimed by various sources.","required":[],"additionalProperties":true,"properties":{"items":{"type":"array","items":{"$ref":"#statusItem"}}}},"statusItem":{"$id":"#statusItem","type":"object","description":"A specific status item on a well known format.","required":["type","level","message"],"additionalProperties":true,"properties":{"type":{"type":"string","minLength":1},"level":{"$ref":"#statusLevel","description":"The status level / severity of the status item."},"message":{"type":"string","description":"A brief message describing the status, intended for human consumption."},"error":{"$ref":"#error","description":"An optional serialized error object related to the status."}}},"statusLevel":{"$id":"#statusLevel","type":"string","description":"A status level / severity.","enum":["info","warning","error"]},"error":{"$id":"#error","type":"object","description":"A serialized error object.","required":["name","message"],"additionalProperties":true,"properties":{"name":{"type":"string","examples":["Error","InputError"],"description":"The type name of the error","minLength":1},"message":{"type":"string","description":"The message of the error"},"code":{"type":"string","description":"An error code associated with the error"},"stack":{"type":"string","description":"An error stack trace"}}}}}');const ye=new Map,Be=[$e,Ue,De,Me];function ze(i){if(!(i!=null&&i.length))throw new TypeError("Unknown error");const a=i[0];throw new TypeError(`${a.instancePath||"<root>"} ${a.message}${a.params?` - ${Object.entries(a.params).map(([s,o])=>`${s}: ${o}`).join(", ")}`:""}`)}function Ve(i,a={}){var s;const o=(s=a==null?void 0:a.disableCache)!==null&&s!==void 0?s:!1,r=o?"":JSON.stringify(i);if(!o){const j=ye.get(r);if(j)return j}const l=He(i),d=new(Ne())({allowUnionTypes:!0,allErrors:!0,validateSchema:!0});l.length&&d.addSchema(l,void 0,void 0,!0);const h=d.compile(i);return o||ye.set(r,h),h}function He(i){if(typeof i!="object")return[];const a=new Set;i.$id&&a.add(i.$id);const s=new Array,o=[i];for(;o.length;){const r=o.pop();for(const l of Ke(r))if(!a.has(l)){a.add(l);const d=Be.find(h=>h.$id===l);d&&(s.push(d),o.push(d))}}return s}function*Ke(i){const a=[i];for(;a.length;){const s=a.pop();if(typeof s=="object"&&s)for(const[o,r]of Object.entries(s))o==="$ref"&&typeof r=="string"?yield r.split("#")[0]:a.push(r)}}function We(i){const a=Ve(i);return s=>{var o;if(a(s)===!0)return s;const l=(o=a.errors)===null||o===void 0?void 0:o.filter(d=>["/kind","/apiVersion"].includes(d.instancePath));if(l!=null&&l.length&&l.every(d=>d.keyword==="enum"))return!1;throw ze(a.errors)}}var Ge=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema","$id":"TemplateV1beta3","description":"A Template describes a scaffolding task for use with the Scaffolder. It describes the required parameters as well as a series of steps that will be taken to execute the scaffolding task.","examples":[{"apiVersion":"scaffolder.backstage.io/v1beta3","kind":"Template","metadata":{"name":"react-ssr-template","title":"React SSR Template","description":"Next.js application skeleton for creating isomorphic web applications.","tags":["recommended","react"]},"spec":{"owner":"artist-relations-team","type":"website","parameters":{"required":["name","description","repoUrl"],"backstage:permissions":{"tags":["one","two"]},"properties":{"name":{"title":"Name","type":"string","description":"Unique name of the component"},"description":{"title":"Description","type":"string","description":"Description of the component"},"repoUrl":{"title":"Pick a repository","type":"string","ui:field":"RepoUrlPicker"}}},"steps":[{"id":"fetch","name":"Fetch","action":"fetch:plain","parameters":{"url":"./template"},"backstage:permissions":{"tags":["one","two"]}},{"id":"publish","name":"Publish to GitHub","action":"publish:github","parameters":{"repoUrl":"${{ parameters.repoUrl }}"},"if":"${{ parameters.repoUrl }}"}],"output":{"catalogInfoUrl":"${{ steps.publish.output.catalogInfoUrl }}"}}}],"allOf":[{"$ref":"Entity"},{"type":"object","required":["spec"],"properties":{"apiVersion":{"enum":["scaffolder.backstage.io/v1beta3"]},"kind":{"enum":["Template"]},"spec":{"type":"object","required":["type","steps"],"properties":{"type":{"type":"string","description":"The type of component created by the template. The software catalog accepts any type value, but an organization should take great care to establish a proper taxonomy for these. Tools including Backstage itself may read this field and behave differently depending on its value. For example, a website type component may present tooling in the Backstage interface that is specific to just websites.","examples":["service","website","library"],"minLength":1},"owner":{"type":"string","description":"The user (or group) owner of the template","minLength":1},"parameters":{"oneOf":[{"type":"object","description":"The JSONSchema describing the inputs for the template.","properties":{"backstage:permissions":{"type":"object","description":"Object used for authorizing the parameter","properties":{"tags":{"type":"array","items":{"type":"string"}}}}}},{"type":"array","description":"A list of separate forms to collect parameters.","items":{"type":"object","description":"The JSONSchema describing the inputs for the template.","properties":{"backstage:permissions":{"type":"object","description":"Object used for authorizing the parameter","properties":{"tags":{"type":"array","items":{"type":"string"}}}}}}}]},"presentation":{"type":"object","description":"A way to redefine the labels for actionable buttons.","properties":{"backButtonText":{"type":"string","description":"A button which return the user to one step back."},"createButtonText":{"type":"string","description":"A button which start the execution of the template."},"reviewButtonText":{"type":"string","description":"A button which open the review step to verify the input prior to start the execution."}}},"EXPERIMENTAL_recovery":{"type":"object","description":"A task recovery section.","properties":{"EXPERIMENTAL_strategy":{"type":"string","description":"Recovery strategy for your task (none or startOver). By default none"}}},"steps":{"type":"array","description":"A list of steps to execute.","items":{"type":"object","description":"A description of the step to execute.","required":["action"],"properties":{"id":{"type":"string","description":"The ID of the step, which can be used to refer to its outputs."},"name":{"type":"string","description":"The name of the step, which will be displayed in the UI during the scaffolding process."},"action":{"type":"string","description":"The name of the action to execute."},"input":{"type":"object","description":"A templated object describing the inputs to the action."},"if":{"type":["string","boolean"],"description":"A templated condition that skips the step when evaluated to false. If the condition is true or not defined, the step is executed. The condition is true, if the input is not `false`, `undefined`, `null`, `\\"\\"`, `0`, or `[]`."},"backstage:permissions":{"type":"object","description":"Object used for authorizing the step","properties":{"tags":{"type":"array","items":{"type":"string"}}}}}}},"output":{"type":"object","description":"A templated object describing the outputs of the scaffolding task.","properties":{"links":{"type":"array","description":"A list of external hyperlinks, typically pointing to resources created or updated by the template","items":{"type":"object","required":[],"properties":{"url":{"type":"string","description":"A url in a standard uri format.","examples":["https://github.com/my-org/my-new-repo"],"minLength":1},"entityRef":{"type":"string","description":"An entity reference to an entity in the catalog.","examples":["Component:default/my-app"],"minLength":1},"title":{"type":"string","description":"A user friendly display name for the link.","examples":["View new repo"],"minLength":1},"icon":{"type":"string","description":"A key representing a visual icon to be displayed in the UI.","examples":["dashboard"],"minLength":1}}}},"text":{"type":"array","description":"A list of Markdown text blobs, like output data from the template.","items":{"type":"object","required":[],"properties":{"title":{"type":"string","description":"A user friendly display name for the text.","examples":["Output Content"],"minLength":1},"icon":{"type":"string","description":"A key representing a visual icon to be displayed in the UI.","examples":["dashboard"],"minLength":1},"content":{"type":"string","description":"The text blob to display in the UI, rendered as Markdown.","examples":["**hey** _I\'m_ Markdown"]}}}}},"additionalProperties":{"type":"string"}}}}}}]}');const Je=We(Ge),st={async check(i){return Je(i)===i}},Fe=i=>i.apiVersion==="scaffolder.backstage.io/v1beta3"&&i.kind==="Template";var Ye=e(36989);function Qe(i){const{entity:a,loading:s,error:o}=(0,de.TY)(),{allowed:r,loading:l,error:d}=(0,Ye.J)({permission:i,resourceRef:a?(0,x.U2)(a):void 0});return s||l?{loading:!0,allowed:!1}:o?{loading:!1,allowed:!1,error:o}:{loading:!1,allowed:r,error:d}}var Xe=e(60413),Ze=e(91638);const qe="backstage.io/source-template",_e=i=>{const a=(0,J.gf)(pe.v),{value:s}=(0,Ze.A)(async()=>{var o;const r=(o=i.metadata.annotations)===null||o===void 0?void 0:o[qe];let l;if(r)try{const d=await a.getEntityByRef(r);return l=(0,x.KU)(r),d!==void 0?l:void 0}catch{return}},[a,i]);return s},et="backstage.io/techdocs-ref",te="backstage.io/techdocs-entity",tt=(0,A.A)({gridItemCard:{display:"flex",flexDirection:"column",height:"calc(100% - 10px)",marginBottom:"10px"},fullHeightCard:{display:"flex",flexDirection:"column",height:"100%"},gridItemCardContent:{flex:1},fullHeightCardContent:{flex:1}});function nt(i){var a,s,o,r,l;const{variant:d}=i,h=(0,le.n)(),j=tt(),{entity:n}=(0,de.tN)(),ne=(0,J.gf)(ee.Y),_=(0,J.gf)(pe.v),F=(0,J.gf)(be.k),M=(0,J.gf)(xe.m),D=(0,ce.S)(ue.UJ),B=(0,ce.S)(ue.Zg),V=_e(n),{allowed:ie}=Qe(Xe.tS),L=Ae(n,ne),z=(a=n.metadata.annotations)===null||a===void 0?void 0:a[b.P];let P;if(!((s=n.metadata.annotations)===null||s===void 0)&&s[te])try{var H;P=(0,x.KU)((H=n.metadata.annotations)===null||H===void 0?void 0:H[te])}catch{P=void 0}const Y={label:"View Source",disabled:!L,icon:(0,t.jsx)(ve,{type:L==null?void 0:L.integrationType}),href:L==null?void 0:L.locationTargetUrl},w={label:"View TechDocs",disabled:!(!((o=n.metadata.annotations)===null||o===void 0)&&o[et]||!((r=n.metadata.annotations)===null||r===void 0)&&r[te])||!D,icon:(0,t.jsx)(we.A,{}),href:D&&D(P?{namespace:P.namespace||b.oQ,kind:P.kind,name:P.name}:{namespace:n.metadata.namespace||b.oQ,kind:n.kind,name:n.metadata.name})},K=[Y,w];if(Fe(n)){var ae;const re=(ae=h.getSystemIcon("scaffolder"))!==null&&ae!==void 0?ae:Pe.A,ot={label:"Launch Template",icon:(0,t.jsx)(re,{}),disabled:!B,href:B&&B({templateName:n.metadata.name,namespace:n.metadata.namespace||b.oQ})};K.push(ot)}let oe="";d==="gridItem"?oe=j.gridItemCard:d==="fullHeight"&&(oe=j.fullHeightCard);let se="";d==="gridItem"?se=j.gridItemCardContent:d==="fullHeight"&&(se=j.fullHeightCardContent);const W=(l=n.metadata.annotations)===null||l===void 0?void 0:l[R.Eo],it=(W==null?void 0:W.startsWith("url:"))||(W==null?void 0:W.startsWith("file:")),at=(0,c.useCallback)(async()=>{try{await _.refreshEntity((0,x.U2)(n)),F.post({message:"Refresh scheduled",severity:"info",display:"transient"})}catch(re){M.post(re)}},[_,F,M,n]);return(0,t.jsxs)(k.A,{className:oe,children:[(0,t.jsx)($.A,{title:"About",action:(0,t.jsxs)(t.Fragment,{children:[it&&ie&&(0,t.jsx)(N.A,{"aria-label":"Refresh",title:"Schedule entity refresh",onClick:at,children:(0,t.jsx)(Ie.A,{})}),(0,t.jsx)(N.A,{component:T.N_,"aria-label":"Edit",disabled:!z,title:"Edit Metadata",to:z!=null?z:"#",children:(0,t.jsx)(Re.A,{})}),V&&B&&(0,t.jsx)(N.A,{component:T.N_,title:"Create something similar",to:B({namespace:V.namespace,templateName:V.name}),children:(0,t.jsx)(p.z9,{id:"scaffolder"})})]}),subheader:(0,t.jsx)(G,{links:K})}),(0,t.jsx)(O.A,{}),(0,t.jsx)(U.A,{className:se,children:(0,t.jsx)(fe,{entity:n})})]})}},18750:function(Q,C,e){e.d(C,{m:function(){return v}});var t=e(31085),b=e(24709),R=e(44913),x=e(14041),k=e(10394),U=e(72501),$=e(58837),O=e(23127),N=e(72072);const A=(0,$.A)({svgIcon:{display:"inline-block","& svg":{display:"inline-block",fontSize:"inherit",verticalAlign:"baseline"}}});function T(m){const{href:y,text:g,Icon:S}=m,E=A();return(0,t.jsxs)(k.A,{display:"flex",children:[(0,t.jsx)(k.A,{mr:1,className:E.svgIcon,children:(0,t.jsx)(U.A,{component:"div",children:S?(0,t.jsx)(S,{}):(0,t.jsx)(O.A,{})})}),(0,t.jsx)(k.A,{flexGrow:"1",children:(0,t.jsx)(N.N_,{to:y,target:"_blank",rel:"noopener",children:g||y})})]})}var p=e(5893);const c={xs:1,sm:1,md:1,lg:2,xl:3};function u(m){const y=[(0,p.A)(f=>f.breakpoints.up("xl"))?"xl":null,(0,p.A)(f=>f.breakpoints.up("lg"))?"lg":null,(0,p.A)(f=>f.breakpoints.up("md"))?"md":null,(0,p.A)(f=>f.breakpoints.up("sm"))?"sm":null,(0,p.A)(f=>f.breakpoints.up("xs"))?"xs":null];let g=1;if(typeof m=="number")g=m;else{var S;const f=(S=y.find(G=>G!==null))!==null&&S!==void 0?S:"xs";var E;g=(E=m==null?void 0:m[f])!==null&&E!==void 0?E:c[f]}return g}function v(m){const{items:y,cols:g=void 0}=m,S=u(g);return(0,t.jsx)(b.A,{rowHeight:"auto",cols:S,children:y.map(({text:E,href:f,Icon:G},ee)=>(0,t.jsx)(R.A,{children:(0,t.jsx)(T,{href:f,text:E!=null?E:f,Icon:G})},ee))})}},36989:function(Q,C,e){e.d(C,{J:function(){return p}});var t=e(72427),b=e(96824);function R(c,u){return c.name===u.name}function x(c,u){return"resourceType"in c?!u||c.resourceType===u:!1}function k(c){return c.attributes.action==="create"}function U(c){return c.attributes.action==="read"}function $(c){return c.attributes.action==="update"}function O(c){return c.attributes.action==="delete"}function N(c){return{authorize:async(u,v)=>await c.authorize(u,v),authorizeConditional(u,v){const m=u;return c.authorize(m,v)}}}var A=e(54241),T=e(68721);function p(c){const u=(0,t.gf)(b.x),{data:v,error:m}=(0,T.Ay)(c,async y=>{if(x(y.permission)&&!y.resourceRef)return A.b.DENY;const{result:g}=await u.authorize(y);return g});return m?{error:m,loading:!1,allowed:!1}:v===void 0?{loading:!0,allowed:!1}:{loading:!1,allowed:v===A.b.ALLOW}}}}]);})();
1
+ "use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[73],{60413:function(Q,C,e){e.d(C,{C4:function(){return x},tS:function(){return U}});function t({name:T,attributes:p,resourceType:c}){return c?{type:"resource",name:T,attributes:p,resourceType:c}:{type:"basic",name:T,attributes:p}}const b="catalog-entity",R=t({name:"catalog.entity.read",attributes:{action:"read"},resourceType:b}),x=t({name:"catalog.entity.create",attributes:{action:"create"}}),k=t({name:"catalog.entity.delete",attributes:{action:"delete"},resourceType:b}),U=t({name:"catalog.entity.refresh",attributes:{action:"update"},resourceType:b}),$=t({name:"catalog.location.read",attributes:{action:"read"}}),O=t({name:"catalog.location.create",attributes:{action:"create"}}),N=t({name:"catalog.location.delete",attributes:{action:"delete"}}),A=[R,x,k,U,$,O,N]},99538:function(Q,C,e){e.d(C,{T7:function(){return O},TY:function(){return T},tN:function(){return A}});var t=e(31085),b=e(6820),R=e(25862),x=e(43836),k=e(10602),U=e(14041);const $=(0,x.tK)("entity-context"),O=p=>{const{children:c,entity:u,loading:v,error:m,refresh:y}=p,g={entity:u,loading:v,error:m,refresh:y};return(0,t.jsx)($.Provider,{value:(0,k.B)({1:g}),children:(0,t.jsx)(R.Ig,{attributes:{...u?{entityRef:(0,b.U2)(u)}:void 0},children:c})})},N=p=>_jsx(O,{entity:p.entity,loading:!p.entity,error:void 0,refresh:void 0,children:p.children});function A(){const p=(0,x.qO)("entity-context");if(!p)throw new Error("Entity context is not available");const c=p.atVersion(1);if(!c)throw new Error("EntityContext v1 not available");if(!c.entity)throw new Error("useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.");return{entity:c.entity}}function T(){const p=(0,x.qO)("entity-context");if(!p)throw new Error("Entity context is not available");const c=p.atVersion(1);if(!c)throw new Error("EntityContext v1 not available");const{entity:u,loading:v,error:m,refresh:y}=c;return{entity:u,loading:v,error:m,refresh:y}}},40073:function(Q,C,e){e.r(C),e.d(C,{AboutCard:function(){return nt},AboutContent:function(){return he},AboutField:function(){return w}});var t=e(31085),b=e(72348),R=e(17736),x=e(6820),k=e(40703),U=e(48653),$=e(45685),O=e(37197),N=e(29365),A=e(58837),T=e(72072),p=e(31129),c=e(14041),u=e(53373),v=e.n(u),m=e(86613),y=e(10394),g=e(72501);const S=(0,A.A)(i=>({link:{display:"grid",justifyItems:"center",gridGap:4,textAlign:"center"},disabled:{color:i.palette.text.secondary,cursor:"default"},primary:{color:i.palette.primary.main},secondary:{color:i.palette.secondary.main},label:{textTransform:"uppercase",fontWeight:i.typography.fontWeightBold,letterSpacing:1.2}}),{name:"BackstageIconLinkVertical"});function L({color:i="primary",disabled:a=!1,href:s="#",icon:o=(0,t.jsx)(m.A,{}),label:r,onClick:l,title:d}){const f=S();return a?(0,t.jsxs)(y.A,{title:d,className:v()(f.link,f.disabled),children:[o,(0,t.jsx)(g.A,{variant:"caption",component:"span",className:f.label,children:r})]}):(0,t.jsxs)(T.N_,{title:d,className:v()(f.link,f[i]),to:s,onClick:l,children:[o,(0,t.jsx)(g.A,{variant:"caption",component:"span",className:f.label,children:r})]})}const h=(0,A.A)(i=>({links:{margin:i.spacing(2,0),display:"grid",gridAutoFlow:"column",gridAutoColumns:"min-content",gridGap:i.spacing(3)}}),{name:"BackstageHeaderIconLinkRow"});function G(i){const{links:a}=i,s=h();return(0,t.jsx)("nav",{className:s.links,children:a.map((o,r)=>(0,t.jsx)(L,{...o},r+1))})}var ee=e(41158),ge=e(13660),le=e(82266);const ve=i=>{const{type:a}=i,s=(0,le.n)(),o=ge.A;var r;const l=a&&(r=s.getSystemIcon(a))!==null&&r!==void 0?r:o;return(0,t.jsx)(l,{})};var J=e(72427),be=e(36017),xe=e(39837),ce=e(9222),de=e(99538),pe=e(7341),me=e(78692);function Ae(i,a){var s;const o=(s=i.metadata.annotations)===null||s===void 0?void 0:s[R.I4];if(o)try{const r=(0,me.aY)(o),l=a.byUrl(r.target);return{locationTargetUrl:r.target,integrationType:l==null?void 0:l.type}}catch{return}}var ue=e(95203),X=e(51372),Z=e(67871),q=e(34428),je=e(67720),fe=e(42899),Te=e(4650),Le=e(82442);const Ee=(0,A.A)(i=>({value:{fontWeight:"bold",overflow:"hidden",lineHeight:"24px",wordBreak:"break-word"},label:{color:i.palette.text.secondary,textTransform:"uppercase",fontSize:"10px",fontWeight:"bold",letterSpacing:.5,overflow:"hidden",whiteSpace:"nowrap"}}));function w(i){const{label:a,value:s,gridSizes:o,children:r}=i,l=Ee(),d=(0,Le.O)(r,j=>j.getElements()),f=d.length>0?d:(0,t.jsx)(g.A,{variant:"body2",className:l.value,children:s||"unknown"});return(0,t.jsxs)(fe.A,{item:!0,...o,children:[(0,t.jsx)(g.A,{variant:"h2",className:l.label,children:a}),f]})}var Ce=e(18750);const ke=(0,A.A)({description:{wordBreak:"break-word"}});function Se(i,a,s){if(a==="url"||i.includes("://"))return i;const o=s.type==="file"?`file://${s.target}`:s.target;return a==="file"||s.type==="file"?new URL(i,o).href:o}function he(i){var a,s,o,r,l,d,f,j;const{entity:n}=i,ne=ke(),_=n.kind.toLocaleLowerCase("en-US")==="system",F=n.kind.toLocaleLowerCase("en-US")==="resource",M=n.kind.toLocaleLowerCase("en-US")==="component",D=n.kind.toLocaleLowerCase("en-US")==="api",B=n.kind.toLocaleLowerCase("en-US")==="template",V=n.kind.toLocaleLowerCase("en-US")==="location",ie=n.kind.toLocaleLowerCase("en-US")==="group",E=(0,Z.t)(n,X.jn,{kind:"system"}),z=(0,Z.t)(n,X.jn,{kind:"component"}),I=(0,Z.t)(n,X.jn,{kind:"domain"}),H=(0,Z.t)(n,X.vv);let Y;try{Y=(0,me.Cr)(n)}catch{Y=void 0}return(0,t.jsxs)(fe.A,{container:!0,children:[(0,t.jsx)(w,{label:"Description",gridSizes:{xs:12},children:(0,t.jsx)(Te.h,{className:ne.description,content:(n==null||(a=n.metadata)===null||a===void 0?void 0:a.description)||"No description"})}),(0,t.jsx)(w,{label:"Owner",value:"No Owner",gridSizes:{xs:12,sm:6,lg:4},children:H.length>0&&(0,t.jsx)(q.i,{entityRefs:H,defaultKind:"group"})}),(_||I.length>0)&&(0,t.jsx)(w,{label:"Domain",value:"No Domain",gridSizes:{xs:12,sm:6,lg:4},children:I.length>0&&(0,t.jsx)(q.i,{entityRefs:I,defaultKind:"domain"})}),(D||M||F||E.length>0)&&(0,t.jsx)(w,{label:"System",value:"No System",gridSizes:{xs:12,sm:6,lg:4},children:E.length>0&&(0,t.jsx)(q.i,{entityRefs:E,defaultKind:"system"})}),M&&z.length>0&&(0,t.jsx)(w,{label:"Parent Component",value:"No Parent Component",gridSizes:{xs:12,sm:6,lg:4},children:(0,t.jsx)(q.i,{entityRefs:z,defaultKind:"component"})}),(D||M||F||B||ie||V||typeof(n==null||(s=n.spec)===null||s===void 0?void 0:s.type)=="string")&&(0,t.jsx)(w,{label:"Type",value:n==null||(o=n.spec)===null||o===void 0?void 0:o.type,gridSizes:{xs:12,sm:6,lg:4}}),(D||M||typeof(n==null||(r=n.spec)===null||r===void 0?void 0:r.lifecycle)=="string")&&(0,t.jsx)(w,{label:"Lifecycle",value:n==null||(l=n.spec)===null||l===void 0?void 0:l.lifecycle,gridSizes:{xs:12,sm:6,lg:4}}),(0,t.jsx)(w,{label:"Tags",value:"No Tags",gridSizes:{xs:12,sm:6,lg:4},children:((n==null||(d=n.metadata)===null||d===void 0?void 0:d.tags)||[]).map(P=>(0,t.jsx)(je.A,{size:"small",label:P},P))}),V&&((n==null||(f=n.spec)===null||f===void 0?void 0:f.targets)||(n==null||(j=n.spec)===null||j===void 0?void 0:j.target))&&(0,t.jsx)(w,{label:"Targets",gridSizes:{xs:12},children:(0,t.jsx)(Ce.m,{cols:1,items:(n.spec.targets||[n.spec.target]).map(P=>P).map(P=>{var K;return{text:P,href:Se(P,(n==null||(K=n.spec)===null||K===void 0?void 0:K.type)||"unknown",Y)}})})})]})}var we=e(74011),Ie=e(25534),Pe=e(82451),Re=e(75625),Oe=e(11601),Ne=e.n(Oe),Ue=JSON.parse(`{"$schema":"http://json-schema.org/draft-07/schema","$id":"Entity","description":"The parts of the format that's common to all versions/kinds of entity.","examples":[{"apiVersion":"backstage.io/v1alpha1","kind":"Component","metadata":{"name":"LoremService","description":"Creates Lorems like a pro.","labels":{"product_name":"Random value Generator"},"annotations":{"docs":"https://github.com/..../tree/develop/doc"}},"spec":{"type":"service","lifecycle":"production","owner":"tools"}}],"type":"object","required":["apiVersion","kind","metadata"],"additionalProperties":false,"properties":{"apiVersion":{"type":"string","description":"The version of specification format for this particular entity that this is written against.","minLength":1,"examples":["backstage.io/v1alpha1","my-company.net/v1","1.0"]},"kind":{"type":"string","description":"The high level entity type being described.","minLength":1,"examples":["API","Component","Domain","Group","Location","Resource","System","Template","User"]},"metadata":{"$ref":"EntityMeta"},"spec":{"type":"object","description":"The specification data describing the entity itself."},"relations":{"type":"array","description":"The relations that this entity has with other entities.","items":{"$ref":"common#relation"}},"status":{"$ref":"common#status"}}}`),$e=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema","$id":"EntityEnvelope","description":"The envelope skeleton parts of an entity - whatever is necessary to be able to give it a ref and pass to further validation / policy checking.","examples":[{"apiVersion":"backstage.io/v1alpha1","kind":"Component","metadata":{"name":"LoremService"}}],"type":"object","required":["apiVersion","kind","metadata"],"additionalProperties":true,"properties":{"apiVersion":{"type":"string","description":"The version of specification format for this particular entity that this is written against.","minLength":1,"examples":["backstage.io/v1alpha1","my-company.net/v1","1.0"]},"kind":{"type":"string","description":"The high level entity type being described.","minLength":1,"examples":["API","Component","Domain","Group","Location","Resource","System","Template","User"]},"metadata":{"type":"object","required":["name"],"additionalProperties":true,"properties":{"name":{"type":"string","description":"The name of the entity. Must be unique within the catalog at any given point in time, for any given namespace + kind pair.","examples":["metadata-proxy"],"minLength":1},"namespace":{"type":"string","description":"The namespace that the entity belongs to.","default":"default","examples":["default","admin"],"minLength":1}}}}}'),De=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema","$id":"EntityMeta","description":"Metadata fields common to all versions/kinds of entity.","examples":[{"uid":"e01199ab-08cc-44c2-8e19-5c29ded82521","etag":"lsndfkjsndfkjnsdfkjnsd==","name":"my-component-yay","namespace":"the-namespace","labels":{"backstage.io/custom":"ValueStuff"},"annotations":{"example.com/bindings":"are-secret"},"tags":["java","data"]}],"type":"object","required":["name"],"additionalProperties":true,"properties":{"uid":{"type":"string","description":"A globally unique ID for the entity. This field can not be set by the user at creation time, and the server will reject an attempt to do so. The field will be populated in read operations. The field can (optionally) be specified when performing update or delete operations, but the server is free to reject requests that do so in such a way that it breaks semantics.","examples":["e01199ab-08cc-44c2-8e19-5c29ded82521"],"minLength":1},"etag":{"type":"string","description":"An opaque string that changes for each update operation to any part of the entity, including metadata. This field can not be set by the user at creation time, and the server will reject an attempt to do so. The field will be populated in read operations. The field can (optionally) be specified when performing update or delete operations, and the server will then reject the operation if it does not match the current stored value.","examples":["lsndfkjsndfkjnsdfkjnsd=="],"minLength":1},"name":{"type":"string","description":"The name of the entity. Must be unique within the catalog at any given point in time, for any given namespace + kind pair.","examples":["metadata-proxy"],"minLength":1},"namespace":{"type":"string","description":"The namespace that the entity belongs to.","default":"default","examples":["default","admin"],"minLength":1},"title":{"type":"string","description":"A display name of the entity, to be presented in user interfaces instead of the name property, when available.","examples":["React SSR Template"],"minLength":1},"description":{"type":"string","description":"A short (typically relatively few words, on one line) description of the entity."},"labels":{"type":"object","description":"Key/value pairs of identifying information attached to the entity.","additionalProperties":true,"patternProperties":{"^.+$":{"type":"string"}}},"annotations":{"type":"object","description":"Key/value pairs of non-identifying auxiliary information attached to the entity.","additionalProperties":true,"patternProperties":{"^.+$":{"type":"string"}}},"tags":{"type":"array","description":"A list of single-valued strings, to for example classify catalog entities in various ways.","items":{"type":"string","minLength":1}},"links":{"type":"array","description":"A list of external hyperlinks related to the entity. Links can provide additional contextual information that may be located outside of Backstage itself. For example, an admin dashboard or external CMS page.","items":{"type":"object","required":["url"],"properties":{"url":{"type":"string","description":"A url in a standard uri format.","examples":["https://admin.example-org.com"],"minLength":1},"title":{"type":"string","description":"A user friendly display name for the link.","examples":["Admin Dashboard"],"minLength":1},"icon":{"type":"string","description":"A key representing a visual icon to be displayed in the UI.","examples":["dashboard"],"minLength":1},"type":{"type":"string","description":"An optional value to categorize links into specific groups.","examples":["runbook","documentation","logs","dashboard"],"minLength":1}}}}}}'),Me=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema","$id":"common","type":"object","description":"Common definitions to import from other schemas","definitions":{"reference":{"$id":"#reference","type":"object","description":"A reference by name to another entity.","required":["kind","namespace","name"],"additionalProperties":false,"properties":{"kind":{"type":"string","description":"The kind field of the entity.","minLength":1},"namespace":{"type":"string","description":"The metadata.namespace field of the entity.","minLength":1},"name":{"type":"string","description":"The metadata.name field of the entity.","minLength":1}}},"relation":{"$id":"#relation","type":"object","description":"A directed relation from one entity to another.","required":["type","targetRef"],"additionalProperties":false,"properties":{"type":{"type":"string","minLength":1,"pattern":"^\\\\w+$","description":"The type of relation."},"target":{"$ref":"#reference","deprecated":true},"targetRef":{"type":"string","minLength":1,"description":"The entity ref of the target of this relation."}}},"status":{"$id":"#status","type":"object","description":"The current status of the entity, as claimed by various sources.","required":[],"additionalProperties":true,"properties":{"items":{"type":"array","items":{"$ref":"#statusItem"}}}},"statusItem":{"$id":"#statusItem","type":"object","description":"A specific status item on a well known format.","required":["type","level","message"],"additionalProperties":true,"properties":{"type":{"type":"string","minLength":1},"level":{"$ref":"#statusLevel","description":"The status level / severity of the status item."},"message":{"type":"string","description":"A brief message describing the status, intended for human consumption."},"error":{"$ref":"#error","description":"An optional serialized error object related to the status."}}},"statusLevel":{"$id":"#statusLevel","type":"string","description":"A status level / severity.","enum":["info","warning","error"]},"error":{"$id":"#error","type":"object","description":"A serialized error object.","required":["name","message"],"additionalProperties":true,"properties":{"name":{"type":"string","examples":["Error","InputError"],"description":"The type name of the error","minLength":1},"message":{"type":"string","description":"The message of the error"},"code":{"type":"string","description":"An error code associated with the error"},"stack":{"type":"string","description":"An error stack trace"}}}}}');const ye=new Map,Be=[$e,Ue,De,Me];function ze(i){if(!(i!=null&&i.length))throw new TypeError("Unknown error");const a=i[0];throw new TypeError(`${a.instancePath||"<root>"} ${a.message}${a.params?` - ${Object.entries(a.params).map(([s,o])=>`${s}: ${o}`).join(", ")}`:""}`)}function Ve(i,a={}){var s;const o=(s=a==null?void 0:a.disableCache)!==null&&s!==void 0?s:!1,r=o?"":JSON.stringify(i);if(!o){const j=ye.get(r);if(j)return j}const l=He(i),d=new(Ne())({allowUnionTypes:!0,allErrors:!0,validateSchema:!0});l.length&&d.addSchema(l,void 0,void 0,!0);const f=d.compile(i);return o||ye.set(r,f),f}function He(i){if(typeof i!="object")return[];const a=new Set;i.$id&&a.add(i.$id);const s=new Array,o=[i];for(;o.length;){const r=o.pop();for(const l of Ke(r))if(!a.has(l)){a.add(l);const d=Be.find(f=>f.$id===l);d&&(s.push(d),o.push(d))}}return s}function*Ke(i){const a=[i];for(;a.length;){const s=a.pop();if(typeof s=="object"&&s)for(const[o,r]of Object.entries(s))o==="$ref"&&typeof r=="string"?yield r.split("#")[0]:a.push(r)}}function We(i){const a=Ve(i);return s=>{var o;if(a(s)===!0)return s;const l=(o=a.errors)===null||o===void 0?void 0:o.filter(d=>["/kind","/apiVersion"].includes(d.instancePath));if(l!=null&&l.length&&l.every(d=>d.keyword==="enum"))return!1;throw ze(a.errors)}}var Ge=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema","$id":"TemplateV1beta3","description":"A Template describes a scaffolding task for use with the Scaffolder. It describes the required parameters as well as a series of steps that will be taken to execute the scaffolding task.","examples":[{"apiVersion":"scaffolder.backstage.io/v1beta3","kind":"Template","metadata":{"name":"react-ssr-template","title":"React SSR Template","description":"Next.js application skeleton for creating isomorphic web applications.","tags":["recommended","react"]},"spec":{"owner":"artist-relations-team","type":"website","parameters":{"required":["name","description","repoUrl"],"backstage:permissions":{"tags":["one","two"]},"properties":{"name":{"title":"Name","type":"string","description":"Unique name of the component"},"description":{"title":"Description","type":"string","description":"Description of the component"},"repoUrl":{"title":"Pick a repository","type":"string","ui:field":"RepoUrlPicker"}}},"steps":[{"id":"fetch","name":"Fetch","action":"fetch:plain","parameters":{"url":"./template"},"backstage:permissions":{"tags":["one","two"]}},{"id":"publish","name":"Publish to GitHub","action":"publish:github","parameters":{"repoUrl":"${{ parameters.repoUrl }}"},"if":"${{ parameters.repoUrl }}"}],"output":{"catalogInfoUrl":"${{ steps.publish.output.catalogInfoUrl }}"}}}],"allOf":[{"$ref":"Entity"},{"type":"object","required":["spec"],"properties":{"apiVersion":{"enum":["scaffolder.backstage.io/v1beta3"]},"kind":{"enum":["Template"]},"spec":{"type":"object","required":["type","steps"],"properties":{"type":{"type":"string","description":"The type of component created by the template. The software catalog accepts any type value, but an organization should take great care to establish a proper taxonomy for these. Tools including Backstage itself may read this field and behave differently depending on its value. For example, a website type component may present tooling in the Backstage interface that is specific to just websites.","examples":["service","website","library"],"minLength":1},"owner":{"type":"string","description":"The user (or group) owner of the template","minLength":1},"parameters":{"oneOf":[{"type":"object","description":"The JSONSchema describing the inputs for the template.","properties":{"backstage:permissions":{"type":"object","description":"Object used for authorizing the parameter","properties":{"tags":{"type":"array","items":{"type":"string"}}}}}},{"type":"array","description":"A list of separate forms to collect parameters.","items":{"type":"object","description":"The JSONSchema describing the inputs for the template.","properties":{"backstage:permissions":{"type":"object","description":"Object used for authorizing the parameter","properties":{"tags":{"type":"array","items":{"type":"string"}}}}}}}]},"presentation":{"type":"object","description":"A way to redefine the presentation of the scaffolder.","properties":{"buttonLabels":{"type":"object","description":"A way to redefine the labels for actionable buttons.","properties":{"backButtonText":{"type":"string","description":"A button which return the user to one step back."},"createButtonText":{"type":"string","description":"A button which start the execution of the template."},"reviewButtonText":{"type":"string","description":"A button which open the review step to verify the input prior to start the execution."}}}}},"EXPERIMENTAL_recovery":{"type":"object","description":"A task recovery section.","properties":{"EXPERIMENTAL_strategy":{"type":"string","description":"Recovery strategy for your task (none or startOver). By default none"}}},"steps":{"type":"array","description":"A list of steps to execute.","items":{"type":"object","description":"A description of the step to execute.","required":["action"],"properties":{"id":{"type":"string","description":"The ID of the step, which can be used to refer to its outputs."},"name":{"type":"string","description":"The name of the step, which will be displayed in the UI during the scaffolding process."},"action":{"type":"string","description":"The name of the action to execute."},"input":{"type":"object","description":"A templated object describing the inputs to the action."},"if":{"type":["string","boolean"],"description":"A templated condition that skips the step when evaluated to false. If the condition is true or not defined, the step is executed. The condition is true, if the input is not `false`, `undefined`, `null`, `\\"\\"`, `0`, or `[]`."},"backstage:permissions":{"type":"object","description":"Object used for authorizing the step","properties":{"tags":{"type":"array","items":{"type":"string"}}}}}}},"output":{"type":"object","description":"A templated object describing the outputs of the scaffolding task.","properties":{"links":{"type":"array","description":"A list of external hyperlinks, typically pointing to resources created or updated by the template","items":{"type":"object","required":[],"properties":{"url":{"type":"string","description":"A url in a standard uri format.","examples":["https://github.com/my-org/my-new-repo"],"minLength":1},"entityRef":{"type":"string","description":"An entity reference to an entity in the catalog.","examples":["Component:default/my-app"],"minLength":1},"title":{"type":"string","description":"A user friendly display name for the link.","examples":["View new repo"],"minLength":1},"icon":{"type":"string","description":"A key representing a visual icon to be displayed in the UI.","examples":["dashboard"],"minLength":1}}}},"text":{"type":"array","description":"A list of Markdown text blobs, like output data from the template.","items":{"type":"object","required":[],"properties":{"title":{"type":"string","description":"A user friendly display name for the text.","examples":["Output Content"],"minLength":1},"icon":{"type":"string","description":"A key representing a visual icon to be displayed in the UI.","examples":["dashboard"],"minLength":1},"content":{"type":"string","description":"The text blob to display in the UI, rendered as Markdown.","examples":["**hey** _I\'m_ Markdown"]}}}}},"additionalProperties":{"type":"string"}}}}}}]}');const Je=We(Ge),st={async check(i){return Je(i)===i}},Fe=i=>i.apiVersion==="scaffolder.backstage.io/v1beta3"&&i.kind==="Template";var Ye=e(36989);function Qe(i){const{entity:a,loading:s,error:o}=(0,de.TY)(),{allowed:r,loading:l,error:d}=(0,Ye.J)({permission:i,resourceRef:a?(0,x.U2)(a):void 0});return s||l?{loading:!0,allowed:!1}:o?{loading:!1,allowed:!1,error:o}:{loading:!1,allowed:r,error:d}}var Xe=e(60413),Ze=e(91638);const qe="backstage.io/source-template",_e=i=>{const a=(0,J.gf)(pe.v),{value:s}=(0,Ze.A)(async()=>{var o;const r=(o=i.metadata.annotations)===null||o===void 0?void 0:o[qe];let l;if(r)try{const d=await a.getEntityByRef(r);return l=(0,x.KU)(r),d!==void 0?l:void 0}catch{return}},[a,i]);return s},et="backstage.io/techdocs-ref",te="backstage.io/techdocs-entity",tt=(0,A.A)({gridItemCard:{display:"flex",flexDirection:"column",height:"calc(100% - 10px)",marginBottom:"10px"},fullHeightCard:{display:"flex",flexDirection:"column",height:"100%"},gridItemCardContent:{flex:1},fullHeightCardContent:{flex:1}});function nt(i){var a,s,o,r,l;const{variant:d}=i,f=(0,le.n)(),j=tt(),{entity:n}=(0,de.tN)(),ne=(0,J.gf)(ee.Y),_=(0,J.gf)(pe.v),F=(0,J.gf)(be.k),M=(0,J.gf)(xe.m),D=(0,ce.S)(ue.UJ),B=(0,ce.S)(ue.Zg),V=_e(n),{allowed:ie}=Qe(Xe.tS),E=Ae(n,ne),z=(a=n.metadata.annotations)===null||a===void 0?void 0:a[b.P];let I;if(!((s=n.metadata.annotations)===null||s===void 0)&&s[te])try{var H;I=(0,x.KU)((H=n.metadata.annotations)===null||H===void 0?void 0:H[te])}catch{I=void 0}const Y={label:"View Source",disabled:!E,icon:(0,t.jsx)(ve,{type:E==null?void 0:E.integrationType}),href:E==null?void 0:E.locationTargetUrl},P={label:"View TechDocs",disabled:!(!((o=n.metadata.annotations)===null||o===void 0)&&o[et]||!((r=n.metadata.annotations)===null||r===void 0)&&r[te])||!D,icon:(0,t.jsx)(Pe.A,{}),href:D&&D(I?{namespace:I.namespace||b.oQ,kind:I.kind,name:I.name}:{namespace:n.metadata.namespace||b.oQ,kind:n.kind,name:n.metadata.name})},K=[Y,P];if(Fe(n)){var ae;const re=(ae=f.getSystemIcon("scaffolder"))!==null&&ae!==void 0?ae:Ie.A,ot={label:"Launch Template",icon:(0,t.jsx)(re,{}),disabled:!B,href:B&&B({templateName:n.metadata.name,namespace:n.metadata.namespace||b.oQ})};K.push(ot)}let oe="";d==="gridItem"?oe=j.gridItemCard:d==="fullHeight"&&(oe=j.fullHeightCard);let se="";d==="gridItem"?se=j.gridItemCardContent:d==="fullHeight"&&(se=j.fullHeightCardContent);const W=(l=n.metadata.annotations)===null||l===void 0?void 0:l[R.Eo],it=(W==null?void 0:W.startsWith("url:"))||(W==null?void 0:W.startsWith("file:")),at=(0,c.useCallback)(async()=>{try{await _.refreshEntity((0,x.U2)(n)),F.post({message:"Refresh scheduled",severity:"info",display:"transient"})}catch(re){M.post(re)}},[_,F,M,n]);return(0,t.jsxs)(k.A,{className:oe,children:[(0,t.jsx)($.A,{title:"About",action:(0,t.jsxs)(t.Fragment,{children:[it&&ie&&(0,t.jsx)(N.A,{"aria-label":"Refresh",title:"Schedule entity refresh",onClick:at,children:(0,t.jsx)(we.A,{})}),(0,t.jsx)(N.A,{component:T.N_,"aria-label":"Edit",disabled:!z,title:"Edit Metadata",to:z!=null?z:"#",children:(0,t.jsx)(Re.A,{})}),V&&B&&(0,t.jsx)(N.A,{component:T.N_,title:"Create something similar",to:B({namespace:V.namespace,templateName:V.name}),children:(0,t.jsx)(p.z9,{id:"scaffolder"})})]}),subheader:(0,t.jsx)(G,{links:K})}),(0,t.jsx)(O.A,{}),(0,t.jsx)(U.A,{className:se,children:(0,t.jsx)(he,{entity:n})})]})}},18750:function(Q,C,e){e.d(C,{m:function(){return v}});var t=e(31085),b=e(24709),R=e(44913),x=e(14041),k=e(10394),U=e(72501),$=e(58837),O=e(23127),N=e(72072);const A=(0,$.A)({svgIcon:{display:"inline-block","& svg":{display:"inline-block",fontSize:"inherit",verticalAlign:"baseline"}}});function T(m){const{href:y,text:g,Icon:S}=m,L=A();return(0,t.jsxs)(k.A,{display:"flex",children:[(0,t.jsx)(k.A,{mr:1,className:L.svgIcon,children:(0,t.jsx)(U.A,{component:"div",children:S?(0,t.jsx)(S,{}):(0,t.jsx)(O.A,{})})}),(0,t.jsx)(k.A,{flexGrow:"1",children:(0,t.jsx)(N.N_,{to:y,target:"_blank",rel:"noopener",children:g||y})})]})}var p=e(5893);const c={xs:1,sm:1,md:1,lg:2,xl:3};function u(m){const y=[(0,p.A)(h=>h.breakpoints.up("xl"))?"xl":null,(0,p.A)(h=>h.breakpoints.up("lg"))?"lg":null,(0,p.A)(h=>h.breakpoints.up("md"))?"md":null,(0,p.A)(h=>h.breakpoints.up("sm"))?"sm":null,(0,p.A)(h=>h.breakpoints.up("xs"))?"xs":null];let g=1;if(typeof m=="number")g=m;else{var S;const h=(S=y.find(G=>G!==null))!==null&&S!==void 0?S:"xs";var L;g=(L=m==null?void 0:m[h])!==null&&L!==void 0?L:c[h]}return g}function v(m){const{items:y,cols:g=void 0}=m,S=u(g);return(0,t.jsx)(b.A,{rowHeight:"auto",cols:S,children:y.map(({text:L,href:h,Icon:G},ee)=>(0,t.jsx)(R.A,{children:(0,t.jsx)(T,{href:h,text:L!=null?L:h,Icon:G})},ee))})}},36989:function(Q,C,e){e.d(C,{J:function(){return p}});var t=e(72427),b=e(96824);function R(c,u){return c.name===u.name}function x(c,u){return"resourceType"in c?!u||c.resourceType===u:!1}function k(c){return c.attributes.action==="create"}function U(c){return c.attributes.action==="read"}function $(c){return c.attributes.action==="update"}function O(c){return c.attributes.action==="delete"}function N(c){return{authorize:async(u,v)=>await c.authorize(u,v),authorizeConditional(u,v){const m=u;return c.authorize(m,v)}}}var A=e(54241),T=e(68721);function p(c){const u=(0,t.gf)(b.x),{data:v,error:m}=(0,T.Ay)(c,async y=>{if(x(y.permission)&&!y.resourceRef)return A.b.DENY;const{result:g}=await u.authorize(y);return g});return m?{error:m,loading:!1,allowed:!1}:v===void 0?{loading:!0,allowed:!1}:{loading:!1,allowed:v===A.b.ALLOW}}}}]);})();
2
2
 
3
- //# sourceMappingURL=73.618ea766.chunk.js.map
3
+ //# sourceMappingURL=73.cc8a3548.chunk.js.map