@techdocs/cli 1.2.3-next.1 → 1.2.4-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/embedded-app/.config-schema.json +7 -8
- package/dist/embedded-app/index.html +1 -1
- package/dist/embedded-app/static/{5837.ebb0f422.chunk.js → 5837.45e6ec1d.chunk.js} +2 -2
- package/dist/embedded-app/static/{5837.ebb0f422.chunk.js.map → 5837.45e6ec1d.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{6051.f45bae28.chunk.js → 6051.3f1d6d7c.chunk.js} +3 -3
- package/dist/embedded-app/static/{6051.f45bae28.chunk.js.map → 6051.3f1d6d7c.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{7560.b3ed3a97.chunk.js → 7560.a50a4f27.chunk.js} +2 -2
- package/dist/embedded-app/static/{7560.b3ed3a97.chunk.js.map → 7560.a50a4f27.chunk.js.map} +1 -1
- package/dist/embedded-app/static/7750.36f3b714.chunk.js +8 -0
- package/dist/embedded-app/static/{7750.0f3395fe.chunk.js.map → 7750.36f3b714.chunk.js.map} +1 -1
- package/dist/embedded-app/static/main.4fdcff32.js +494 -0
- package/dist/embedded-app/static/main.4fdcff32.js.map +1 -0
- package/dist/embedded-app/static/{module-ajv.fca02de5.js → module-ajv.2efe45a5.js} +5 -5
- package/dist/embedded-app/static/module-ajv.2efe45a5.js.map +1 -0
- package/dist/embedded-app/static/module-date-fns.7dd2cc1f.js +4 -0
- package/dist/embedded-app/static/module-date-fns.7dd2cc1f.js.map +1 -0
- package/dist/embedded-app/static/module-luxon.1ec72e86.js +3 -0
- package/dist/embedded-app/static/module-luxon.1ec72e86.js.map +1 -0
- package/dist/embedded-app/static/{module-material-table.5d56e1cb.js → module-material-table.ac270938.js} +2 -2
- package/dist/embedded-app/static/{module-material-table.5d56e1cb.js.map → module-material-table.ac270938.js.map} +1 -1
- package/dist/embedded-app/static/module-material-ui.8008c157.js +51 -0
- package/dist/embedded-app/static/module-material-ui.8008c157.js.map +1 -0
- package/dist/embedded-app/static/module-octokit.ea8cd5cc.js +2 -2
- package/dist/embedded-app/static/module-octokit.ea8cd5cc.js.map +1 -1
- package/dist/embedded-app/static/module-yaml.b5c4d531.js +1 -1
- package/dist/embedded-app/static/module-yaml.b5c4d531.js.map +1 -1
- package/dist/embedded-app/static/module-zod.49ffd80f.js +1 -1
- package/dist/embedded-app/static/module-zod.49ffd80f.js.map +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_ada.88274170.chunk.js +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_ada.88274170.chunk.js.map +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_dart.d81ae419.chunk.js +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_dart.d81ae419.chunk.js.map +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_dts.497871f1.chunk.js +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_dts.497871f1.chunk.js.map +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_javascript.b660af43.chunk.js +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_javascript.b660af43.chunk.js.map +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_mathematica.19225e2a.chunk.js +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_mathematica.19225e2a.chunk.js.map +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_typescript.90772612.chunk.js +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_typescript.90772612.chunk.js.map +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_vhdl.c15a8f55.chunk.js +1 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_vhdl.c15a8f55.chunk.js.map +1 -1
- package/dist/embedded-app/static/{runtime.3308728f.js → runtime.4fdcff32.js} +2 -2
- package/dist/embedded-app/static/{runtime.3308728f.js.map → runtime.4fdcff32.js.map} +1 -1
- package/dist/embedded-app/static/vendor.4fdcff32.js +236 -0
- package/dist/embedded-app/static/vendor.4fdcff32.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/package.json +6 -6
- package/dist/embedded-app/static/7750.0f3395fe.chunk.js +0 -8
- package/dist/embedded-app/static/main.3308728f.js +0 -494
- package/dist/embedded-app/static/main.3308728f.js.map +0 -1
- package/dist/embedded-app/static/module-ajv.fca02de5.js.map +0 -1
- package/dist/embedded-app/static/module-date-fns.d70f4cc3.js +0 -3
- package/dist/embedded-app/static/module-date-fns.d70f4cc3.js.map +0 -1
- package/dist/embedded-app/static/module-luxon.f67513b2.js +0 -3
- package/dist/embedded-app/static/module-luxon.f67513b2.js.map +0 -1
- package/dist/embedded-app/static/module-material-ui.e3edf608.js +0 -74
- package/dist/embedded-app/static/module-material-ui.e3edf608.js.map +0 -1
- package/dist/embedded-app/static/vendor.3308728f.js +0 -236
- package/dist/embedded-app/static/vendor.3308728f.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @techdocs/cli
|
|
2
2
|
|
|
3
|
+
## 1.2.4-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/backend-common@0.16.1-next.0
|
|
9
|
+
- @backstage/catalog-model@1.1.4-next.0
|
|
10
|
+
- @backstage/cli-common@0.1.10
|
|
11
|
+
- @backstage/config@1.0.5-next.0
|
|
12
|
+
- @backstage/plugin-techdocs-node@1.4.3-next.0
|
|
13
|
+
|
|
14
|
+
## 1.2.3
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @backstage/backend-common@0.16.0
|
|
20
|
+
- @backstage/plugin-techdocs-node@1.4.2
|
|
21
|
+
- @backstage/catalog-model@1.1.3
|
|
22
|
+
- @backstage/cli-common@0.1.10
|
|
23
|
+
- @backstage/config@1.0.4
|
|
24
|
+
|
|
3
25
|
## 1.2.3-next.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -17,14 +17,6 @@
|
|
|
17
17
|
"type": "string",
|
|
18
18
|
"visibility": "frontend"
|
|
19
19
|
},
|
|
20
|
-
"googleAnalyticsTrackingId": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"visibility": "frontend",
|
|
23
|
-
"description": "Tracking ID for Google Analytics",
|
|
24
|
-
"examples": [
|
|
25
|
-
"UA-000000-0"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
20
|
"datadogRum": {
|
|
29
21
|
"type": "object",
|
|
30
22
|
"description": "Datadog RUM events configuration",
|
|
@@ -548,6 +540,13 @@
|
|
|
548
540
|
"description": "The client secret to use",
|
|
549
541
|
"visibility": "secret",
|
|
550
542
|
"type": "string"
|
|
543
|
+
},
|
|
544
|
+
"allowedInstallationOwners": {
|
|
545
|
+
"description": "List of installation owners allowed to be used by this GitHub app. The GitHub UI does not provide a way to list the installations.\nHowever you can list the installations with the GitHub API. You can find the list of installations here:\nhttps://api.github.com/app/installations\nThe relevant documentation for this is here.\nhttps://docs.github.com/en/rest/reference/apps#list-installations-for-the-authenticated-app--code-samples",
|
|
546
|
+
"type": "array",
|
|
547
|
+
"items": {
|
|
548
|
+
"type": "string"
|
|
549
|
+
}
|
|
551
550
|
}
|
|
552
551
|
},
|
|
553
552
|
"required": [
|
|
@@ -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.
|
|
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.4fdcff32.js"></script><script defer="defer" src="/static/module-material-ui.8008c157.js"></script><script defer="defer" src="/static/module-lodash.0cada415.js"></script><script defer="defer" src="/static/module-date-fns.7dd2cc1f.js"></script><script defer="defer" src="/static/module-yaml.b5c4d531.js"></script><script defer="defer" src="/static/module-ajv.2efe45a5.js"></script><script defer="defer" src="/static/module-material-table.ac270938.js"></script><script defer="defer" src="/static/module-luxon.1ec72e86.js"></script><script defer="defer" src="/static/module-octokit.ea8cd5cc.js"></script><script defer="defer" src="/static/module-react-dom.5abdac04.js"></script><script defer="defer" src="/static/module-zod.49ffd80f.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.97cccd01.js"></script><script defer="defer" src="/static/vendor.4fdcff32.js"></script><script defer="defer" src="/static/main.4fdcff32.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
|
-
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[5837],{95837:function(P,
|
|
1
|
+
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[5837],{95837:function(P,e,n){n.r(e),n.d(e,{CatalogPage:function(){return m},DefaultCatalogPage:function(){return c}});var t=n(52322),D=n(2784),u=n(10289),a=n(93414),o=n(25248),l=n(43297),x=n(19625),j=n(86359),h=n(79324);const C=()=>(0,o.yx)();function c(s){const{columns:r,actions:f,initiallySelectedFilter:v="owned",initialKind:d="component",tableOptions:p={},emptyContent:y}=s;var i;const F=(i=(0,o.h_)(o.Ds).getOptionalString("organization.name"))!==null&&i!==void 0?i:"Backstage",g=(0,o.tg)(x.yw),{createButtonTitle:O}=C();return(0,t.jsx)(a.g9,{title:`${F} Catalog`,themeId:"home",children:(0,t.jsx)(l.UO,{children:(0,t.jsxs)(a.VY,{children:[(0,t.jsxs)(a.yW,{titleComponent:(0,t.jsx)(h.K,{initialFilter:d}),children:[(0,t.jsx)(a.XF,{title:O,to:g&&g()}),(0,t.jsx)(a.qt,{children:"All your software catalog entities"})]}),(0,t.jsxs)(l._i,{children:[(0,t.jsxs)(l._i.Filters,{children:[(0,t.jsx)(l.tW,{initialFilter:d}),(0,t.jsx)(l.sL,{}),(0,t.jsx)(l.EW,{initialFilter:v}),(0,t.jsx)(l.dq,{}),(0,t.jsx)(l.df,{}),(0,t.jsx)(l.xE,{}),(0,t.jsx)(l.nl,{})]}),(0,t.jsx)(l._i.Content,{children:(0,t.jsx)(j.E,{columns:r,actions:f,tableOptions:p,emptyContent:y})})]})]})})})}function m(s){return(0,u.pC)()||(0,t.jsx)(c,{...s})}}}]);})();
|
|
2
2
|
|
|
3
|
-
//# sourceMappingURL=5837.
|
|
3
|
+
//# sourceMappingURL=5837.45e6ec1d.chunk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/options.ts","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogPage/CatalogPage.tsx"],"names":["useCatalogPluginOptions","usePluginOptions","DefaultCatalogPage","props","columns","actions","initiallySelectedFilter","initialKind","tableOptions","emptyContent","useApi","orgName","configApiRef","getOptionalString","createComponentLink","useRouteRef","createComponentRouteRef","createButtonTitle","PageWithHeader","title","themeId","EntityListProvider","Content","ContentHeader","titleComponent","CatalogKindHeader","initialFilter","CreateButton","to","SupportButton","CatalogFilterLayout","EntityKindPicker","EntityTypePicker","UserListPicker","EntityOwnerPicker","EntityLifecyclePicker","EntityTagPicker","EntityProcessingStatusPicker","CatalogTable","CatalogPage","useOutlet"],"mappings":"kVA2BO,MAAMA,EAA0B,K,EACrCC,MAAgBA,EC8BX,SAASC,EAAmBC,EAAgC,CACjE,KAAM,CACJC,UACAC,UACAC,0BAA0B,QAC1BC,cAAc,YACdC,eAAe,CAAC,EAChBC,cAAY,EACVN,E,IAEFO,EADF,MAAMC,GACJD,G,EAAAA,MAAOE,IAAYA,EAAEC,kBAAkB,mBAAmB,KAAnB,MAAvCH,aAA+D,YAC3DI,G,EAAsBC,MAAYC,IAAuBA,EAEzD,CAAEC,mBAAkB,EAAIjB,EAAwB,EAEtD,O,EACE,OAACkB,KAAcA,CAACC,MAAO,GAAGR,YAAmBS,QAAQ,O,YACnD,OAACC,KAAkBA,C,YACjB,QAACC,KAAOA,C,aACN,QAACC,KAAaA,CACZC,gB,EAAgB,OAACC,IAAiBA,CAACC,cAAenB,C,gBAElD,OAACoB,KAAYA,CACXR,MAAOF,EACPW,GAAId,GAAuBA,EAAoB,C,MAEjD,OAACe,KAAaA,C,SAAC,oC,SAEjB,QAACC,KAAmBA,C,aAClB,QAACA,aAA2B,C,aAC1B,OAACC,KAAgBA,CAACL,cAAenB,C,MACjC,OAACyB,KAAgBA,K,EACjB,OAACC,KAAcA,CAACP,cAAepB,C,MAC/B,OAAC4B,KAAiBA,K,EAClB,OAACC,KAAqBA,K,EACtB,OAACC,KAAeA,K,EAChB,OAACC,KAA4BA,G,OAE/B,OAACP,aAA2B,C,YAC1B,OAACQ,IAAYA,CACXlC,QAASA,EACTC,QAASA,EACTG,aAAcA,EACdC,aAAcA,C,cAQ9B,CCtFO,SAAS8B,EAAYpC,EAAgC,CAG1D,O,EAFeqC,MAAU,I,EAER,OAACtC,EAAkBA,CAAE,GAAGC,C,EAC3C,C","file":"static/5837.
|
|
1
|
+
{"version":3,"sources":["webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/options.ts","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogPage/CatalogPage.tsx"],"names":["useCatalogPluginOptions","usePluginOptions","DefaultCatalogPage","props","columns","actions","initiallySelectedFilter","initialKind","tableOptions","emptyContent","useApi","orgName","configApiRef","getOptionalString","createComponentLink","useRouteRef","createComponentRouteRef","createButtonTitle","PageWithHeader","title","themeId","EntityListProvider","Content","ContentHeader","titleComponent","CatalogKindHeader","initialFilter","CreateButton","to","SupportButton","CatalogFilterLayout","EntityKindPicker","EntityTypePicker","UserListPicker","EntityOwnerPicker","EntityLifecyclePicker","EntityTagPicker","EntityProcessingStatusPicker","CatalogTable","CatalogPage","useOutlet"],"mappings":"kVA2BO,MAAMA,EAA0B,K,EACrCC,MAAgBA,EC8BX,SAASC,EAAmBC,EAAgC,CACjE,KAAM,CACJC,UACAC,UACAC,0BAA0B,QAC1BC,cAAc,YACdC,eAAe,CAAC,EAChBC,cAAY,EACVN,E,IAEFO,EADF,MAAMC,GACJD,G,EAAAA,MAAOE,IAAYA,EAAEC,kBAAkB,mBAAmB,KAAnB,MAAvCH,aAA+D,YAC3DI,G,EAAsBC,MAAYC,IAAuBA,EAEzD,CAAEC,mBAAkB,EAAIjB,EAAwB,EAEtD,O,EACE,OAACkB,KAAcA,CAACC,MAAO,GAAGR,YAAmBS,QAAQ,O,YACnD,OAACC,KAAkBA,C,YACjB,QAACC,KAAOA,C,aACN,QAACC,KAAaA,CACZC,gB,EAAgB,OAACC,IAAiBA,CAACC,cAAenB,C,gBAElD,OAACoB,KAAYA,CACXR,MAAOF,EACPW,GAAId,GAAuBA,EAAoB,C,MAEjD,OAACe,KAAaA,C,SAAC,oC,SAEjB,QAACC,KAAmBA,C,aAClB,QAACA,aAA2B,C,aAC1B,OAACC,KAAgBA,CAACL,cAAenB,C,MACjC,OAACyB,KAAgBA,K,EACjB,OAACC,KAAcA,CAACP,cAAepB,C,MAC/B,OAAC4B,KAAiBA,K,EAClB,OAACC,KAAqBA,K,EACtB,OAACC,KAAeA,K,EAChB,OAACC,KAA4BA,G,OAE/B,OAACP,aAA2B,C,YAC1B,OAACQ,IAAYA,CACXlC,QAASA,EACTC,QAASA,EACTG,aAAcA,EACdC,aAAcA,C,cAQ9B,CCtFO,SAAS8B,EAAYpC,EAAgC,CAG1D,O,EAFeqC,MAAU,I,EAER,OAACtC,EAAkBA,CAAE,GAAGC,C,EAC3C,C","file":"static/5837.45e6ec1d.chunk.js","sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { usePluginOptions } from '@backstage/core-plugin-api';\n\nexport type CatalogPluginOptions = {\n createButtonTitle: string;\n};\n\n/** @ignore */\nexport type CatalogInputPluginOptions = {\n createButtonTitle: string;\n};\n\nexport const useCatalogPluginOptions = () =>\n usePluginOptions<CatalogPluginOptions>();\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 {\n Content,\n ContentHeader,\n CreateButton,\n PageWithHeader,\n SupportButton,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n CatalogFilterLayout,\n EntityLifecyclePicker,\n EntityListProvider,\n EntityProcessingStatusPicker,\n EntityOwnerPicker,\n EntityTagPicker,\n EntityTypePicker,\n UserListFilterKind,\n UserListPicker,\n EntityKindPicker,\n} from '@backstage/plugin-catalog-react';\nimport React, { ReactNode } from 'react';\nimport { createComponentRouteRef } from '../../routes';\nimport { CatalogTable, CatalogTableRow } from '../CatalogTable';\nimport { CatalogKindHeader } from '../CatalogKindHeader';\nimport { useCatalogPluginOptions } from '../../options';\n\n/**\n * Props for root catalog pages.\n *\n * @public\n */\nexport interface DefaultCatalogPageProps {\n initiallySelectedFilter?: UserListFilterKind;\n columns?: TableColumn<CatalogTableRow>[];\n actions?: TableProps<CatalogTableRow>['actions'];\n initialKind?: string;\n tableOptions?: TableProps<CatalogTableRow>['options'];\n emptyContent?: ReactNode;\n}\n\nexport function DefaultCatalogPage(props: DefaultCatalogPageProps) {\n const {\n columns,\n actions,\n initiallySelectedFilter = 'owned',\n initialKind = 'component',\n tableOptions = {},\n emptyContent,\n } = props;\n const orgName =\n useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';\n const createComponentLink = useRouteRef(createComponentRouteRef);\n\n const { createButtonTitle } = useCatalogPluginOptions();\n\n return (\n <PageWithHeader title={`${orgName} Catalog`} themeId=\"home\">\n <EntityListProvider>\n <Content>\n <ContentHeader\n titleComponent={<CatalogKindHeader initialFilter={initialKind} />}\n >\n <CreateButton\n title={createButtonTitle}\n to={createComponentLink && createComponentLink()}\n />\n <SupportButton>All your software catalog entities</SupportButton>\n </ContentHeader>\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <EntityKindPicker initialFilter={initialKind} />\n <EntityTypePicker />\n <UserListPicker initialFilter={initiallySelectedFilter} />\n <EntityOwnerPicker />\n <EntityLifecyclePicker />\n <EntityTagPicker />\n <EntityProcessingStatusPicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <CatalogTable\n columns={columns}\n actions={actions}\n tableOptions={tableOptions}\n emptyContent={emptyContent}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </Content>\n </EntityListProvider>\n </PageWithHeader>\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 from 'react';\nimport { useOutlet } from 'react-router';\nimport {\n DefaultCatalogPage,\n DefaultCatalogPageProps,\n} from './DefaultCatalogPage';\n\nexport function CatalogPage(props: DefaultCatalogPageProps) {\n const outlet = useOutlet();\n\n return outlet || <DefaultCatalogPage {...props} />;\n}\n"],"sourceRoot":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[6051],{76051:function(ue,Z,d){d.r(Z),d.d(Z,{RealLogViewer:function(){return ae}});var h=d(52322),g=d(2784),V=d(10289),y=d(61837),U=d(19353),W=d(7688),D=d(50166),G=d(46212);const
|
|
2
|
-
`);c(l),s(void 0)}}}}function ae(e){const n=
|
|
1
|
+
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[6051],{76051:function(ue,Z,d){d.r(Z),d.d(Z,{RealLogViewer:function(){return ae}});var h=d(52322),g=d(2784),V=d(10289),y=d(61837),U=d(19353),W=d(7688),D=d(50166),G=d(46212);const b=(0,G.Z)(),j=/\n\r?/g,L=Object.fromEntries(Object.entries({1:e=>({...e,bold:!0}),3:e=>({...e,italic:!0}),4:e=>({...e,underline:!0}),22:({bold:e,...n})=>n,23:({italic:e,...n})=>n,24:({underline:e,...n})=>n,30:e=>({...e,foreground:"black"}),31:e=>({...e,foreground:"red"}),32:e=>({...e,foreground:"green"}),33:e=>({...e,foreground:"yellow"}),34:e=>({...e,foreground:"blue"}),35:e=>({...e,foreground:"magenta"}),36:e=>({...e,foreground:"cyan"}),37:e=>({...e,foreground:"white"}),39:({foreground:e,...n})=>n,90:e=>({...e,foreground:"grey"}),40:e=>({...e,background:"black"}),41:e=>({...e,background:"red"}),42:e=>({...e,background:"green"}),43:e=>({...e,background:"yellow"}),44:e=>({...e,background:"blue"}),45:e=>({...e,background:"magenta"}),46:e=>({...e,background:"cyan"}),47:e=>({...e,background:"white"}),49:({background:e,...n})=>n}).map(([e,n])=>[`\x1B[${e}m`,n]));class C{lastChunk(){return this.chunks[this.chunks.length-1]}replaceLastChunk(n){n&&(this.chunks.splice(this.chunks.length-1,1,...n),this.text=this.chunks.map(t=>t.text).join("").toLocaleLowerCase("en-US"))}constructor(n=1,t=[]){this.lineNumber=n,this.chunks=t,this.text=t.map(s=>s.text).join("").toLocaleLowerCase("en-US")}}class P{process(n){if(this.text===n)return this.lines;if(n.startsWith(this.text)){var t;const r=this.lines.length>0?this.lines.length-1:0;var s;const i=(s=this.lines[r])!==null&&s!==void 0?s:new C,c=i.lastChunk();var o;const l=this.processLines(((o=c==null?void 0:c.text)!==null&&o!==void 0?o:"")+n.slice(this.text.length),c==null?void 0:c.modifiers,i==null?void 0:i.lineNumber);i.replaceLastChunk((t=l[0])===null||t===void 0?void 0:t.chunks),this.lines[r]=i,this.lines.push(...l.slice(1))}else this.lines=this.processLines(n);return this.text=n,this.lines}constructor(){this.text="",this.lines=[],this.processLines=(n,t={},s=1)=>{const o=[];let r=t,i=s,c=0;for(j.lastIndex=0;;){const u=j.exec(n);if(!u){const m=this.processText(n.slice(c),r);return o.push(new C(i,m)),o}const a=n.slice(c,u.index);c=u.index+u[0].length;const f=this.processText(a,r);o.push(new C(i,f));var l;r=(l=f[f.length-1].modifiers)!==null&&l!==void 0?l:r,i+=1}},this.processText=(n,t)=>{const s=[];let o=t,r=0;for(b.lastIndex=0;;){const i=b.exec(n);if(!i)return s.push({text:n.slice(r),modifiers:o}),s;const c=n.slice(r,i.index);s.push({text:c,modifiers:o}),r=i.index+i[0].length,o=this.processCode(i[0],o)}},this.processCode=(n,t)=>{var s,o;return(o=(s=L[n])===null||s===void 0?void 0:s.call(L,t))!==null&&o!==void 0?o:t}}}var $=d(79692),I=d(41128),k=d(31754),B=d(66054),R=d(81463),F=d(34505),M=d(57186),N=d(32720),T=d(92901),A=d(45410);const E=40,Y=(0,$.Z)(e=>({root:{background:e.palette.background.paper},header:{height:E,display:"flex",alignItems:"center",justifyContent:"flex-end"},log:{fontFamily:'"Monaco", monospace',fontSize:e.typography.pxToRem(12)},line:{position:"relative",whiteSpace:"pre","&:hover":{background:e.palette.action.hover}},lineSelected:{background:e.palette.action.selected,"&:hover":{background:e.palette.action.selected}},lineCopyButton:{position:"absolute",paddingTop:0,paddingBottom:0},lineNumber:{display:"inline-block",textAlign:"end",width:60,marginRight:e.spacing(1),cursor:"pointer"},textHighlight:{background:(0,I.Fq)(e.palette.info.main,.15)},textSelectedHighlight:{background:(0,I.Fq)(e.palette.info.main,.4)},modifierBold:{fontWeight:e.typography.fontWeightBold},modifierItalic:{fontStyle:"italic"},modifierUnderline:{textDecoration:"underline"},modifierForegroundBlack:{color:k.Z.black},modifierForegroundRed:{color:B.Z[500]},modifierForegroundGreen:{color:R.Z[500]},modifierForegroundYellow:{color:F.Z[500]},modifierForegroundBlue:{color:M.Z[500]},modifierForegroundMagenta:{color:N.Z[500]},modifierForegroundCyan:{color:T.Z[500]},modifierForegroundWhite:{color:k.Z.white},modifierForegroundGrey:{color:A.Z[500]},modifierBackgroundBlack:{background:k.Z.black},modifierBackgroundRed:{background:B.Z[500]},modifierBackgroundGreen:{background:R.Z[500]},modifierBackgroundYellow:{background:F.Z[500]},modifierBackgroundBlue:{background:M.Z[500]},modifierBackgroundMagenta:{background:N.Z[500]},modifierBackgroundCyan:{background:T.Z[500]},modifierBackgroundWhite:{background:k.Z.white},modifierBackgroundGrey:{background:A.Z[500]}}),{name:"BackstageLogViewer"});var w=d(72779),z=d.n(w),J=d(74600),K=d.n(J);function Q(e,n){const t=new Array;if(n.bold&&t.push(e.modifierBold),n.italic&&t.push(e.modifierItalic),n.underline&&t.push(e.modifierUnderline),n.foreground){const s=`modifierForeground${K()(n.foreground)}`;t.push(e[s])}if(n.background){const s=`modifierBackground${K()(n.background)}`;t.push(e[s])}return t.length>0?t.join(" "):void 0}function X(e,n){if(!n||!e.includes(n))return;const t=new Array;let s=0;for(;;){const o=e.indexOf(n,s);if(o===-1)break;const r=o+n.length;t.push({start:o,end:r}),s=r}return t}function q(e,n){const t=X(e.text,n);if(!t)return e.chunks;const s=new Array;let o=0,r=0,i=t[r];for(const c of e.chunks){const{text:l,modifiers:u}=c;if(!i||o+l.length<i.start){s.push(c),o+=l.length;continue}let a=0;for(;i;){const m=Math.max(i.start-o,0);if(m>l.length)break;const v=Math.min(i.end-o,l.length);if(m>a&&s.push({text:l.slice(a,m),modifiers:u}),v>m&&s.push({modifiers:u,highlight:r,text:l.slice(m,v)}),a=v,i.end-o===v)r+=1,i=t[r];else break}a<l.length&&s.push({text:l.slice(a),modifiers:u}),o+=l.length}return s}function _({line:e,classes:n,searchText:t,highlightResultIndex:s}){const o=(0,g.useMemo)(()=>q(e,t),[e,t]),r=(0,g.useMemo)(()=>o.map(({text:i,modifiers:c,highlight:l},u)=>(0,h.jsx)("span",{className:z()(Q(n,c),l!==void 0&&(l===s?n.textSelectedHighlight:n.textHighlight)),children:i},u)),[o,s,n]);return(0,h.jsx)(h.Fragment,{children:r})}var ee=d(86619),ne=d(90436),te=d(48049),oe=d(51209),H=d(36444);function se(e){const{resultCount:n,resultIndexStep:t,toggleShouldFilter:s}=e;var o;const r=(o=e.resultIndex)!==null&&o!==void 0?o:0,i=c=>{c.key==="Enter"&&(c.metaKey||c.ctrlKey||c.altKey?s():t(c.shiftKey))};return(0,h.jsxs)(h.Fragment,{children:[n!==void 0&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(y.Z,{size:"small",onClick:()=>t(!0),children:(0,h.jsx)(te.Z,{})}),(0,h.jsxs)(ne.Z,{children:[Math.min(r+1,n),"/",n]}),(0,h.jsx)(y.Z,{size:"small",onClick:()=>t(),children:(0,h.jsx)(oe.Z,{})})]}),(0,h.jsx)(ee.Z,{size:"small",variant:"standard",placeholder:"Search",value:e.searchInput,onKeyPress:i,onChange:c=>e.setSearchInput(c.target.value)}),(0,h.jsx)(y.Z,{size:"small",onClick:s,children:e.shouldFilter?(0,h.jsx)(H.Z,{color:"primary"}):(0,h.jsx)(H.Z,{color:"disabled"})})]})}var re=d(96686);function ie(e,n){if(!n)return{lines:e};const t=[],s=[];for(const o of e)if(o.text.includes(n)){t.push(o);let r=0,i=0;for(;;){const c=o.text.indexOf(n,r);if(c===-1)break;s.push({lineNumber:o.lineNumber,lineIndex:i++}),r=c+n.length}}return{lines:t,results:s}}function le(e){var n;const[t,s]=(0,g.useState)(""),o=t.toLocaleLowerCase("en-US"),[r,i]=(0,g.useState)(0),[c,l]=(0,re.O)(!1),u=(0,g.useMemo)(()=>ie(e,o),[e,o]),a=u.results?u.results[Math.min(r,u.results.length-1)]:void 0,f=(n=u.results)===null||n===void 0?void 0:n.length,m=v=>{if(v){if(f!==void 0){const x=Math.min(r-1,f-2);i(x<0?f-1:x)}}else if(f!==void 0){const x=r+1;i(x>=f?0:x)}};return{lines:c?u.lines:e,searchText:o,searchInput:t,setSearchInput:s,shouldFilter:c,toggleShouldFilter:l,resultCount:f,resultIndex:r,resultIndexStep:m,resultLine:a==null?void 0:a.lineNumber,resultLineIndex:a==null?void 0:a.lineIndex}}var O=d(25248),ce=d(95074);function de(e){const n=(0,O.h_)(O.VE),[t,s]=(0,g.useState)(),o=t?Math.min(t.start,t.end):void 0,r=t?Math.max(t.start,t.end):void 0,[{error:i},c]=(0,ce.Z)();return(0,g.useEffect)(()=>{i&&n.post(i)},[i,n]),{shouldShowButton(l){return o===l||r===l},isSelected(l){return t?o<=l&&l<=r:!1},setSelection(l,u){s(u?a=>a?{start:a.start,end:l}:{start:l,end:l}:a=>(a==null?void 0:a.start)===l&&(a==null?void 0:a.end)===l?void 0:{start:l,end:l})},copySelection(){if(t){const l=e.slice(Math.min(t.start,t.end)-1,Math.max(t.start,t.end)).map(u=>u.chunks.map(a=>a.text).join("")).join(`
|
|
2
|
+
`);c(l),s(void 0)}}}}function ae(e){const n=Y({classes:e.classes}),t=(0,g.useRef)(null),o=(0,g.useMemo)(()=>new P,[]).process(e.text),r=le(o),i=de(o),c=(0,V.TH)();(0,g.useEffect)(()=>{r.resultLine!==void 0&&t.current&&t.current.scrollToItem(r.resultLine-1,"center")},[r.resultLine]),(0,g.useEffect)(()=>{if(c.hash){const u=parseInt(c.hash.replace(/\D/g,""),10);i.setSelection(u,!1)}},[]);const l=(u,a)=>{i.setSelection(u,a.shiftKey)};return(0,h.jsx)(W.Z,{children:({height:u,width:a})=>(0,h.jsxs)("div",{style:{width:a,height:u},className:n.root,children:[(0,h.jsx)("div",{className:n.header,children:(0,h.jsx)(se,{...r})}),(0,h.jsx)(D.t7,{ref:t,className:n.log,height:u-E,width:a,itemData:r.lines,itemSize:20,itemCount:r.lines.length,children:({index:f,style:m,data:v})=>{const x=v[f],{lineNumber:p}=x;return(0,h.jsxs)("div",{style:{...m},className:z()(n.line,{[n.lineSelected]:i.isSelected(p)}),children:[i.shouldShowButton(p)&&(0,h.jsx)(y.Z,{"data-testid":"copy-button",size:"small",className:n.lineCopyButton,onClick:()=>i.copySelection(),children:(0,h.jsx)(U.Z,{fontSize:"inherit"})}),(0,h.jsx)("a",{role:"row",target:"_self",href:`#line-${p}`,className:n.lineNumber,onClick:S=>l(p,S),onKeyPress:S=>l(p,S),children:p}),(0,h.jsx)(_,{line:x,classes:n,searchText:r.searchText,highlightResultIndex:r.resultLine===p?r.resultLineIndex:void 0})]})}})]})})}}}]);})();
|
|
3
3
|
|
|
4
|
-
//# sourceMappingURL=6051.
|
|
4
|
+
//# sourceMappingURL=6051.3f1d6d7c.chunk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/AnsiProcessor.ts","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/styles.ts","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/LogLine.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/LogViewerControls.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/useLogViewerSearch.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/useLogViewerSelection.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/RealLogViewer.tsx"],"names":["ansiRegex","ansiRegexMaker","newlineRegex","codeModifiers","Object","fromEntries","entries","m","bold","italic","underline","_","foreground","background","map","code","modifier","AnsiLine","lastChunk","chunks","length","replaceLastChunk","newChunks","splice","text","c","join","toLocaleLowerCase","constructor","lineNumber","AnsiProcessor","process","lines","startsWith","newLines","lastLineIndex","lastLine","processLines","slice","modifiers","push","startingLineNumber","currentModifiers","currentLineNumber","prevIndex","lastIndex","match","exec","processText","line","index","fullText","processCode","HEADER_SIZE","useStyles","makeStyles","theme","root","palette","paper","header","height","display","alignItems","justifyContent","log","fontFamily","fontSize","typography","pxToRem","position","whiteSpace","action","hover","lineSelected","selected","lineCopyButton","paddingTop","paddingBottom","textAlign","width","marginRight","spacing","cursor","textHighlight","alpha","info","main","textSelectedHighlight","modifierBold","fontWeight","fontWeightBold","modifierItalic","fontStyle","modifierUnderline","textDecoration","modifierForegroundBlack","color","colors","modifierForegroundRed","modifierForegroundGreen","modifierForegroundYellow","modifierForegroundBlue","modifierForegroundMagenta","modifierForegroundCyan","modifierForegroundWhite","modifierForegroundGrey","modifierBackgroundBlack","modifierBackgroundRed","modifierBackgroundGreen","modifierBackgroundYellow","modifierBackgroundBlue","modifierBackgroundMagenta","modifierBackgroundCyan","modifierBackgroundWhite","modifierBackgroundGrey","name","getModifierClasses","classes","classNames","Array","key","startCase","undefined","findSearchResults","searchText","includes","searchResults","offset","start","indexOf","end","calculateHighlightedChunks","results","lineOffset","resultIndex","result","chunk","localOffset","localStart","Math","max","localEnd","min","highlight","LogLine","highlightResultIndex","useMemo","elements","span","className","classnames","LogViewerControls","props","resultCount","resultIndexStep","toggleShouldFilter","handleKeyPress","event","metaKey","ctrlKey","altKey","shiftKey","IconButton","size","onClick","ChevronLeftIcon","Typography","ChevronRightIcon","TextField","variant","placeholder","value","searchInput","onKeyPress","onChange","e","setSearchInput","target","shouldFilter","FilterListIcon","applySearchFilter","matchingLines","lineResultIndex","lineIndex","useLogViewerSearch","filter","useState","setResultIndex","useToggle","searchResult","decrement","next","resultLine","resultLineIndex","useLogViewerSelection","errorApi","useApi","errorApiRef","sel","setSelection","error","copyToClipboard","useCopyToClipboard","useEffect","post","shouldShowButton","isSelected","add","s","copySelection","copyText","l","RealLogViewer","listRef","useRef","search","selection","location","useLocation","current","scrollToItem","hash","parseInt","replace","handleSelectLine","AutoSizer","div","style","FixedSizeList","ref","itemData","itemSize","itemCount","data","data-testid","CopyIcon","a","role","href"],"mappings":"kSA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,SAEtDjI,C,MAEH,OAACoH,EAAOA,CACNhG,KAAMA,EACNqE,QAASA,EACTO,WAAY2F,EAAO3F,WACnBqB,qBACEsE,EAAOvB,aAAepK,EAClB2L,EAAOtB,gBACPvE,M,KAKd,C,OAMZ,C","file":"static/6051.f45bae28.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 ansiRegexMaker from 'ansi-regex';\n\nconst ansiRegex = ansiRegexMaker();\nconst newlineRegex = /\\n\\r?/g;\n\n// A mapping of how each escape code changes the modifiers\nconst codeModifiers = Object.fromEntries(\n Object.entries({\n 1: m => ({ ...m, bold: true }),\n 3: m => ({ ...m, italic: true }),\n 4: m => ({ ...m, underline: true }),\n 22: ({ bold: _, ...m }) => m,\n 23: ({ italic: _, ...m }) => m,\n 24: ({ underline: _, ...m }) => m,\n 30: m => ({ ...m, foreground: 'black' }),\n 31: m => ({ ...m, foreground: 'red' }),\n 32: m => ({ ...m, foreground: 'green' }),\n 33: m => ({ ...m, foreground: 'yellow' }),\n 34: m => ({ ...m, foreground: 'blue' }),\n 35: m => ({ ...m, foreground: 'magenta' }),\n 36: m => ({ ...m, foreground: 'cyan' }),\n 37: m => ({ ...m, foreground: 'white' }),\n 39: ({ foreground: _, ...m }) => m,\n 90: m => ({ ...m, foreground: 'grey' }),\n 40: m => ({ ...m, background: 'black' }),\n 41: m => ({ ...m, background: 'red' }),\n 42: m => ({ ...m, background: 'green' }),\n 43: m => ({ ...m, background: 'yellow' }),\n 44: m => ({ ...m, background: 'blue' }),\n 45: m => ({ ...m, background: 'magenta' }),\n 46: m => ({ ...m, background: 'cyan' }),\n 47: m => ({ ...m, background: 'white' }),\n 49: ({ background: _, ...m }) => m,\n } as Record<string, (m: ChunkModifiers) => ChunkModifiers>).map(\n ([code, modifier]) => [`\\x1b[${code}m`, modifier],\n ),\n);\n\nexport type AnsiColor =\n | 'black'\n | 'red'\n | 'green'\n | 'yellow'\n | 'blue'\n | 'magenta'\n | 'cyan'\n | 'white'\n | 'grey';\n\nexport interface ChunkModifiers {\n foreground?: AnsiColor;\n background?: AnsiColor;\n bold?: boolean;\n italic?: boolean;\n underline?: boolean;\n}\n\nexport interface AnsiChunk {\n text: string;\n modifiers: ChunkModifiers;\n}\n\nexport class AnsiLine {\n text: string;\n\n constructor(\n readonly lineNumber: number = 1,\n readonly chunks: AnsiChunk[] = [],\n ) {\n this.text = chunks\n .map(c => c.text)\n .join('')\n .toLocaleLowerCase('en-US');\n }\n\n lastChunk(): AnsiChunk | undefined {\n return this.chunks[this.chunks.length - 1];\n }\n\n replaceLastChunk(newChunks?: AnsiChunk[]) {\n if (newChunks) {\n this.chunks.splice(this.chunks.length - 1, 1, ...newChunks);\n this.text = this.chunks\n .map(c => c.text)\n .join('')\n .toLocaleLowerCase('en-US');\n }\n }\n}\n\nexport class AnsiProcessor {\n private text: string = '';\n private lines: AnsiLine[] = [];\n\n /**\n * Processes a chunk of text while keeping internal state that optimizes\n * subsequent processing that appends to the text.\n */\n process(text: string): AnsiLine[] {\n if (this.text === text) {\n return this.lines;\n }\n\n if (text.startsWith(this.text)) {\n const lastLineIndex = this.lines.length > 0 ? this.lines.length - 1 : 0;\n const lastLine = this.lines[lastLineIndex] ?? new AnsiLine();\n const lastChunk = lastLine.lastChunk();\n\n const newLines = this.processLines(\n (lastChunk?.text ?? '') + text.slice(this.text.length),\n lastChunk?.modifiers,\n lastLine?.lineNumber,\n );\n lastLine.replaceLastChunk(newLines[0]?.chunks);\n\n this.lines[lastLineIndex] = lastLine;\n this.lines.push(...newLines.slice(1));\n } else {\n this.lines = this.processLines(text);\n }\n this.text = text;\n\n return this.lines;\n }\n\n // Split a chunk of text up into lines and process each line individually\n private processLines = (\n text: string,\n modifiers: ChunkModifiers = {},\n startingLineNumber: number = 1,\n ): AnsiLine[] => {\n const lines: AnsiLine[] = [];\n\n let currentModifiers = modifiers;\n let currentLineNumber = startingLineNumber;\n\n let prevIndex = 0;\n newlineRegex.lastIndex = 0;\n for (;;) {\n const match = newlineRegex.exec(text);\n if (!match) {\n const chunks = this.processText(\n text.slice(prevIndex),\n currentModifiers,\n );\n lines.push(new AnsiLine(currentLineNumber, chunks));\n return lines;\n }\n\n const line = text.slice(prevIndex, match.index);\n prevIndex = match.index + match[0].length;\n\n const chunks = this.processText(line, currentModifiers);\n lines.push(new AnsiLine(currentLineNumber, chunks));\n\n // Modifiers that are active in the last chunk are carried over to the next line\n currentModifiers =\n chunks[chunks.length - 1].modifiers ?? currentModifiers;\n currentLineNumber += 1;\n }\n };\n\n // Processing of a one individual text chunk\n private processText = (\n fullText: string,\n modifiers: ChunkModifiers,\n ): AnsiChunk[] => {\n const chunks: AnsiChunk[] = [];\n\n let currentModifiers = modifiers;\n\n let prevIndex = 0;\n ansiRegex.lastIndex = 0;\n for (;;) {\n const match = ansiRegex.exec(fullText);\n if (!match) {\n chunks.push({\n text: fullText.slice(prevIndex),\n modifiers: currentModifiers,\n });\n return chunks;\n }\n\n const text = fullText.slice(prevIndex, match.index);\n chunks.push({ text, modifiers: currentModifiers });\n\n // For every escape code that we encounter we keep track of where the\n // next chunk of text starts, and what modifiers it has\n prevIndex = match.index + match[0].length;\n currentModifiers = this.processCode(match[0], currentModifiers);\n }\n };\n\n private processCode = (\n code: string,\n modifiers: ChunkModifiers,\n ): ChunkModifiers => {\n return codeModifiers[code]?.(modifiers) ?? modifiers;\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 { alpha, makeStyles } from '@material-ui/core/styles';\nimport * as colors from '@material-ui/core/colors';\n\nexport const HEADER_SIZE = 40;\n\n/** @public Class keys for overriding LogViewer styles */\nexport type LogViewerClassKey =\n | 'root'\n | 'header'\n | 'log'\n | 'line'\n | 'lineSelected'\n | 'lineCopyButton'\n | 'lineNumber'\n | 'textHighlight'\n | 'textSelectedHighlight'\n | 'modifierBold'\n | 'modifierItalic'\n | 'modifierUnderline'\n | 'modifierForegroundBlack'\n | 'modifierForegroundRed'\n | 'modifierForegroundGreen'\n | 'modifierForegroundYellow'\n | 'modifierForegroundBlue'\n | 'modifierForegroundMagenta'\n | 'modifierForegroundCyan'\n | 'modifierForegroundWhite'\n | 'modifierForegroundGrey'\n | 'modifierBackgroundBlack'\n | 'modifierBackgroundRed'\n | 'modifierBackgroundGreen'\n | 'modifierBackgroundYellow'\n | 'modifierBackgroundBlue'\n | 'modifierBackgroundMagenta'\n | 'modifierBackgroundCyan'\n | 'modifierBackgroundWhite'\n | 'modifierBackgroundGrey';\n\nexport const useStyles = makeStyles(\n theme => ({\n root: {\n background: theme.palette.background.paper,\n },\n header: {\n height: HEADER_SIZE,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'flex-end',\n },\n log: {\n fontFamily: '\"Monaco\", monospace',\n fontSize: theme.typography.pxToRem(12),\n },\n line: {\n position: 'relative',\n whiteSpace: 'pre',\n\n '&:hover': {\n background: theme.palette.action.hover,\n },\n },\n lineSelected: {\n background: theme.palette.action.selected,\n\n '&:hover': {\n background: theme.palette.action.selected,\n },\n },\n lineCopyButton: {\n position: 'absolute',\n paddingTop: 0,\n paddingBottom: 0,\n },\n lineNumber: {\n display: 'inline-block',\n textAlign: 'end',\n width: 60,\n marginRight: theme.spacing(1),\n cursor: 'pointer',\n },\n textHighlight: {\n background: alpha(theme.palette.info.main, 0.15),\n },\n textSelectedHighlight: {\n background: alpha(theme.palette.info.main, 0.4),\n },\n modifierBold: {\n fontWeight: theme.typography.fontWeightBold,\n },\n modifierItalic: {\n fontStyle: 'italic',\n },\n modifierUnderline: {\n textDecoration: 'underline',\n },\n modifierForegroundBlack: {\n color: colors.common.black,\n },\n modifierForegroundRed: {\n color: colors.red[500],\n },\n modifierForegroundGreen: {\n color: colors.green[500],\n },\n modifierForegroundYellow: {\n color: colors.yellow[500],\n },\n modifierForegroundBlue: {\n color: colors.blue[500],\n },\n modifierForegroundMagenta: {\n color: colors.purple[500],\n },\n modifierForegroundCyan: {\n color: colors.cyan[500],\n },\n modifierForegroundWhite: {\n color: colors.common.white,\n },\n modifierForegroundGrey: {\n color: colors.grey[500],\n },\n modifierBackgroundBlack: {\n background: colors.common.black,\n },\n modifierBackgroundRed: {\n background: colors.red[500],\n },\n modifierBackgroundGreen: {\n background: colors.green[500],\n },\n modifierBackgroundYellow: {\n background: colors.yellow[500],\n },\n modifierBackgroundBlue: {\n background: colors.blue[500],\n },\n modifierBackgroundMagenta: {\n background: colors.purple[500],\n },\n modifierBackgroundCyan: {\n background: colors.cyan[500],\n },\n modifierBackgroundWhite: {\n background: colors.common.white,\n },\n modifierBackgroundGrey: {\n background: colors.grey[500],\n },\n }),\n { name: 'BackstageLogViewer' },\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, { useMemo } from 'react';\nimport { AnsiChunk, AnsiLine, ChunkModifiers } from './AnsiProcessor';\nimport startCase from 'lodash/startCase';\nimport classnames from 'classnames';\nimport { useStyles } from './styles';\n\nexport function getModifierClasses(\n classes: ReturnType<typeof useStyles>,\n modifiers: ChunkModifiers,\n) {\n const classNames = new Array<string>();\n if (modifiers.bold) {\n classNames.push(classes.modifierBold);\n }\n if (modifiers.italic) {\n classNames.push(classes.modifierItalic);\n }\n if (modifiers.underline) {\n classNames.push(classes.modifierUnderline);\n }\n if (modifiers.foreground) {\n const key = `modifierForeground${startCase(\n modifiers.foreground,\n )}` as keyof typeof classes;\n classNames.push(classes[key]);\n }\n if (modifiers.background) {\n const key = `modifierBackground${startCase(\n modifiers.background,\n )}` as keyof typeof classes;\n classNames.push(classes[key]);\n }\n return classNames.length > 0 ? classNames.join(' ') : undefined;\n}\n\nexport function findSearchResults(text: string, searchText: string) {\n if (!searchText || !text.includes(searchText)) {\n return undefined;\n }\n const searchResults = new Array<{ start: number; end: number }>();\n let offset = 0;\n for (;;) {\n const start = text.indexOf(searchText, offset);\n if (start === -1) {\n break;\n }\n const end = start + searchText.length;\n searchResults.push({ start, end });\n offset = end;\n }\n return searchResults;\n}\n\nexport interface HighlightAnsiChunk extends AnsiChunk {\n highlight?: number;\n}\n\nexport function calculateHighlightedChunks(\n line: AnsiLine,\n searchText: string,\n): HighlightAnsiChunk[] {\n const results = findSearchResults(line.text, searchText);\n if (!results) {\n return line.chunks;\n }\n\n const chunks = new Array<HighlightAnsiChunk>();\n\n let lineOffset = 0;\n let resultIndex = 0;\n let result = results[resultIndex];\n for (const chunk of line.chunks) {\n const { text, modifiers } = chunk;\n if (!result || lineOffset + text.length < result.start) {\n chunks.push(chunk);\n lineOffset += text.length;\n continue;\n }\n\n let localOffset = 0;\n while (result) {\n const localStart = Math.max(result.start - lineOffset, 0);\n if (localStart > text.length) {\n break; // The next result is not in this chunk\n }\n\n const localEnd = Math.min(result.end - lineOffset, text.length);\n\n const hasTextBeforeResult = localStart > localOffset;\n if (hasTextBeforeResult) {\n chunks.push({ text: text.slice(localOffset, localStart), modifiers });\n }\n const hasResultText = localEnd > localStart;\n if (hasResultText) {\n chunks.push({\n modifiers,\n highlight: resultIndex,\n text: text.slice(localStart, localEnd),\n });\n }\n\n localOffset = localEnd;\n\n const foundCompleteResult = result.end - lineOffset === localEnd;\n if (foundCompleteResult) {\n resultIndex += 1;\n result = results[resultIndex];\n } else {\n break; // The rest of the result is in the following chunks\n }\n }\n\n const hasTextAfterResult = localOffset < text.length;\n if (hasTextAfterResult) {\n chunks.push({ text: text.slice(localOffset), modifiers });\n }\n\n lineOffset += text.length;\n }\n\n return chunks;\n}\n\nexport interface LogLineProps {\n line: AnsiLine;\n classes: ReturnType<typeof useStyles>;\n searchText: string;\n highlightResultIndex?: number;\n}\n\nexport function LogLine({\n line,\n classes,\n searchText,\n highlightResultIndex,\n}: LogLineProps) {\n const chunks = useMemo(\n () => calculateHighlightedChunks(line, searchText),\n [line, searchText],\n );\n\n const elements = useMemo(\n () =>\n chunks.map(({ text, modifiers, highlight }, index) => (\n <span\n key={index}\n className={classnames(\n getModifierClasses(classes, modifiers),\n highlight !== undefined &&\n (highlight === highlightResultIndex\n ? classes.textSelectedHighlight\n : classes.textHighlight),\n )}\n >\n {text}\n </span>\n )),\n [chunks, highlightResultIndex, classes],\n );\n\n return <>{elements}</>;\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 from 'react';\nimport IconButton from '@material-ui/core/IconButton';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport ChevronLeftIcon from '@material-ui/icons/ChevronLeft';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport FilterListIcon from '@material-ui/icons/FilterList';\nimport { LogViewerSearch } from './useLogViewerSearch';\n\nexport interface LogViewerControlsProps extends LogViewerSearch {}\n\nexport function LogViewerControls(props: LogViewerControlsProps) {\n const { resultCount, resultIndexStep, toggleShouldFilter } = props;\n const resultIndex = props.resultIndex ?? 0;\n\n const handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n if (event.metaKey || event.ctrlKey || event.altKey) {\n toggleShouldFilter();\n } else {\n resultIndexStep(event.shiftKey);\n }\n }\n };\n\n return (\n <>\n {resultCount !== undefined && (\n <>\n <IconButton size=\"small\" onClick={() => resultIndexStep(true)}>\n <ChevronLeftIcon />\n </IconButton>\n <Typography>\n {Math.min(resultIndex + 1, resultCount)}/{resultCount}\n </Typography>\n <IconButton size=\"small\" onClick={() => resultIndexStep()}>\n <ChevronRightIcon />\n </IconButton>\n </>\n )}\n <TextField\n size=\"small\"\n variant=\"standard\"\n placeholder=\"Search\"\n value={props.searchInput}\n onKeyPress={handleKeyPress}\n onChange={e => props.setSearchInput(e.target.value)}\n />\n <IconButton size=\"small\" onClick={toggleShouldFilter}>\n {props.shouldFilter ? (\n <FilterListIcon color=\"primary\" />\n ) : (\n <FilterListIcon color=\"disabled\" />\n )}\n </IconButton>\n </>\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 { useMemo, useState } from 'react';\nimport { useToggle } from '@react-hookz/web';\nimport { AnsiLine } from './AnsiProcessor';\n\nexport function applySearchFilter(lines: AnsiLine[], searchText: string) {\n if (!searchText) {\n return { lines };\n }\n\n const matchingLines = [];\n const searchResults = [];\n for (const line of lines) {\n if (line.text.includes(searchText)) {\n matchingLines.push(line);\n\n let offset = 0;\n let lineResultIndex = 0;\n for (;;) {\n const start = line.text.indexOf(searchText, offset);\n if (start === -1) {\n break;\n }\n searchResults.push({\n lineNumber: line.lineNumber,\n lineIndex: lineResultIndex++,\n });\n offset = start + searchText.length;\n }\n }\n }\n\n return {\n lines: matchingLines,\n results: searchResults,\n };\n}\n\nexport interface LogViewerSearch {\n lines: AnsiLine[];\n\n searchText: string;\n searchInput: string;\n setSearchInput: (searchInput: string) => void;\n\n shouldFilter: boolean;\n toggleShouldFilter: () => void;\n\n resultCount: number | undefined;\n resultIndex: number | undefined;\n resultIndexStep: (decrement?: boolean) => void;\n\n resultLine: number | undefined;\n resultLineIndex: number | undefined;\n}\n\nexport function useLogViewerSearch(lines: AnsiLine[]): LogViewerSearch {\n const [searchInput, setSearchInput] = useState('');\n const searchText = searchInput.toLocaleLowerCase('en-US');\n\n const [resultIndex, setResultIndex] = useState<number>(0);\n\n const [shouldFilter, toggleShouldFilter] = useToggle(false);\n\n const filter = useMemo(\n () => applySearchFilter(lines, searchText),\n [lines, searchText],\n );\n\n const searchResult = filter.results\n ? filter.results[Math.min(resultIndex, filter.results.length - 1)]\n : undefined;\n const resultCount = filter.results?.length;\n\n const resultIndexStep = (decrement?: boolean) => {\n if (decrement) {\n if (resultCount !== undefined) {\n const next = Math.min(resultIndex - 1, resultCount - 2);\n setResultIndex(next < 0 ? resultCount - 1 : next);\n }\n } else {\n if (resultCount !== undefined) {\n const next = resultIndex + 1;\n setResultIndex(next >= resultCount ? 0 : next);\n }\n }\n };\n\n return {\n lines: shouldFilter ? filter.lines : lines,\n searchText,\n searchInput,\n setSearchInput,\n shouldFilter,\n toggleShouldFilter,\n resultCount,\n resultIndex,\n resultIndexStep,\n resultLine: searchResult?.lineNumber,\n resultLineIndex: searchResult?.lineIndex,\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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useEffect, useState } from 'react';\nimport useCopyToClipboard from 'react-use/lib/useCopyToClipboard';\nimport { AnsiLine } from './AnsiProcessor';\n\nexport function useLogViewerSelection(lines: AnsiLine[]) {\n const errorApi = useApi(errorApiRef);\n const [sel, setSelection] = useState<{ start: number; end: number }>();\n const start = sel ? Math.min(sel.start, sel.end) : undefined;\n const end = sel ? Math.max(sel.start, sel.end) : undefined;\n\n const [{ error }, copyToClipboard] = useCopyToClipboard();\n\n useEffect(() => {\n if (error) {\n errorApi.post(error);\n }\n }, [error, errorApi]);\n\n return {\n shouldShowButton(line: number) {\n return start === line || end === line;\n },\n isSelected(line: number) {\n if (!sel) {\n return false;\n }\n return start! <= line && line <= end!;\n },\n setSelection(line: number, add: boolean) {\n if (add) {\n setSelection(s =>\n s ? { start: s.start, end: line } : { start: line, end: line },\n );\n } else {\n setSelection(s =>\n s?.start === line && s?.end === line\n ? undefined\n : { start: line, end: line },\n );\n }\n },\n copySelection() {\n if (sel) {\n const copyText = lines\n .slice(Math.min(sel.start, sel.end) - 1, Math.max(sel.start, sel.end))\n .map(l => l.chunks.map(c => c.text).join(''))\n .join('\\n');\n copyToClipboard(copyText);\n setSelection(undefined);\n }\n },\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, { useEffect, useMemo, useRef } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport IconButton from '@material-ui/core/IconButton';\nimport CopyIcon from '@material-ui/icons/FileCopy';\nimport AutoSizer from 'react-virtualized-auto-sizer';\nimport { FixedSizeList } from 'react-window';\nimport { AnsiProcessor } from './AnsiProcessor';\nimport { HEADER_SIZE, useStyles } from './styles';\nimport classnames from 'classnames';\nimport { LogLine } from './LogLine';\nimport { LogViewerControls } from './LogViewerControls';\nimport { useLogViewerSearch } from './useLogViewerSearch';\nimport { useLogViewerSelection } from './useLogViewerSelection';\n\nexport interface RealLogViewerProps {\n text: string;\n classes?: { root?: string };\n}\n\nexport function RealLogViewer(props: RealLogViewerProps) {\n const classes = useStyles({ classes: props.classes });\n const listRef = useRef<FixedSizeList | null>(null);\n\n // The processor keeps state that optimizes appending to the text\n const processor = useMemo(() => new AnsiProcessor(), []);\n const lines = processor.process(props.text);\n\n const search = useLogViewerSearch(lines);\n const selection = useLogViewerSelection(lines);\n const location = useLocation();\n\n useEffect(() => {\n if (search.resultLine !== undefined && listRef.current) {\n listRef.current.scrollToItem(search.resultLine - 1, 'center');\n }\n }, [search.resultLine]);\n\n useEffect(() => {\n if (location.hash) {\n // #line-6 -> 6\n const line = parseInt(location.hash.replace(/\\D/g, ''), 10);\n selection.setSelection(line, false);\n }\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleSelectLine = (\n line: number,\n event: { shiftKey: boolean; preventDefault: () => void },\n ) => {\n selection.setSelection(line, event.shiftKey);\n };\n\n return (\n <AutoSizer>\n {({ height, width }) => (\n <div style={{ width, height }} className={classes.root}>\n <div className={classes.header}>\n <LogViewerControls {...search} />\n </div>\n <FixedSizeList\n ref={listRef}\n className={classes.log}\n height={height - HEADER_SIZE}\n width={width}\n itemData={search.lines}\n itemSize={20}\n itemCount={search.lines.length}\n >\n {({ index, style, data }) => {\n const line = data[index];\n const { lineNumber } = line;\n return (\n <div\n style={{ ...style }}\n className={classnames(classes.line, {\n [classes.lineSelected]: selection.isSelected(lineNumber),\n })}\n >\n {selection.shouldShowButton(lineNumber) && (\n <IconButton\n data-testid=\"copy-button\"\n size=\"small\"\n className={classes.lineCopyButton}\n onClick={() => selection.copySelection()}\n >\n <CopyIcon fontSize=\"inherit\" />\n </IconButton>\n )}\n <a\n role=\"row\"\n target=\"_self\"\n href={`#line-${lineNumber}`}\n className={classes.lineNumber}\n onClick={event => handleSelectLine(lineNumber, event)}\n onKeyPress={event => handleSelectLine(lineNumber, event)}\n >\n {lineNumber}\n </a>\n <LogLine\n line={line}\n classes={classes}\n searchText={search.searchText}\n highlightResultIndex={\n search.resultLine === lineNumber\n ? search.resultLineIndex\n : undefined\n }\n />\n </div>\n );\n }}\n </FixedSizeList>\n </div>\n )}\n </AutoSizer>\n );\n}\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/AnsiProcessor.ts","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/styles.ts","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/LogLine.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/LogViewerControls.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/useLogViewerSearch.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/useLogViewerSelection.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/LogViewer/RealLogViewer.tsx"],"names":["ansiRegex","ansiRegexMaker","newlineRegex","codeModifiers","Object","fromEntries","entries","m","bold","italic","underline","_","foreground","background","map","code","modifier","AnsiLine","lastChunk","chunks","length","replaceLastChunk","newChunks","splice","text","c","join","toLocaleLowerCase","constructor","lineNumber","AnsiProcessor","process","lines","startsWith","newLines","lastLineIndex","lastLine","processLines","slice","modifiers","push","startingLineNumber","currentModifiers","currentLineNumber","prevIndex","lastIndex","match","exec","processText","line","index","fullText","processCode","HEADER_SIZE","useStyles","makeStyles","theme","root","palette","paper","header","height","display","alignItems","justifyContent","log","fontFamily","fontSize","typography","pxToRem","position","whiteSpace","action","hover","lineSelected","selected","lineCopyButton","paddingTop","paddingBottom","textAlign","width","marginRight","spacing","cursor","textHighlight","alpha","info","main","textSelectedHighlight","modifierBold","fontWeight","fontWeightBold","modifierItalic","fontStyle","modifierUnderline","textDecoration","modifierForegroundBlack","color","colors","modifierForegroundRed","modifierForegroundGreen","modifierForegroundYellow","modifierForegroundBlue","modifierForegroundMagenta","modifierForegroundCyan","modifierForegroundWhite","modifierForegroundGrey","modifierBackgroundBlack","modifierBackgroundRed","modifierBackgroundGreen","modifierBackgroundYellow","modifierBackgroundBlue","modifierBackgroundMagenta","modifierBackgroundCyan","modifierBackgroundWhite","modifierBackgroundGrey","name","getModifierClasses","classes","classNames","Array","key","startCase","undefined","findSearchResults","searchText","includes","searchResults","offset","start","indexOf","end","calculateHighlightedChunks","results","lineOffset","resultIndex","result","chunk","localOffset","localStart","Math","max","localEnd","min","highlight","LogLine","highlightResultIndex","useMemo","elements","span","className","classnames","LogViewerControls","props","resultCount","resultIndexStep","toggleShouldFilter","handleKeyPress","event","metaKey","ctrlKey","altKey","shiftKey","IconButton","size","onClick","ChevronLeftIcon","Typography","ChevronRightIcon","TextField","variant","placeholder","value","searchInput","onKeyPress","onChange","e","setSearchInput","target","shouldFilter","FilterListIcon","applySearchFilter","matchingLines","lineResultIndex","lineIndex","useLogViewerSearch","filter","useState","setResultIndex","useToggle","searchResult","decrement","next","resultLine","resultLineIndex","useLogViewerSelection","errorApi","useApi","errorApiRef","sel","setSelection","error","copyToClipboard","useCopyToClipboard","useEffect","post","shouldShowButton","isSelected","add","s","copySelection","copyText","l","RealLogViewer","listRef","useRef","search","selection","location","useLocation","current","scrollToItem","hash","parseInt","replace","handleSelectLine","AutoSizer","div","style","FixedSizeList","ref","itemData","itemSize","itemCount","data","data-testid","CopyIcon","a","role","href"],"mappings":"kSAkBA,MAAMA,G,EAAYC,KAAe,EAC3BC,EAAe,SAGfC,EAAgBC,OAAOC,YAC3BD,OAAOE,QAAQ,CACb,EAAGC,IAAM,CAAE,GAAGA,EAAGC,KAAM,EAAK,GAC5B,EAAGD,IAAM,CAAE,GAAGA,EAAGE,OAAQ,EAAK,GAC9B,EAAGF,IAAM,CAAE,GAAGA,EAAGG,UAAW,EAAK,GACjC,GAAI,CAAC,CAAEF,KAAMG,KAAMJ,CAAE,IAAMA,EAC3B,GAAI,CAAC,CAAEE,OAAQE,KAAMJ,CAAE,IAAMA,EAC7B,GAAI,CAAC,CAAEG,UAAWC,KAAMJ,CAAE,IAAMA,EAChC,GAAIA,IAAM,CAAE,GAAGA,EAAGK,WAAY,OAAQ,GACtC,GAAIL,IAAM,CAAE,GAAGA,EAAGK,WAAY,KAAM,GACpC,GAAIL,IAAM,CAAE,GAAGA,EAAGK,WAAY,OAAQ,GACtC,GAAIL,IAAM,CAAE,GAAGA,EAAGK,WAAY,QAAS,GACvC,GAAIL,IAAM,CAAE,GAAGA,EAAGK,WAAY,MAAO,GACrC,GAAIL,IAAM,CAAE,GAAGA,EAAGK,WAAY,SAAU,GACxC,GAAIL,IAAM,CAAE,GAAGA,EAAGK,WAAY,MAAO,GACrC,GAAIL,IAAM,CAAE,GAAGA,EAAGK,WAAY,OAAQ,GACtC,GAAI,CAAC,CAAEA,WAAYD,KAAMJ,CAAE,IAAMA,EACjC,GAAIA,IAAM,CAAE,GAAGA,EAAGK,WAAY,MAAO,GACrC,GAAIL,IAAM,CAAE,GAAGA,EAAGM,WAAY,OAAQ,GACtC,GAAIN,IAAM,CAAE,GAAGA,EAAGM,WAAY,KAAM,GACpC,GAAIN,IAAM,CAAE,GAAGA,EAAGM,WAAY,OAAQ,GACtC,GAAIN,IAAM,CAAE,G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H,UAAWhC,EAAQzF,WACnBwI,QAASP,GAASmE,EAAiBpM,EAAYiI,CAAK,EACpDgB,WAAYhB,GAASmE,EAAiBpM,EAAYiI,CAAK,E,SAEtDjI,C,MAEH,OAACoH,EAAOA,CACNhG,KAAMA,EACNqE,QAASA,EACTO,WAAY2F,EAAO3F,WACnBqB,qBACEsE,EAAOvB,aAAepK,EAClB2L,EAAOtB,gBACPvE,M,KAKd,C,OAMZ,C","file":"static/6051.3f1d6d7c.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 ansiRegexMaker from 'ansi-regex';\n\nconst ansiRegex = ansiRegexMaker();\nconst newlineRegex = /\\n\\r?/g;\n\n// A mapping of how each escape code changes the modifiers\nconst codeModifiers = Object.fromEntries(\n Object.entries({\n 1: m => ({ ...m, bold: true }),\n 3: m => ({ ...m, italic: true }),\n 4: m => ({ ...m, underline: true }),\n 22: ({ bold: _, ...m }) => m,\n 23: ({ italic: _, ...m }) => m,\n 24: ({ underline: _, ...m }) => m,\n 30: m => ({ ...m, foreground: 'black' }),\n 31: m => ({ ...m, foreground: 'red' }),\n 32: m => ({ ...m, foreground: 'green' }),\n 33: m => ({ ...m, foreground: 'yellow' }),\n 34: m => ({ ...m, foreground: 'blue' }),\n 35: m => ({ ...m, foreground: 'magenta' }),\n 36: m => ({ ...m, foreground: 'cyan' }),\n 37: m => ({ ...m, foreground: 'white' }),\n 39: ({ foreground: _, ...m }) => m,\n 90: m => ({ ...m, foreground: 'grey' }),\n 40: m => ({ ...m, background: 'black' }),\n 41: m => ({ ...m, background: 'red' }),\n 42: m => ({ ...m, background: 'green' }),\n 43: m => ({ ...m, background: 'yellow' }),\n 44: m => ({ ...m, background: 'blue' }),\n 45: m => ({ ...m, background: 'magenta' }),\n 46: m => ({ ...m, background: 'cyan' }),\n 47: m => ({ ...m, background: 'white' }),\n 49: ({ background: _, ...m }) => m,\n } as Record<string, (m: ChunkModifiers) => ChunkModifiers>).map(\n ([code, modifier]) => [`\\x1b[${code}m`, modifier],\n ),\n);\n\nexport type AnsiColor =\n | 'black'\n | 'red'\n | 'green'\n | 'yellow'\n | 'blue'\n | 'magenta'\n | 'cyan'\n | 'white'\n | 'grey';\n\nexport interface ChunkModifiers {\n foreground?: AnsiColor;\n background?: AnsiColor;\n bold?: boolean;\n italic?: boolean;\n underline?: boolean;\n}\n\nexport interface AnsiChunk {\n text: string;\n modifiers: ChunkModifiers;\n}\n\nexport class AnsiLine {\n text: string;\n\n constructor(\n readonly lineNumber: number = 1,\n readonly chunks: AnsiChunk[] = [],\n ) {\n this.text = chunks\n .map(c => c.text)\n .join('')\n .toLocaleLowerCase('en-US');\n }\n\n lastChunk(): AnsiChunk | undefined {\n return this.chunks[this.chunks.length - 1];\n }\n\n replaceLastChunk(newChunks?: AnsiChunk[]) {\n if (newChunks) {\n this.chunks.splice(this.chunks.length - 1, 1, ...newChunks);\n this.text = this.chunks\n .map(c => c.text)\n .join('')\n .toLocaleLowerCase('en-US');\n }\n }\n}\n\nexport class AnsiProcessor {\n private text: string = '';\n private lines: AnsiLine[] = [];\n\n /**\n * Processes a chunk of text while keeping internal state that optimizes\n * subsequent processing that appends to the text.\n */\n process(text: string): AnsiLine[] {\n if (this.text === text) {\n return this.lines;\n }\n\n if (text.startsWith(this.text)) {\n const lastLineIndex = this.lines.length > 0 ? this.lines.length - 1 : 0;\n const lastLine = this.lines[lastLineIndex] ?? new AnsiLine();\n const lastChunk = lastLine.lastChunk();\n\n const newLines = this.processLines(\n (lastChunk?.text ?? '') + text.slice(this.text.length),\n lastChunk?.modifiers,\n lastLine?.lineNumber,\n );\n lastLine.replaceLastChunk(newLines[0]?.chunks);\n\n this.lines[lastLineIndex] = lastLine;\n this.lines.push(...newLines.slice(1));\n } else {\n this.lines = this.processLines(text);\n }\n this.text = text;\n\n return this.lines;\n }\n\n // Split a chunk of text up into lines and process each line individually\n private processLines = (\n text: string,\n modifiers: ChunkModifiers = {},\n startingLineNumber: number = 1,\n ): AnsiLine[] => {\n const lines: AnsiLine[] = [];\n\n let currentModifiers = modifiers;\n let currentLineNumber = startingLineNumber;\n\n let prevIndex = 0;\n newlineRegex.lastIndex = 0;\n for (;;) {\n const match = newlineRegex.exec(text);\n if (!match) {\n const chunks = this.processText(\n text.slice(prevIndex),\n currentModifiers,\n );\n lines.push(new AnsiLine(currentLineNumber, chunks));\n return lines;\n }\n\n const line = text.slice(prevIndex, match.index);\n prevIndex = match.index + match[0].length;\n\n const chunks = this.processText(line, currentModifiers);\n lines.push(new AnsiLine(currentLineNumber, chunks));\n\n // Modifiers that are active in the last chunk are carried over to the next line\n currentModifiers =\n chunks[chunks.length - 1].modifiers ?? currentModifiers;\n currentLineNumber += 1;\n }\n };\n\n // Processing of a one individual text chunk\n private processText = (\n fullText: string,\n modifiers: ChunkModifiers,\n ): AnsiChunk[] => {\n const chunks: AnsiChunk[] = [];\n\n let currentModifiers = modifiers;\n\n let prevIndex = 0;\n ansiRegex.lastIndex = 0;\n for (;;) {\n const match = ansiRegex.exec(fullText);\n if (!match) {\n chunks.push({\n text: fullText.slice(prevIndex),\n modifiers: currentModifiers,\n });\n return chunks;\n }\n\n const text = fullText.slice(prevIndex, match.index);\n chunks.push({ text, modifiers: currentModifiers });\n\n // For every escape code that we encounter we keep track of where the\n // next chunk of text starts, and what modifiers it has\n prevIndex = match.index + match[0].length;\n currentModifiers = this.processCode(match[0], currentModifiers);\n }\n };\n\n private processCode = (\n code: string,\n modifiers: ChunkModifiers,\n ): ChunkModifiers => {\n return codeModifiers[code]?.(modifiers) ?? modifiers;\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 { alpha, makeStyles } from '@material-ui/core/styles';\nimport * as colors from '@material-ui/core/colors';\n\nexport const HEADER_SIZE = 40;\n\n/** @public Class keys for overriding LogViewer styles */\nexport type LogViewerClassKey =\n | 'root'\n | 'header'\n | 'log'\n | 'line'\n | 'lineSelected'\n | 'lineCopyButton'\n | 'lineNumber'\n | 'textHighlight'\n | 'textSelectedHighlight'\n | 'modifierBold'\n | 'modifierItalic'\n | 'modifierUnderline'\n | 'modifierForegroundBlack'\n | 'modifierForegroundRed'\n | 'modifierForegroundGreen'\n | 'modifierForegroundYellow'\n | 'modifierForegroundBlue'\n | 'modifierForegroundMagenta'\n | 'modifierForegroundCyan'\n | 'modifierForegroundWhite'\n | 'modifierForegroundGrey'\n | 'modifierBackgroundBlack'\n | 'modifierBackgroundRed'\n | 'modifierBackgroundGreen'\n | 'modifierBackgroundYellow'\n | 'modifierBackgroundBlue'\n | 'modifierBackgroundMagenta'\n | 'modifierBackgroundCyan'\n | 'modifierBackgroundWhite'\n | 'modifierBackgroundGrey';\n\nexport const useStyles = makeStyles(\n theme => ({\n root: {\n background: theme.palette.background.paper,\n },\n header: {\n height: HEADER_SIZE,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'flex-end',\n },\n log: {\n fontFamily: '\"Monaco\", monospace',\n fontSize: theme.typography.pxToRem(12),\n },\n line: {\n position: 'relative',\n whiteSpace: 'pre',\n\n '&:hover': {\n background: theme.palette.action.hover,\n },\n },\n lineSelected: {\n background: theme.palette.action.selected,\n\n '&:hover': {\n background: theme.palette.action.selected,\n },\n },\n lineCopyButton: {\n position: 'absolute',\n paddingTop: 0,\n paddingBottom: 0,\n },\n lineNumber: {\n display: 'inline-block',\n textAlign: 'end',\n width: 60,\n marginRight: theme.spacing(1),\n cursor: 'pointer',\n },\n textHighlight: {\n background: alpha(theme.palette.info.main, 0.15),\n },\n textSelectedHighlight: {\n background: alpha(theme.palette.info.main, 0.4),\n },\n modifierBold: {\n fontWeight: theme.typography.fontWeightBold,\n },\n modifierItalic: {\n fontStyle: 'italic',\n },\n modifierUnderline: {\n textDecoration: 'underline',\n },\n modifierForegroundBlack: {\n color: colors.common.black,\n },\n modifierForegroundRed: {\n color: colors.red[500],\n },\n modifierForegroundGreen: {\n color: colors.green[500],\n },\n modifierForegroundYellow: {\n color: colors.yellow[500],\n },\n modifierForegroundBlue: {\n color: colors.blue[500],\n },\n modifierForegroundMagenta: {\n color: colors.purple[500],\n },\n modifierForegroundCyan: {\n color: colors.cyan[500],\n },\n modifierForegroundWhite: {\n color: colors.common.white,\n },\n modifierForegroundGrey: {\n color: colors.grey[500],\n },\n modifierBackgroundBlack: {\n background: colors.common.black,\n },\n modifierBackgroundRed: {\n background: colors.red[500],\n },\n modifierBackgroundGreen: {\n background: colors.green[500],\n },\n modifierBackgroundYellow: {\n background: colors.yellow[500],\n },\n modifierBackgroundBlue: {\n background: colors.blue[500],\n },\n modifierBackgroundMagenta: {\n background: colors.purple[500],\n },\n modifierBackgroundCyan: {\n background: colors.cyan[500],\n },\n modifierBackgroundWhite: {\n background: colors.common.white,\n },\n modifierBackgroundGrey: {\n background: colors.grey[500],\n },\n }),\n { name: 'BackstageLogViewer' },\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, { useMemo } from 'react';\nimport { AnsiChunk, AnsiLine, ChunkModifiers } from './AnsiProcessor';\nimport startCase from 'lodash/startCase';\nimport classnames from 'classnames';\nimport { useStyles } from './styles';\n\nexport function getModifierClasses(\n classes: ReturnType<typeof useStyles>,\n modifiers: ChunkModifiers,\n) {\n const classNames = new Array<string>();\n if (modifiers.bold) {\n classNames.push(classes.modifierBold);\n }\n if (modifiers.italic) {\n classNames.push(classes.modifierItalic);\n }\n if (modifiers.underline) {\n classNames.push(classes.modifierUnderline);\n }\n if (modifiers.foreground) {\n const key = `modifierForeground${startCase(\n modifiers.foreground,\n )}` as keyof typeof classes;\n classNames.push(classes[key]);\n }\n if (modifiers.background) {\n const key = `modifierBackground${startCase(\n modifiers.background,\n )}` as keyof typeof classes;\n classNames.push(classes[key]);\n }\n return classNames.length > 0 ? classNames.join(' ') : undefined;\n}\n\nexport function findSearchResults(text: string, searchText: string) {\n if (!searchText || !text.includes(searchText)) {\n return undefined;\n }\n const searchResults = new Array<{ start: number; end: number }>();\n let offset = 0;\n for (;;) {\n const start = text.indexOf(searchText, offset);\n if (start === -1) {\n break;\n }\n const end = start + searchText.length;\n searchResults.push({ start, end });\n offset = end;\n }\n return searchResults;\n}\n\nexport interface HighlightAnsiChunk extends AnsiChunk {\n highlight?: number;\n}\n\nexport function calculateHighlightedChunks(\n line: AnsiLine,\n searchText: string,\n): HighlightAnsiChunk[] {\n const results = findSearchResults(line.text, searchText);\n if (!results) {\n return line.chunks;\n }\n\n const chunks = new Array<HighlightAnsiChunk>();\n\n let lineOffset = 0;\n let resultIndex = 0;\n let result = results[resultIndex];\n for (const chunk of line.chunks) {\n const { text, modifiers } = chunk;\n if (!result || lineOffset + text.length < result.start) {\n chunks.push(chunk);\n lineOffset += text.length;\n continue;\n }\n\n let localOffset = 0;\n while (result) {\n const localStart = Math.max(result.start - lineOffset, 0);\n if (localStart > text.length) {\n break; // The next result is not in this chunk\n }\n\n const localEnd = Math.min(result.end - lineOffset, text.length);\n\n const hasTextBeforeResult = localStart > localOffset;\n if (hasTextBeforeResult) {\n chunks.push({ text: text.slice(localOffset, localStart), modifiers });\n }\n const hasResultText = localEnd > localStart;\n if (hasResultText) {\n chunks.push({\n modifiers,\n highlight: resultIndex,\n text: text.slice(localStart, localEnd),\n });\n }\n\n localOffset = localEnd;\n\n const foundCompleteResult = result.end - lineOffset === localEnd;\n if (foundCompleteResult) {\n resultIndex += 1;\n result = results[resultIndex];\n } else {\n break; // The rest of the result is in the following chunks\n }\n }\n\n const hasTextAfterResult = localOffset < text.length;\n if (hasTextAfterResult) {\n chunks.push({ text: text.slice(localOffset), modifiers });\n }\n\n lineOffset += text.length;\n }\n\n return chunks;\n}\n\nexport interface LogLineProps {\n line: AnsiLine;\n classes: ReturnType<typeof useStyles>;\n searchText: string;\n highlightResultIndex?: number;\n}\n\nexport function LogLine({\n line,\n classes,\n searchText,\n highlightResultIndex,\n}: LogLineProps) {\n const chunks = useMemo(\n () => calculateHighlightedChunks(line, searchText),\n [line, searchText],\n );\n\n const elements = useMemo(\n () =>\n chunks.map(({ text, modifiers, highlight }, index) => (\n <span\n key={index}\n className={classnames(\n getModifierClasses(classes, modifiers),\n highlight !== undefined &&\n (highlight === highlightResultIndex\n ? classes.textSelectedHighlight\n : classes.textHighlight),\n )}\n >\n {text}\n </span>\n )),\n [chunks, highlightResultIndex, classes],\n );\n\n return <>{elements}</>;\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 from 'react';\nimport IconButton from '@material-ui/core/IconButton';\nimport TextField from '@material-ui/core/TextField';\nimport Typography from '@material-ui/core/Typography';\nimport ChevronLeftIcon from '@material-ui/icons/ChevronLeft';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport FilterListIcon from '@material-ui/icons/FilterList';\nimport { LogViewerSearch } from './useLogViewerSearch';\n\nexport interface LogViewerControlsProps extends LogViewerSearch {}\n\nexport function LogViewerControls(props: LogViewerControlsProps) {\n const { resultCount, resultIndexStep, toggleShouldFilter } = props;\n const resultIndex = props.resultIndex ?? 0;\n\n const handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n if (event.metaKey || event.ctrlKey || event.altKey) {\n toggleShouldFilter();\n } else {\n resultIndexStep(event.shiftKey);\n }\n }\n };\n\n return (\n <>\n {resultCount !== undefined && (\n <>\n <IconButton size=\"small\" onClick={() => resultIndexStep(true)}>\n <ChevronLeftIcon />\n </IconButton>\n <Typography>\n {Math.min(resultIndex + 1, resultCount)}/{resultCount}\n </Typography>\n <IconButton size=\"small\" onClick={() => resultIndexStep()}>\n <ChevronRightIcon />\n </IconButton>\n </>\n )}\n <TextField\n size=\"small\"\n variant=\"standard\"\n placeholder=\"Search\"\n value={props.searchInput}\n onKeyPress={handleKeyPress}\n onChange={e => props.setSearchInput(e.target.value)}\n />\n <IconButton size=\"small\" onClick={toggleShouldFilter}>\n {props.shouldFilter ? (\n <FilterListIcon color=\"primary\" />\n ) : (\n <FilterListIcon color=\"disabled\" />\n )}\n </IconButton>\n </>\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 { useMemo, useState } from 'react';\nimport { useToggle } from '@react-hookz/web';\nimport { AnsiLine } from './AnsiProcessor';\n\nexport function applySearchFilter(lines: AnsiLine[], searchText: string) {\n if (!searchText) {\n return { lines };\n }\n\n const matchingLines = [];\n const searchResults = [];\n for (const line of lines) {\n if (line.text.includes(searchText)) {\n matchingLines.push(line);\n\n let offset = 0;\n let lineResultIndex = 0;\n for (;;) {\n const start = line.text.indexOf(searchText, offset);\n if (start === -1) {\n break;\n }\n searchResults.push({\n lineNumber: line.lineNumber,\n lineIndex: lineResultIndex++,\n });\n offset = start + searchText.length;\n }\n }\n }\n\n return {\n lines: matchingLines,\n results: searchResults,\n };\n}\n\nexport interface LogViewerSearch {\n lines: AnsiLine[];\n\n searchText: string;\n searchInput: string;\n setSearchInput: (searchInput: string) => void;\n\n shouldFilter: boolean;\n toggleShouldFilter: () => void;\n\n resultCount: number | undefined;\n resultIndex: number | undefined;\n resultIndexStep: (decrement?: boolean) => void;\n\n resultLine: number | undefined;\n resultLineIndex: number | undefined;\n}\n\nexport function useLogViewerSearch(lines: AnsiLine[]): LogViewerSearch {\n const [searchInput, setSearchInput] = useState('');\n const searchText = searchInput.toLocaleLowerCase('en-US');\n\n const [resultIndex, setResultIndex] = useState<number>(0);\n\n const [shouldFilter, toggleShouldFilter] = useToggle(false);\n\n const filter = useMemo(\n () => applySearchFilter(lines, searchText),\n [lines, searchText],\n );\n\n const searchResult = filter.results\n ? filter.results[Math.min(resultIndex, filter.results.length - 1)]\n : undefined;\n const resultCount = filter.results?.length;\n\n const resultIndexStep = (decrement?: boolean) => {\n if (decrement) {\n if (resultCount !== undefined) {\n const next = Math.min(resultIndex - 1, resultCount - 2);\n setResultIndex(next < 0 ? resultCount - 1 : next);\n }\n } else {\n if (resultCount !== undefined) {\n const next = resultIndex + 1;\n setResultIndex(next >= resultCount ? 0 : next);\n }\n }\n };\n\n return {\n lines: shouldFilter ? filter.lines : lines,\n searchText,\n searchInput,\n setSearchInput,\n shouldFilter,\n toggleShouldFilter,\n resultCount,\n resultIndex,\n resultIndexStep,\n resultLine: searchResult?.lineNumber,\n resultLineIndex: searchResult?.lineIndex,\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 { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useEffect, useState } from 'react';\nimport useCopyToClipboard from 'react-use/lib/useCopyToClipboard';\nimport { AnsiLine } from './AnsiProcessor';\n\nexport function useLogViewerSelection(lines: AnsiLine[]) {\n const errorApi = useApi(errorApiRef);\n const [sel, setSelection] = useState<{ start: number; end: number }>();\n const start = sel ? Math.min(sel.start, sel.end) : undefined;\n const end = sel ? Math.max(sel.start, sel.end) : undefined;\n\n const [{ error }, copyToClipboard] = useCopyToClipboard();\n\n useEffect(() => {\n if (error) {\n errorApi.post(error);\n }\n }, [error, errorApi]);\n\n return {\n shouldShowButton(line: number) {\n return start === line || end === line;\n },\n isSelected(line: number) {\n if (!sel) {\n return false;\n }\n return start! <= line && line <= end!;\n },\n setSelection(line: number, add: boolean) {\n if (add) {\n setSelection(s =>\n s ? { start: s.start, end: line } : { start: line, end: line },\n );\n } else {\n setSelection(s =>\n s?.start === line && s?.end === line\n ? undefined\n : { start: line, end: line },\n );\n }\n },\n copySelection() {\n if (sel) {\n const copyText = lines\n .slice(Math.min(sel.start, sel.end) - 1, Math.max(sel.start, sel.end))\n .map(l => l.chunks.map(c => c.text).join(''))\n .join('\\n');\n copyToClipboard(copyText);\n setSelection(undefined);\n }\n },\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, { useEffect, useMemo, useRef } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport IconButton from '@material-ui/core/IconButton';\nimport CopyIcon from '@material-ui/icons/FileCopy';\nimport AutoSizer from 'react-virtualized-auto-sizer';\nimport { FixedSizeList } from 'react-window';\nimport { AnsiProcessor } from './AnsiProcessor';\nimport { HEADER_SIZE, useStyles } from './styles';\nimport classnames from 'classnames';\nimport { LogLine } from './LogLine';\nimport { LogViewerControls } from './LogViewerControls';\nimport { useLogViewerSearch } from './useLogViewerSearch';\nimport { useLogViewerSelection } from './useLogViewerSelection';\n\nexport interface RealLogViewerProps {\n text: string;\n classes?: { root?: string };\n}\n\nexport function RealLogViewer(props: RealLogViewerProps) {\n const classes = useStyles({ classes: props.classes });\n const listRef = useRef<FixedSizeList | null>(null);\n\n // The processor keeps state that optimizes appending to the text\n const processor = useMemo(() => new AnsiProcessor(), []);\n const lines = processor.process(props.text);\n\n const search = useLogViewerSearch(lines);\n const selection = useLogViewerSelection(lines);\n const location = useLocation();\n\n useEffect(() => {\n if (search.resultLine !== undefined && listRef.current) {\n listRef.current.scrollToItem(search.resultLine - 1, 'center');\n }\n }, [search.resultLine]);\n\n useEffect(() => {\n if (location.hash) {\n // #line-6 -> 6\n const line = parseInt(location.hash.replace(/\\D/g, ''), 10);\n selection.setSelection(line, false);\n }\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n const handleSelectLine = (\n line: number,\n event: { shiftKey: boolean; preventDefault: () => void },\n ) => {\n selection.setSelection(line, event.shiftKey);\n };\n\n return (\n <AutoSizer>\n {({ height, width }) => (\n <div style={{ width, height }} className={classes.root}>\n <div className={classes.header}>\n <LogViewerControls {...search} />\n </div>\n <FixedSizeList\n ref={listRef}\n className={classes.log}\n height={height - HEADER_SIZE}\n width={width}\n itemData={search.lines}\n itemSize={20}\n itemCount={search.lines.length}\n >\n {({ index, style, data }) => {\n const line = data[index];\n const { lineNumber } = line;\n return (\n <div\n style={{ ...style }}\n className={classnames(classes.line, {\n [classes.lineSelected]: selection.isSelected(lineNumber),\n })}\n >\n {selection.shouldShowButton(lineNumber) && (\n <IconButton\n data-testid=\"copy-button\"\n size=\"small\"\n className={classes.lineCopyButton}\n onClick={() => selection.copySelection()}\n >\n <CopyIcon fontSize=\"inherit\" />\n </IconButton>\n )}\n <a\n role=\"row\"\n target=\"_self\"\n href={`#line-${lineNumber}`}\n className={classes.lineNumber}\n onClick={event => handleSelectLine(lineNumber, event)}\n onKeyPress={event => handleSelectLine(lineNumber, event)}\n >\n {lineNumber}\n </a>\n <LogLine\n line={line}\n classes={classes}\n searchText={search.searchText}\n highlightResultIndex={\n search.resultLine === lineNumber\n ? search.resultLineIndex\n : undefined\n }\n />\n </div>\n );\n }}\n </FixedSizeList>\n </div>\n )}\n </AutoSizer>\n );\n}\n"],"sourceRoot":""}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[7560],{27560:function(g,D,e){e.r(D),e.d(D,{TechDocsCustomHome:function(){return v}});var t=e(52322),C=e(2784),p=e(64279),O=e(79692),d=e(43297),j=e(68435),x=e(85478),_=e(42081),n=e(93414),M=e(25248);const
|
|
1
|
+
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[7560],{27560:function(g,D,e){e.r(D),e.d(D,{TechDocsCustomHome:function(){return v}});var t=e(52322),C=e(2784),p=e(64279),O=e(79692),d=e(43297),j=e(68435),x=e(85478),_=e(42081),n=e(93414),M=e(25248);const T={DocsTable:j.H,DocsCardGrid:x.f},f=({config:s,entities:i,index:r})=>{const E=(0,O.Z)({panelContainer:{marginBottom:"2rem",...s.panelCSS?s.panelCSS:{}}})(),{loading:c,isOwnedEntity:u}=(0,d.ZW)(),l=T[s.panelType],h=i.filter(a=>s.filterPredicate==="ownedByUser"?c?!1:u(a):typeof s.filterPredicate=="function"&&s.filterPredicate(a));return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.yW,{title:s.title,description:s.description,children:r===0?(0,t.jsx)(n.qt,{children:"Discover documentation in your ecosystem."}):null}),(0,t.jsx)("div",{className:E.panelContainer,children:(0,t.jsx)(l,{"data-testid":"techdocs-custom-panel",entities:h})})]})},v=s=>{const{tabsConfig:i}=s,[r,P]=(0,C.useState)(0),E=(0,M.h_)(d.Ah),{value:c,loading:u,error:l}=(0,p.default)(async()=>(await E.getEntities({filter:{"metadata.annotations.backstage.io/techdocs-ref":d.n3},fields:["apiVersion","kind","metadata","relations","spec.owner","spec.type"]})).items.filter(o=>{var m;return!!(!((m=o.metadata.annotations)===null||m===void 0)&&m["backstage.io/techdocs-ref"])})),h=i[r];return u?(0,t.jsx)(_.j,{children:(0,t.jsx)(n.VY,{children:(0,t.jsx)(n.Ex,{})})}):l?(0,t.jsx)(_.j,{children:(0,t.jsx)(n.VY,{children:(0,t.jsx)(n.GB,{severity:"error",title:"Could not load available documentation.",children:(0,t.jsx)(n.Oi,{language:"text",text:l.toString()})})})}):(0,t.jsxs)(_.j,{children:[(0,t.jsx)(n.aR,{selectedIndex:r,onChange:a=>P(a),tabs:i.map(({label:a},o)=>({id:o.toString(),label:a}))}),(0,t.jsx)(n.VY,{"data-testid":"techdocs-content",children:h.panels.map((a,o)=>(0,t.jsx)(f,{config:a,entities:c||[],index:o},o))})]})}}}]);})();
|
|
2
2
|
|
|
3
|
-
//# sourceMappingURL=7560.
|
|
3
|
+
//# sourceMappingURL=7560.a50a4f27.chunk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/TechDocsCustomHome.tsx"],"names":["panels","DocsTable","DocsCardGrid","CustomPanel","config","entities","index","classes","makeStyles","panelContainer","marginBottom","panelCSS","loading","loadingOwnership","isOwnedEntity","useEntityOwnership","Panel","panelType","shownEntities","filter","entity","filterPredicate","ContentHeader","title","description","SupportButton","div","className","data-testid","TechDocsCustomHome","props","tabsConfig","selectedTab","setSelectedTab","useState","catalogApi","useApi","catalogApiRef","value","error","useAsync","getEntities","CATALOG_FILTER_EXISTS","fields","items","metadata","annotations","currentTabConfig","TechDocsPageWrapper","Content","Progress","WarningPanel","severity","CodeSnippet","language","text","toString","HeaderTabs","selectedIndex","onChange","tabs","map","label","id"],"mappings":"4TA0CA,MAAMA,EAAS,CACbC,UAAWA,IACXC,aAAcA,GAChB,EAuCMC,EAAc,CAAC,CACnBC,SACAC,WACAC,OAAK,IAKD,CAOJ,MAAMC,G,EANYC,KAAW,CAC3BC,eAAgB,CACdC,aAAc,OACd,GAAIN,EAAOO,SAAWP,EAAOO,SAAW,CAAC,CAC3C,CACF,CAAC,EACyB,EACpB,CAAEC,QAASC,EAAkBC,eAAc,G,EAAIC,MAAmB,EAElEC,EAAQhB,EAAOI,EAAOa,WAEtBC,EAAgBb,EAASc,OAAOC,GAChChB,EAAOiB,kBAAoB,cACzBR,EACK,GAEFC,EAAcM,CAAM,EAI3B,OAAOhB,EAAOiB,iBAAoB,YAClCjB,EAAOiB,gBAAgBD,CAAM,CAEhC,EAED,O,EACE,oB,aACE,OAACE,KAAaA,CAACC,MAAOnB,EAAOmB,MAAOC,YAAapB,EAAOoB,Y,SACrDlB,IAAU,G,EACT,OAACmB,KAAaA,C,SAAC,2C,GAGb,I,MAEN,OAACC,OAAIC,UAAWpB,EAAQE,e,YACtB,OAACO,GAAMY,cAAY,wBAAwBvB,SAAUa,C,OAI7D,EAWaW,EAAsBC,GAAmC,CACpE,KAAM,CAAEC,YAAW,EAAID,EACjB,CAACE,EAAaC,CAAc,G,EAAIC,YAAiB,CAAC,EAClDC,G,EAAyBC,MAAOC,IAAaA,EAE7C,CACJC,MAAOjC,EACPO,UACA2B,OAAK,G,EACHC,WAAS,UACM,MAAML,EAAWM,YAAY,CAC5CtB,OAAQ,CACN,iDAAkDuB,IACpD,EACAC,OAAQ,CACN,aACA,OACA,WACA,YACA,aACA,W,CAEJ,CAAC,GACeC,MAAMzB,OAAQC,GAAmB,C,IACtCA,EAAT,MAAO,CAAC,EAACA,OAAOyB,SAASC,eAAW,MAA3B1B,eAA8B,6BACzC,CAAC,CACF,EAEK2B,EAAmBhB,EAAWC,GAEpC,OAAIpB,G,EAEA,OAACoC,IAAmBA,C,YAClB,OAACC,KAAOA,C,YACN,OAACC,KAAQA,G,KAMbX,G,EAEA,OAACS,IAAmBA,C,YAClB,OAACC,KAAOA,C,YACN,OAACE,KAAYA,CACXC,SAAS,QACT7B,MAAM,0C,YAEN,OAAC8B,KAAWA,CAACC,SAAS,OAAOC,KAAMhB,EAAMiB,SAAS,C,YAQ1D,QAACR,IAAmBA,C,aAClB,OAACS,KAAUA,CACTC,cAAe1B,EACf2B,SAAUrD,GAAS2B,EAAe3B,CAAK,EACvCsD,KAAM7B,EAAW8B,IAAI,CAAC,CAAEC,OAAM,EAAGxD,KAAW,CAC1CyD,GAAIzD,EAAMkD,SAAS,EACnBM,OACF,EAAE,C,MAEJ,OAACb,KAAOA,CAACrB,cAAY,mB,SAClBmB,EAAiB/C,OAAO6D,IAAI,CAACzD,EAAQE,K,EACpC,OAACH,GAECC,OAAQA,EACRC,SAAYA,GAAsB,CAAC,EACnCC,MAAOA,C,EAHFA,CAAK,CAALA,C,KASjB,C","file":"static/7560.
|
|
1
|
+
{"version":3,"sources":["webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/TechDocsCustomHome.tsx"],"names":["panels","DocsTable","DocsCardGrid","CustomPanel","config","entities","index","classes","makeStyles","panelContainer","marginBottom","panelCSS","loading","loadingOwnership","isOwnedEntity","useEntityOwnership","Panel","panelType","shownEntities","filter","entity","filterPredicate","ContentHeader","title","description","SupportButton","div","className","data-testid","TechDocsCustomHome","props","tabsConfig","selectedTab","setSelectedTab","useState","catalogApi","useApi","catalogApiRef","value","error","useAsync","getEntities","CATALOG_FILTER_EXISTS","fields","items","metadata","annotations","currentTabConfig","TechDocsPageWrapper","Content","Progress","WarningPanel","severity","CodeSnippet","language","text","toString","HeaderTabs","selectedIndex","onChange","tabs","map","label","id"],"mappings":"4TA0CA,MAAMA,EAAS,CACbC,UAAWA,IACXC,aAAcA,GAChB,EAuCMC,EAAc,CAAC,CACnBC,SACAC,WACAC,OAAK,IAKD,CAOJ,MAAMC,G,EANYC,KAAW,CAC3BC,eAAgB,CACdC,aAAc,OACd,GAAIN,EAAOO,SAAWP,EAAOO,SAAW,CAAC,CAC3C,CACF,CAAC,EACyB,EACpB,CAAEC,QAASC,EAAkBC,eAAc,G,EAAIC,MAAmB,EAElEC,EAAQhB,EAAOI,EAAOa,WAEtBC,EAAgBb,EAASc,OAAOC,GAChChB,EAAOiB,kBAAoB,cACzBR,EACK,GAEFC,EAAcM,CAAM,EAI3B,OAAOhB,EAAOiB,iBAAoB,YAClCjB,EAAOiB,gBAAgBD,CAAM,CAEhC,EAED,O,EACE,oB,aACE,OAACE,KAAaA,CAACC,MAAOnB,EAAOmB,MAAOC,YAAapB,EAAOoB,Y,SACrDlB,IAAU,G,EACT,OAACmB,KAAaA,C,SAAC,2C,GAGb,I,MAEN,OAACC,OAAIC,UAAWpB,EAAQE,e,YACtB,OAACO,GAAMY,cAAY,wBAAwBvB,SAAUa,C,OAI7D,EAWaW,EAAsBC,GAAmC,CACpE,KAAM,CAAEC,YAAW,EAAID,EACjB,CAACE,EAAaC,CAAc,G,EAAIC,YAAiB,CAAC,EAClDC,G,EAAyBC,MAAOC,IAAaA,EAE7C,CACJC,MAAOjC,EACPO,UACA2B,OAAK,G,EACHC,WAAS,UACM,MAAML,EAAWM,YAAY,CAC5CtB,OAAQ,CACN,iDAAkDuB,IACpD,EACAC,OAAQ,CACN,aACA,OACA,WACA,YACA,aACA,W,CAEJ,CAAC,GACeC,MAAMzB,OAAQC,GAAmB,C,IACtCA,EAAT,MAAO,CAAC,EAACA,OAAOyB,SAASC,eAAW,MAA3B1B,eAA8B,6BACzC,CAAC,CACF,EAEK2B,EAAmBhB,EAAWC,GAEpC,OAAIpB,G,EAEA,OAACoC,IAAmBA,C,YAClB,OAACC,KAAOA,C,YACN,OAACC,KAAQA,G,KAMbX,G,EAEA,OAACS,IAAmBA,C,YAClB,OAACC,KAAOA,C,YACN,OAACE,KAAYA,CACXC,SAAS,QACT7B,MAAM,0C,YAEN,OAAC8B,KAAWA,CAACC,SAAS,OAAOC,KAAMhB,EAAMiB,SAAS,C,YAQ1D,QAACR,IAAmBA,C,aAClB,OAACS,KAAUA,CACTC,cAAe1B,EACf2B,SAAUrD,GAAS2B,EAAe3B,CAAK,EACvCsD,KAAM7B,EAAW8B,IAAI,CAAC,CAAEC,OAAM,EAAGxD,KAAW,CAC1CyD,GAAIzD,EAAMkD,SAAS,EACnBM,OACF,EAAE,C,MAEJ,OAACb,KAAOA,CAACrB,cAAY,mB,SAClBmB,EAAiB/C,OAAO6D,IAAI,CAACzD,EAAQE,K,EACpC,OAACH,GAECC,OAAQA,EACRC,SAAYA,GAAsB,CAAC,EACnCC,MAAOA,C,EAHFA,CAAK,CAALA,C,KASjB,C","file":"static/7560.a50a4f27.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';\nimport { CSSProperties } from '@material-ui/styles';\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"],"sourceRoot":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[7750],{17750:function(N,r,t){t.r(r),t.d(r,{EntityLinksCard:function(){return k}});var n=t(52322),h=t(43297),c=t(52160),Z=t(2784),u=t(79692),v=t(90436),g=t(77277),m=t(93414);const y=`metadata:
|
|
2
|
+
name: example
|
|
3
|
+
links:
|
|
4
|
+
- url: https://dashboard.example.com
|
|
5
|
+
title: My Dashboard
|
|
6
|
+
icon: dashboard`,p=(0,u.Z)(a=>({code:{borderRadius:6,margin:`${a.spacing(2)}px 0px`,background:a.palette.type==="dark"?"#444":"#fff"}}),{name:"PluginCatalogEntityLinksEmptyState"});function f(){const a=p();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(v.Z,{variant:"body1",children:"No links defined for this entity. You can add links to your entity YAML as shown in the highlighted example below:"}),(0,n.jsx)("div",{className:a.code,children:(0,n.jsx)(m.Oi,{text:y,language:"yaml",showLineNumbers:!0,highlightedNumbers:[3,4,5,6],customStyle:{background:"inherit",fontSize:"115%"}})}),(0,n.jsx)(g.Z,{variant:"contained",color:"primary",target:"_blank",href:"https://backstage.io/docs/features/software-catalog/descriptor-format#links-optional",children:"Read more"})]})}var x=t(24851),L=t(25248);const k=a=>{var o;const{cols:j=void 0,variant:S}=a,{entity:i}=(0,h.X2)(),E=(0,L.qD)();var e;const b=s=>s&&(e=E.getSystemIcon(s))!==null&&e!==void 0?e:c.Z,d=i==null||(o=i.metadata)===null||o===void 0?void 0:o.links;return(0,n.jsx)(m.rJ,{title:"Links",variant:S,children:!d||d.length===0?(0,n.jsx)(f,{}):(0,n.jsx)(x.s,{cols:j,items:d.map(({url:s,title:l,icon:C})=>({text:l!=null?l:s,href:s,Icon:b(C)}))})})}}}]);})();
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=7750.36f3b714.chunk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/EntityLinksCard/EntityLinksEmptyState.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/EntityLinksCard/EntityLinksCard.tsx"],"names":["ENTITY_YAML","useStyles","makeStyles","theme","code","borderRadius","margin","spacing","background","palette","type","name","EntityLinksEmptyState","classes","Typography","variant","div","className","CodeSnippet","text","language","showLineNumbers","highlightedNumbers","customStyle","fontSize","Button","color","target","href","EntityLinksCard","props","entity","cols","undefined","useEntity","app","useApp","iconResolver","key","getSystemIcon","LanguageIcon","links","metadata","InfoCard","title","length","LinksGridList","items","map","url","icon","Icon"],"mappings":"mSAqBA,MAAMA,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA,uBAUdC,G,EAAYC,KAChBC,IAAU,CACRC,KAAM,CACJC,aAAc,EACdC,OAAQ,GAAGH,EAAMI,QAAQ,CAAC,UAC1BC,WAAYL,EAAMM,QAAQC,OAAS,OAAS,OAAS,MACvD,CACF,GACA,CAAEC,KAAM,oCAAqC,CAAC,EAGzC,SAASC,GAAwB,CACtC,MAAMC,EAAUZ,EAAU,EAE1B,O,EACE,oB,aACE,OAACa,IAAUA,CAACC,QAAQ,Q,SAAQ,oH,MAI5B,OAACC,OAAIC,UAAWJ,EAAQT,K,YACtB,OAACc,KAAWA,CACVC,KAAMnB,EACNoB,SAAS,OACTC,gBAAe,GACfC,mBAAoB,CAAC,EAAG,EAAG,EAAG,C,EAC9BC,YAAa,CAAEf,WAAY,UAAWgB,SAAU,MAAO,C,QAG3D,OAACC,IAAMA,CACLV,QAAQ,YACRW,MAAM,UACNC,OAAO,SACPC,KAAK,uF,SACN,W,KAKP,C,0BCvCO,MAAMC,EAAmBC,GAAgC,C,IAQhDC,EAPd,KAAM,CAAEC,OAAOC,OAAWlB,SAAQ,EAAIe,EAChC,CAAEC,QAAO,G,EAAIG,MAAU,EACvBC,G,EAAMC,MAAO,E,IAGXD,EADR,MAAME,EAAgBC,GACpBA,IAAMH,IAAII,cAAcD,CAAG,KAAHA,MAAlBH,aAAyCK,IAE3CC,EAAQV,cAAQW,YAAQ,MAAhBX,oBAAkBU,MAEhC,O,EACE,OAACE,KAAQA,CAACC,MAAM,QAAQ7B,QAASA,E,SAC9B,CAAC0B,GAASA,EAAMI,SAAW,G,EAC1B,OAACjC,EAAqBA,K,EAEtB,OAACkC,IAAaA,CACZd,KAAMA,EACNe,MAAON,EAAMO,IAAI,CAAC,CAAEC,MAAKL,QAAOM,MAAK,KAAO,CAC1C/B,KAAMyB,UAASK,EACfrB,KAAMqB,EACNE,KAAMd,EAAaa,CAAI,CACzB,EAAE,C,IAKZ,C","file":"static/7750.
|
|
1
|
+
{"version":3,"sources":["webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/EntityLinksCard/EntityLinksEmptyState.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/EntityLinksCard/EntityLinksCard.tsx"],"names":["ENTITY_YAML","useStyles","makeStyles","theme","code","borderRadius","margin","spacing","background","palette","type","name","EntityLinksEmptyState","classes","Typography","variant","div","className","CodeSnippet","text","language","showLineNumbers","highlightedNumbers","customStyle","fontSize","Button","color","target","href","EntityLinksCard","props","entity","cols","undefined","useEntity","app","useApp","iconResolver","key","getSystemIcon","LanguageIcon","links","metadata","InfoCard","title","length","LinksGridList","items","map","url","icon","Icon"],"mappings":"mSAqBA,MAAMA,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA,uBAUdC,G,EAAYC,KAChBC,IAAU,CACRC,KAAM,CACJC,aAAc,EACdC,OAAQ,GAAGH,EAAMI,QAAQ,CAAC,UAC1BC,WAAYL,EAAMM,QAAQC,OAAS,OAAS,OAAS,MACvD,CACF,GACA,CAAEC,KAAM,oCAAqC,CAAC,EAGzC,SAASC,GAAwB,CACtC,MAAMC,EAAUZ,EAAU,EAE1B,O,EACE,oB,aACE,OAACa,IAAUA,CAACC,QAAQ,Q,SAAQ,oH,MAI5B,OAACC,OAAIC,UAAWJ,EAAQT,K,YACtB,OAACc,KAAWA,CACVC,KAAMnB,EACNoB,SAAS,OACTC,gBAAe,GACfC,mBAAoB,CAAC,EAAG,EAAG,EAAG,C,EAC9BC,YAAa,CAAEf,WAAY,UAAWgB,SAAU,MAAO,C,QAG3D,OAACC,IAAMA,CACLV,QAAQ,YACRW,MAAM,UACNC,OAAO,SACPC,KAAK,uF,SACN,W,KAKP,C,0BCvCO,MAAMC,EAAmBC,GAAgC,C,IAQhDC,EAPd,KAAM,CAAEC,OAAOC,OAAWlB,SAAQ,EAAIe,EAChC,CAAEC,QAAO,G,EAAIG,MAAU,EACvBC,G,EAAMC,MAAO,E,IAGXD,EADR,MAAME,EAAgBC,GACpBA,IAAMH,IAAII,cAAcD,CAAG,KAAHA,MAAlBH,aAAyCK,IAE3CC,EAAQV,cAAQW,YAAQ,MAAhBX,oBAAkBU,MAEhC,O,EACE,OAACE,KAAQA,CAACC,MAAM,QAAQ7B,QAASA,E,SAC9B,CAAC0B,GAASA,EAAMI,SAAW,G,EAC1B,OAACjC,EAAqBA,K,EAEtB,OAACkC,IAAaA,CACZd,KAAMA,EACNe,MAAON,EAAMO,IAAI,CAAC,CAAEC,MAAKL,QAAOM,MAAK,KAAO,CAC1C/B,KAAMyB,UAASK,EACfrB,KAAMqB,EACNE,KAAMd,EAAaa,CAAI,CACzB,EAAE,C,IAKZ,C","file":"static/7750.36f3b714.chunk.js","sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BackstageTheme } from '@backstage/theme';\nimport { Button, makeStyles, Typography } from '@material-ui/core';\nimport React from 'react';\nimport { CodeSnippet } from '@backstage/core-components';\n\nconst ENTITY_YAML = `metadata:\n name: example\n links:\n - url: https://dashboard.example.com\n title: My Dashboard\n icon: dashboard`;\n\n/** @public */\nexport type EntityLinksEmptyStateClassKey = 'code';\n\nconst useStyles = makeStyles<BackstageTheme>(\n theme => ({\n code: {\n borderRadius: 6,\n margin: `${theme.spacing(2)}px 0px`,\n background: theme.palette.type === 'dark' ? '#444' : '#fff',\n },\n }),\n { name: 'PluginCatalogEntityLinksEmptyState' },\n);\n\nexport function EntityLinksEmptyState() {\n const classes = useStyles();\n\n return (\n <>\n <Typography variant=\"body1\">\n No links defined for this entity. You can add links to your entity YAML\n as shown in the highlighted example below:\n </Typography>\n <div className={classes.code}>\n <CodeSnippet\n text={ENTITY_YAML}\n language=\"yaml\"\n showLineNumbers\n highlightedNumbers={[3, 4, 5, 6]}\n customStyle={{ background: 'inherit', fontSize: '115%' }}\n />\n </div>\n <Button\n variant=\"contained\"\n color=\"primary\"\n target=\"_blank\"\n href=\"https://backstage.io/docs/features/software-catalog/descriptor-format#links-optional\"\n >\n Read more\n </Button>\n </>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport LanguageIcon from '@material-ui/icons/Language';\nimport React from 'react';\nimport { EntityLinksEmptyState } from './EntityLinksEmptyState';\nimport { LinksGridList } from './LinksGridList';\nimport { ColumnBreakpoints } from './types';\nimport { IconComponent, useApp } from '@backstage/core-plugin-api';\nimport { InfoCard, InfoCardVariants } from '@backstage/core-components';\n\n/** @public */\nexport interface EntityLinksCardProps {\n cols?: ColumnBreakpoints | number;\n variant?: InfoCardVariants;\n}\n\nexport const EntityLinksCard = (props: EntityLinksCardProps) => {\n const { cols = undefined, variant } = props;\n const { entity } = useEntity();\n const app = useApp();\n\n const iconResolver = (key?: string): IconComponent =>\n key ? app.getSystemIcon(key) ?? LanguageIcon : LanguageIcon;\n\n const links = entity?.metadata?.links;\n\n return (\n <InfoCard title=\"Links\" variant={variant}>\n {!links || links.length === 0 ? (\n <EntityLinksEmptyState />\n ) : (\n <LinksGridList\n cols={cols}\n items={links.map(({ url, title, icon }) => ({\n text: title ?? url,\n href: url,\n Icon: iconResolver(icon),\n }))}\n />\n )}\n </InfoCard>\n );\n};\n"],"sourceRoot":""}
|