@techdocs/cli 0.0.0-nightly-20220225022541 → 0.0.0-nightly-20220226022353

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,6 +1,6 @@
1
1
  # @techdocs/cli
2
2
 
3
- ## 0.0.0-nightly-20220225022541
3
+ ## 0.0.0-nightly-20220226022353
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -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 platform for building developer portals"/><link rel="apple-touch-icon" href="/logo192.png"/><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><script defer="defer" src="/static/runtime.287af9cc.js"></script><script defer="defer" src="/static/module-material-ui.c0e7547f.js"></script><script defer="defer" src="/static/module-lodash.f158b49a.js"></script><script defer="defer" src="/static/module-date-fns.a08d117e.js"></script><script defer="defer" src="/static/module-ajv.ed51f4b8.js"></script><script defer="defer" src="/static/module-material-table.a73fb7f5.js"></script><script defer="defer" src="/static/module-yaml.574c3290.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.bcb66a0c.js"></script><script defer="defer" src="/static/module-react-dom.40a0584f.js"></script><script defer="defer" src="/static/vendor.287af9cc.js"></script><script defer="defer" src="/static/main.287af9cc.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 platform for building developer portals"/><link rel="apple-touch-icon" href="/logo192.png"/><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><script defer="defer" src="/static/runtime.aad01425.js"></script><script defer="defer" src="/static/module-material-ui.c0e7547f.js"></script><script defer="defer" src="/static/module-lodash.f158b49a.js"></script><script defer="defer" src="/static/module-date-fns.a08d117e.js"></script><script defer="defer" src="/static/module-ajv.ed51f4b8.js"></script><script defer="defer" src="/static/module-material-table.a73fb7f5.js"></script><script defer="defer" src="/static/module-yaml.574c3290.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.bcb66a0c.js"></script><script defer="defer" src="/static/module-react-dom.40a0584f.js"></script><script defer="defer" src="/static/vendor.aad01425.js"></script><script defer="defer" src="/static/main.aad01425.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
@@ -0,0 +1,3 @@
1
+ "use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[7110],{57110:function(R,C,n){n.r(C),n.d(C,{TechDocsCustomHome:function(){return v}});var e=n(2784),f=n(64279),O=n(79692),i=n(31423),P=n(41564),T=n(21956),A=n(51016),_=n(1114),a=n(9118),d=n(36964);const M={DocsTable:T.DocsTable,DocsCardGrid:A.f},y=({config:t,entities:s,index:l})=>{const m=(0,O.Z)({panelContainer:{marginBottom:"2rem",...t.panelCSS?t.panelCSS:{}}})(),{value:r}=B(),p=M[t.panelType],u=s.filter(E=>t.filterPredicate==="ownedByUser"?r?(0,i.isOwnerOf)(r,E):!1:typeof t.filterPredicate=="function"&&t.filterPredicate(E));return e.createElement(e.Fragment,null,e.createElement(a.ContentHeader,{title:t.title,description:t.description},l===0?e.createElement(a.SupportButton,null,"Discover documentation in your ecosystem."):null),e.createElement("div",{className:m.panelContainer},e.createElement(p,{"data-testid":"techdocs-custom-panel",entities:u})))},v=t=>{const{tabsConfig:s}=t,[l,D]=(0,e.useState)(0),m=(0,d.useApi)(i.catalogApiRef),{value:r,loading:p,error:u}=(0,f.default)(async()=>(await m.getEntities({filter:{"metadata.annotations.backstage.io/techdocs-ref":i.CATALOG_FILTER_EXISTS},fields:["apiVersion","kind","metadata","relations","spec.owner","spec.type"]})).items.filter(c=>{var g;return!!((g=c.metadata.annotations)==null?void 0:g["backstage.io/techdocs-ref"])})),E=s[l];return p?e.createElement(_.j,null,e.createElement(a.Content,null,e.createElement(a.Progress,null))):u?e.createElement(_.j,null,e.createElement(a.Content,null,e.createElement(a.WarningPanel,{severity:"error",title:"Could not load available documentation."},e.createElement(a.CodeSnippet,{language:"text",text:u.toString()})))):e.createElement(_.j,null,e.createElement(a.HeaderTabs,{selectedIndex:l,onChange:o=>D(o),tabs:s.map(({label:o},c)=>({id:c.toString(),label:o}))}),e.createElement(a.Content,{"data-testid":"techdocs-content"},E.panels.map((o,c)=>e.createElement(y,{key:c,config:o,entities:r||[],index:c}))))};function B(){const t=(0,d.useApi)(i.catalogApiRef),s=(0,d.useApi)(d.identityApiRef);return(0,f.default)(async()=>{const l=await s.getBackstageIdentity();return t.getEntityByName((0,P.of)(l.userEntityRef,{defaultKind:"User",defaultNamespace:P.zG}))},[t,s])}}}]);})();
2
+
3
+ //# sourceMappingURL=7110.b5b8dbe7.chunk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["webpack://techdocs-cli-embedded-app/../node_modules/@sucrase/webpack-loader/dist/plugins/techdocs/src/home/components/TechDocsCustomHome.tsx"],"names":[],"mappings":"0TAgDA,KAAM,GAAS,CACb,UAAW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AI,EAAM,WACV,aAGF,gBAAoB,UAAS,CAAE,cAAe,oBAC5C,EAAiB,OAAO,IAAI,CAAC,EAAQ,IACrC,gBAAoB,EAAa,CAC/B,IAAK,EACL,OAAQ,EACR,SAAY,GAAsB,GAClC,MAAO,QAQnB,YAAsB,CACpB,KAAM,GAAa,aAAO,iBACpB,EAAc,aAAO,kBAE3B,MAAO,cAAS,SAAY,CAC1B,KAAM,GAAW,KAAM,GAAY,uBACnC,MAAO,GAAW,gBAChB,SAAe,EAAS,cAAe,CACrC,YAAa,OACb,iBAAkB,SAGrB,CAAC,EAAY","file":"static/7110.b5b8dbe7.chunk.js","sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useState } from 'react';\nimport useAsync, { } from 'react-use/lib/useAsync';\nimport { makeStyles } from '@material-ui/core';\n\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n\n isOwnerOf,\n} from '@backstage/plugin-catalog-react';\nimport {\n DEFAULT_NAMESPACE,\n\n parseEntityRef,\n\n} 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';\n\nimport { identityApiRef, 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 */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst CustomPanel = ({\n config,\n entities,\n index,\n}\n\n\n\n) => {\n const useStyles = makeStyles({\n panelContainer: {\n marginBottom: '2rem',\n ...(config.panelCSS ? config.panelCSS : {}),\n },\n });\n const classes = useStyles();\n const { value: user } = useOwnUser();\n\n const Panel = panels[config.panelType];\n\n const shownEntities = entities.filter(entity => {\n if (config.filterPredicate === 'ownedByUser') {\n if (!user) {\n return false;\n }\n return isOwnerOf(user, entity);\n }\n\n return (\n typeof config.filterPredicate === 'function' &&\n config.filterPredicate(entity)\n );\n });\n\n return (\n React.createElement(React.Fragment, null\n , React.createElement(ContentHeader, { title: config.title, description: config.description,}\n , index === 0 ? (\n React.createElement(SupportButton, null, \"Discover documentation in your ecosystem.\"\n\n )\n ) : null\n )\n , React.createElement('div', { className: classes.panelContainer,}\n , React.createElement(Panel, { 'data-testid': \"techdocs-custom-panel\", entities: shownEntities,} )\n )\n )\n );\n};\n\n/**\n * Props for {@link TechDocsCustomHome}\n *\n * @public\n */\n\n\n\n\nexport const TechDocsCustomHome = (props) => {\n const { tabsConfig } = props;\n const [selectedTab, setSelectedTab] = useState(0);\n const 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) => {\n return !!entity.metadata.annotations?.['backstage.io/techdocs-ref'];\n });\n });\n\n const currentTabConfig = tabsConfig[selectedTab];\n\n if (loading) {\n return (\n React.createElement(TechDocsPageWrapper, null\n , React.createElement(Content, null\n , React.createElement(Progress, null )\n )\n )\n );\n }\n\n if (error) {\n return (\n React.createElement(TechDocsPageWrapper, null\n , React.createElement(Content, null\n , React.createElement(WarningPanel, {\n severity: \"error\",\n title: \"Could not load available documentation.\" ,}\n \n , React.createElement(CodeSnippet, { language: \"text\", text: error.toString(),} )\n )\n )\n )\n );\n }\n\n return (\n React.createElement(TechDocsPageWrapper, null\n , React.createElement(HeaderTabs, {\n selectedIndex: selectedTab,\n onChange: index => setSelectedTab(index),\n tabs: tabsConfig.map(({ label }, index) => ({\n id: index.toString(),\n label,\n })),}\n )\n , React.createElement(Content, { 'data-testid': \"techdocs-content\",}\n , currentTabConfig.panels.map((config, index) => (\n React.createElement(CustomPanel, {\n key: index,\n config: config,\n entities: !!entities ? entities : [],\n index: index,}\n )\n ))\n )\n )\n );\n};\n\nfunction useOwnUser() {\n const catalogApi = useApi(catalogApiRef);\n const identityApi = useApi(identityApiRef);\n\n return useAsync(async () => {\n const identity = await identityApi.getBackstageIdentity();\n return catalogApi.getEntityByName(\n parseEntityRef(identity.userEntityRef, {\n defaultKind: 'User',\n defaultNamespace: DEFAULT_NAMESPACE,\n }),\n ) ;\n }, [catalogApi, identityApi]);\n}\n"],"sourceRoot":""}