@techdocs/cli 1.8.9 → 1.8.10-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 +12 -0
- package/dist/cjs/{PublisherConfig-B9GYw8mh.cjs.js → PublisherConfig-DheuBNuV.cjs.js} +2 -2
- package/dist/cjs/{PublisherConfig-B9GYw8mh.cjs.js.map → PublisherConfig-DheuBNuV.cjs.js.map} +1 -1
- package/dist/cjs/{migrate-CccqCfHt.cjs.js → migrate-D6YuWLen.cjs.js} +2 -2
- package/dist/cjs/{migrate-CccqCfHt.cjs.js.map → migrate-D6YuWLen.cjs.js.map} +1 -1
- package/dist/cjs/{publish-D19dZg09.cjs.js → publish-DYFq3em1.cjs.js} +2 -2
- package/dist/cjs/{publish-D19dZg09.cjs.js.map → publish-DYFq3em1.cjs.js.map} +1 -1
- package/dist/cjs/{serve-Di1O6Sm4.cjs.js → serve-jFxB5mn3.cjs.js} +2 -2
- package/dist/cjs/serve-jFxB5mn3.cjs.js.map +1 -0
- package/dist/embedded-app/.config-schema.json +46 -1
- package/dist/embedded-app/index.html +1 -1
- package/dist/embedded-app/static/4036.23d8f59c.chunk.js +3 -0
- package/dist/embedded-app/static/4036.23d8f59c.chunk.js.map +1 -0
- package/dist/embedded-app/static/9605.b5a1f3d6.chunk.js +11 -0
- package/dist/embedded-app/static/9605.b5a1f3d6.chunk.js.map +1 -0
- package/dist/embedded-app/static/{main.e02a8f27.js → main.288f262b.js} +9 -9
- package/dist/embedded-app/static/main.288f262b.js.map +1 -0
- package/dist/embedded-app/static/module-date-fns.196adaa7.js +3 -0
- package/dist/embedded-app/static/module-date-fns.196adaa7.js.map +1 -0
- package/dist/embedded-app/static/module-material-table.892da5bc.js +3 -0
- package/dist/embedded-app/static/module-material-table.892da5bc.js.map +1 -0
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_gherkin.4bae5020.chunk.js +3 -0
- package/dist/embedded-app/static/{react-syntax-highlighter_languages_highlight_gherkin.f9cdeff1.chunk.js.map → react-syntax-highlighter_languages_highlight_gherkin.4bae5020.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{runtime.e02a8f27.js → runtime.288f262b.js} +2 -2
- package/dist/embedded-app/static/{runtime.e02a8f27.js.map → runtime.288f262b.js.map} +1 -1
- package/dist/embedded-app/static/vendor.288f262b.js +160 -0
- package/dist/embedded-app/static/vendor.288f262b.js.map +1 -0
- package/dist/index.cjs.js +4 -4
- package/package.json +5 -5
- package/dist/cjs/serve-Di1O6Sm4.cjs.js.map +0 -1
- package/dist/embedded-app/static/4036.509d373a.chunk.js +0 -3
- package/dist/embedded-app/static/4036.509d373a.chunk.js.map +0 -1
- package/dist/embedded-app/static/9605.3cd9c86f.chunk.js +0 -11
- package/dist/embedded-app/static/9605.3cd9c86f.chunk.js.map +0 -1
- package/dist/embedded-app/static/main.e02a8f27.js.map +0 -1
- package/dist/embedded-app/static/module-material-table.145eb704.js +0 -3
- package/dist/embedded-app/static/module-material-table.145eb704.js.map +0 -1
- package/dist/embedded-app/static/react-syntax-highlighter_languages_highlight_gherkin.f9cdeff1.chunk.js +0 -3
- package/dist/embedded-app/static/vendor.e02a8f27.js +0 -160
- package/dist/embedded-app/static/vendor.e02a8f27.js.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -91,7 +91,7 @@ function registerCommands(program) {
|
|
|
91
91
|
"--concurrency <MAX CONCURRENT REQS>",
|
|
92
92
|
"Optional Controls the number of API requests allowed to be performed simultaneously.",
|
|
93
93
|
"25"
|
|
94
|
-
).option("-v --verbose", "Enable verbose output.", false).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/migrate-
|
|
94
|
+
).option("-v --verbose", "Enable verbose output.", false).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/migrate-D6YuWLen.cjs.js'); }).then((m) => m.default)));
|
|
95
95
|
program.command("publish").description(
|
|
96
96
|
"Publish generated TechDocs site to an external storage AWS S3, Google GCS, etc."
|
|
97
97
|
).requiredOption(
|
|
@@ -147,7 +147,7 @@ function registerCommands(program) {
|
|
|
147
147
|
"--directory <PATH>",
|
|
148
148
|
"Path of the directory containing generated files to publish",
|
|
149
149
|
"./site/"
|
|
150
|
-
).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/publish-
|
|
150
|
+
).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/publish-DYFq3em1.cjs.js'); }).then((m) => m.default)));
|
|
151
151
|
program.command("serve:mkdocs").description("Serve a documentation project locally using MkDocs serve.").option(
|
|
152
152
|
"-i, --docker-image <DOCKER_IMAGE>",
|
|
153
153
|
"The mkdocs docker container to use",
|
|
@@ -213,7 +213,7 @@ function registerCommands(program) {
|
|
|
213
213
|
"--preview-app-port can only be used together with --preview-app-bundle-path"
|
|
214
214
|
);
|
|
215
215
|
}
|
|
216
|
-
}).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/serve-
|
|
216
|
+
}).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/serve-jFxB5mn3.cjs.js'); }).then((m) => m.default)));
|
|
217
217
|
}
|
|
218
218
|
function lazy(getActionFunc) {
|
|
219
219
|
return async (...args) => {
|
|
@@ -228,7 +228,7 @@ function lazy(getActionFunc) {
|
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
var version = "1.8.
|
|
231
|
+
var version = "1.8.10-next.0";
|
|
232
232
|
|
|
233
233
|
const main = (argv) => {
|
|
234
234
|
commander.program.name("techdocs-cli").version(version);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@techdocs/cli",
|
|
3
3
|
"description": "Utility CLI for managing TechDocs sites in Backstage.",
|
|
4
|
-
"version": "1.8.
|
|
4
|
+
"version": "1.8.10-next.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"techdocs-cli": "bin/techdocs-cli"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@backstage/cli": "^0.26.
|
|
38
|
+
"@backstage/cli": "^0.26.5-next.0",
|
|
39
39
|
"@types/commander": "^2.12.2",
|
|
40
40
|
"@types/fs-extra": "^11.0.0",
|
|
41
41
|
"@types/http-proxy": "^1.17.4",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"ext": "ts"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@backstage/backend-common": "^0.21.
|
|
60
|
-
"@backstage/catalog-model": "^1.
|
|
59
|
+
"@backstage/backend-common": "^0.21.8-next.0",
|
|
60
|
+
"@backstage/catalog-model": "^1.5.0-next.0",
|
|
61
61
|
"@backstage/cli-common": "^0.1.13",
|
|
62
62
|
"@backstage/config": "^1.2.0",
|
|
63
|
-
"@backstage/plugin-techdocs-node": "^1.12.
|
|
63
|
+
"@backstage/plugin-techdocs-node": "^1.12.4-next.0",
|
|
64
64
|
"@types/dockerode": "^3.3.0",
|
|
65
65
|
"commander": "^12.0.0",
|
|
66
66
|
"dockerode": "^4.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serve-Di1O6Sm4.cjs.js","sources":["../../src/lib/httpServer.ts","../../src/commands/serve/serve.ts"],"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 serveHandler from 'serve-handler';\nimport http from 'http';\nimport httpProxy from 'http-proxy';\nimport { createLogger } from './utility';\n\nexport default class HTTPServer {\n private readonly proxyEndpoint: string;\n private readonly backstageBundleDir: string;\n private readonly backstagePort: number;\n private readonly mkdocsTargetAddress: string;\n private readonly verbose: boolean;\n\n constructor(\n backstageBundleDir: string,\n backstagePort: number,\n mkdocsTargetAddress: string,\n verbose: boolean,\n ) {\n this.proxyEndpoint = '/api/techdocs/';\n this.backstageBundleDir = backstageBundleDir;\n this.backstagePort = backstagePort;\n this.mkdocsTargetAddress = mkdocsTargetAddress;\n this.verbose = verbose;\n }\n\n // Create a Proxy for mkdocs server\n private createProxy() {\n const proxy = httpProxy.createProxyServer({\n target: this.mkdocsTargetAddress,\n });\n\n return (request: http.IncomingMessage): [httpProxy, string] => {\n // If the request path is prefixed with this.proxyEndpoint, remove it.\n const proxyEndpointPath = new RegExp(`^${this.proxyEndpoint}`, 'i');\n const forwardPath = request.url?.replace(proxyEndpointPath, '') || '';\n\n return [proxy, forwardPath];\n };\n }\n\n public async serve(): Promise<http.Server> {\n return new Promise<http.Server>((resolve, reject) => {\n const proxyHandler = this.createProxy();\n const server = http.createServer(\n (request: http.IncomingMessage, response: http.ServerResponse) => {\n // This endpoind is used by the frontend to issue a cookie for the user.\n // But the MkDocs server doesn't expose it as a the Backestage backend does.\n // So we need to fake it here to prevent 404 errors.\n if (request.url === '/api/techdocs/cookie') {\n const oneHourInMilliseconds = 60 * 60 * 1000;\n const expiresAt = new Date(Date.now() + oneHourInMilliseconds);\n const cookie = { expiresAt: expiresAt.toISOString() };\n response.setHeader('Content-Type', 'application/json');\n response.end(JSON.stringify(cookie));\n return;\n }\n\n if (request.url?.startsWith(this.proxyEndpoint)) {\n const [proxy, forwardPath] = proxyHandler(request);\n\n proxy.on('error', (error: Error) => {\n reject(error);\n });\n\n response.setHeader('Access-Control-Allow-Origin', '*');\n response.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n\n request.url = forwardPath;\n proxy.web(request, response);\n return;\n }\n\n // This endpoint is used by the frontend to detect where the backend is running.\n if (request.url === '/.detect') {\n response.setHeader('Content-Type', 'text/plain');\n response.end('techdocs-cli-server');\n return;\n }\n\n serveHandler(request, response, {\n public: this.backstageBundleDir,\n trailingSlash: true,\n rewrites: [{ source: '**', destination: 'index.html' }],\n });\n },\n );\n\n const logger = createLogger({ verbose: false });\n server.listen(this.backstagePort, () => {\n if (this.verbose) {\n logger.info(\n `[techdocs-preview-bundle] Running local version of Backstage at http://localhost:${this.backstagePort}`,\n );\n }\n resolve(server);\n });\n\n server.on('error', (error: Error) => {\n reject(error);\n });\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 { OptionValues } from 'commander';\nimport path from 'path';\nimport openBrowser from 'react-dev-utils/openBrowser';\nimport { findPaths } from '@backstage/cli-common';\nimport HTTPServer from '../../lib/httpServer';\nimport { runMkdocsServer } from '../../lib/mkdocsServer';\nimport { LogFunc, waitForSignal } from '../../lib/run';\nimport { createLogger } from '../../lib/utility';\nimport { getMkdocsYml } from '@backstage/plugin-techdocs-node';\nimport fs from 'fs-extra';\nimport { checkIfDockerIsOperational } from './utils';\n\nfunction findPreviewBundlePath(): string {\n try {\n return path.join(\n path.dirname(require.resolve('techdocs-cli-embedded-app/package.json')),\n 'dist',\n );\n } catch {\n // If the techdocs-cli-embedded-app package is not available it means we're\n // running a published package. For published packages the preview bundle is\n // copied to dist/embedded-app be the prepack script.\n //\n // This can be tested by running `yarn pack` and extracting the resulting tarball into a directory.\n // Within the extracted directory, run `npm install --only=prod`.\n // Once that's done you can test the CLI in any directory using `node <tmp-dir>/package <command>`.\n // eslint-disable-next-line no-restricted-syntax\n return findPaths(__dirname).resolveOwn('dist/embedded-app');\n }\n}\n\nfunction getPreviewAppPath(opts: OptionValues): string {\n return opts.previewAppBundlePath ?? findPreviewBundlePath();\n}\n\nexport default async function serve(opts: OptionValues) {\n const logger = createLogger({ verbose: opts.verbose });\n\n // Determine if we want to run in local dev mode or not\n // This will run the backstage http server on a different port and only used\n // for proxying mkdocs to the backstage app running locally (e.g. with webpack-dev-server)\n const isDevMode = Object.keys(process.env).includes('TECHDOCS_CLI_DEV_MODE')\n ? true\n : false;\n\n const backstageBackendPort = 7007;\n\n const mkdocsDockerAddr = `http://0.0.0.0:${opts.mkdocsPort}`;\n const mkdocsLocalAddr = `http://127.0.0.1:${opts.mkdocsPort}`;\n const mkdocsExpectedDevAddr = opts.docker\n ? mkdocsDockerAddr\n : mkdocsLocalAddr;\n const mkdocsConfigFileName = opts.mkdocsConfigFileName;\n const siteName = opts.siteName;\n\n const { path: mkdocsYmlPath, configIsTemporary } = await getMkdocsYml('./', {\n name: siteName,\n mkdocsConfigFileName,\n });\n\n // Validate that Docker is up and running\n if (opts.docker) {\n const isDockerOperational = await checkIfDockerIsOperational(logger);\n if (!isDockerOperational) {\n return;\n }\n }\n\n let mkdocsServerHasStarted = false;\n const mkdocsLogFunc: LogFunc = data => {\n // Sometimes the lines contain an unnecessary extra new line\n const logLines = data.toString().split('\\n');\n const logPrefix = opts.docker ? '[docker/mkdocs]' : '[mkdocs]';\n logLines.forEach(line => {\n if (line === '') {\n return;\n }\n\n logger.verbose(`${logPrefix} ${line}`);\n\n // When the server has started, open a new browser tab for the user.\n if (\n !mkdocsServerHasStarted &&\n line.includes(`Serving on ${mkdocsExpectedDevAddr}`)\n ) {\n mkdocsServerHasStarted = true;\n }\n });\n };\n // mkdocs writes all of its logs to stderr by default, and not stdout.\n // https://github.com/mkdocs/mkdocs/issues/879#issuecomment-203536006\n // Had me questioning this whole implementation for half an hour.\n logger.info('Starting mkdocs server.');\n const mkdocsChildProcess = await runMkdocsServer({\n port: opts.mkdocsPort,\n dockerImage: opts.dockerImage,\n dockerEntrypoint: opts.dockerEntrypoint,\n dockerOptions: opts.dockerOption,\n useDocker: opts.docker,\n stdoutLogFunc: mkdocsLogFunc,\n stderrLogFunc: mkdocsLogFunc,\n mkdocsConfigFileName: mkdocsYmlPath,\n mkdocsParameterClean: opts.mkdocsParameterClean,\n mkdocsParameterDirtyReload: opts.mkdocsParameterDirtyreload,\n mkdocsParameterStrict: opts.mkdocsParameterStrict,\n });\n\n // Wait until mkdocs server has started so that Backstage starts with docs loaded\n // Takes 1-5 seconds\n for (let attempt = 0; attempt < 30; attempt++) {\n await new Promise(r => setTimeout(r, 3000));\n if (mkdocsServerHasStarted) {\n break;\n }\n logger.info('Waiting for mkdocs server to start...');\n }\n\n if (!mkdocsServerHasStarted) {\n logger.error(\n 'mkdocs server did not start. Exiting. Try re-running command with -v option for more details.',\n );\n }\n\n const port = isDevMode ? backstageBackendPort : opts.previewAppPort;\n const previewAppPath = getPreviewAppPath(opts);\n const httpServer = new HTTPServer(\n previewAppPath,\n port,\n mkdocsExpectedDevAddr,\n opts.verbose,\n );\n\n httpServer\n .serve()\n .catch(err => {\n logger.error('Failed to start HTTP server', err);\n mkdocsChildProcess.kill();\n process.exit(1);\n })\n .then(() => {\n // The last three things default/component/local/ don't matter. They can be anything.\n openBrowser(`http://localhost:${port}/docs/default/component/local/`);\n logger.info(\n `Serving docs in Backstage at http://localhost:${port}/docs/default/component/local/\\nOpening browser.`,\n );\n });\n\n await waitForSignal([mkdocsChildProcess]);\n\n if (configIsTemporary) {\n process.on('exit', async () => {\n fs.rmSync(mkdocsYmlPath, {});\n });\n }\n}\n"],"names":["httpProxy","http","serveHandler","createLogger","path","findPaths","getMkdocsYml","checkIfDockerIsOperational","runMkdocsServer","openBrowser","waitForSignal","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAqB,UAAW,CAAA;AAAA,EAO9B,WACE,CAAA,kBAAA,EACA,aACA,EAAA,mBAAA,EACA,OACA,EAAA;AAXF,IAAiB,aAAA,CAAA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AAA,CAAA,EAAA,CAAG,QAAQ,YAAY;AAC7B,MAAGC,mBAAA,CAAA,MAAA,CAAO,aAAe,EAAA,EAAE,CAAA,CAAA;AAAA,KAC5B,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[4036],{70048:function(I,v,t){t.d(v,{K:function(){return a}});var e=t(18690);function a(P){return(0,e.g)()}},93160:function(I,v,t){t.d(v,{b:function(){return j},W:function(){return V}});var e=t(31085),a=t(14041),P=t(18690),x=t(24504),A=t(72020),D=t(86892),B=t(16203),L=t(45061),S=t(39299),K=t(82779),U=t(70048),R=t(19402),W=t(22020),F=t(82266),C=t(64947),M=t(72427),O=t(70795),p=t(57405),H=t(16261);function $(i,c){const[E,h]=(0,a.useState)({status:"not-executed",error:void 0,result:c}),s=(0,a.useRef)(),n=(0,a.useRef)(),g=(0,H.J)({execute(...u){n.current=u;const d=i(...u);return s.current=d,h(o=>({...o,status:"loading"})),d.then(o=>{d===s.current&&h(r=>({...r,status:"success",error:void 0,result:o}))},o=>{d===s.current&&h(r=>({...r,status:"error",error:o}))}),d},reset(){h({status:"not-executed",error:void 0,result:c}),s.current=void 0,n.current=void 0}});return[E,(0,a.useMemo)(()=>({reset(){g.current.reset()},execute:(...u)=>g.current.execute(...u)}),[]),{promise:s.current,lastArgs:n.current}]}var Y=t(76842),N=t(70835);const T="/.backstage/auth/v1/cookie";function y(i){const{pluginId:c}=i!=null?i:{},E=(0,M.gf)(O.a),h=(0,M.gf)(p.I),s=(0,a.useMemo)(()=>"BroadcastChannel"in window?new BroadcastChannel(`${c}-auth-cookie-expires-at`):null,[c]),[n,g]=$(async()=>{const r=`${await h.getBaseUrl(c)}${T}`,l=await E.fetch(`${r}`,{credentials:"include"});if(!l.ok)throw await N.o.fromResponse(l);const f=await l.json();if(!f.expiresAt)throw new Error("No expiration date found in response");return f});(0,Y.u)(g.execute);const u=(0,a.useCallback)(()=>{g.execute()},[g]),d=(0,a.useCallback)(o=>{const r=(1+3*Math.random())*6e4,l=Date.parse(o.expiresAt)-Date.now()-r,f=setTimeout(u,l);return()=>clearTimeout(f)},[u]);return(0,a.useEffect)(()=>{if(n.status!=="success"||!n.result)return()=>{};s==null||s.postMessage({action:"COOKIE_REFRESH_SUCCESS",payload:n.result});let o=d(n.result);const r=l=>{const{action:f,payload:Z}=l.data;f==="COOKIE_REFRESH_SUCCESS"&&(o(),o=d(Z))};return s==null||s.addEventListener("message",r),()=>{o(),s==null||s.removeEventListener("message",r)}},[n,d,s]),n.status==="not-executed"?{status:"loading"}:n.status==="loading"&&!n.result?{status:"loading"}:n.status==="loading"&&n.error?{status:"loading"}:n.status==="error"&&n.error?{status:"error",error:n.error,retry:u}:{status:"success",data:n.result}}function m(i){const{children:c,...E}=i,h=(0,F.n)(),{Progress:s}=h.getComponents(),n=y(E);return n.status==="loading"?(0,e.jsx)(s,{}):n.status==="error"?(0,e.jsx)(W.b,{error:n.error,children:(0,e.jsx)(C.A,{variant:"outlined",onClick:n.retry,children:"Retry"})}):(0,e.jsx)(e.Fragment,{children:c})}const j=i=>{const{withSearch:c,withHeader:E=!0}=i;return(0,e.jsxs)(x.Y,{themeId:"documentation",children:[E&&(0,e.jsx)(L.T,{}),(0,e.jsx)(S.Z,{}),(0,e.jsx)(B.p,{withSearch:c})]})},V=i=>{const{kind:c,name:E,namespace:h}=(0,U.K)(K.Oc),{children:s,entityRef:n={kind:c,name:E,namespace:h}}=i,g=(0,P.P1)();if(!s){const o=(g?a.Children.toArray(g.props.children):[]).flatMap(r=>{var l,f;return(f=r==null||(l=r.props)===null||l===void 0?void 0:l.children)!==null&&f!==void 0?f:[]}).find(r=>!(0,R.E)(r,A.AF)&&!(0,R.E)(r,A.Wm));return(0,e.jsx)(m,{pluginId:"techdocs",children:(0,e.jsx)(D.R,{entityRef:n,children:o||(0,e.jsx)(j,{})})})}return(0,e.jsx)(m,{pluginId:"techdocs",children:(0,e.jsx)(D.R,{entityRef:n,children:({metadata:u,entityMetadata:d,onReady:o})=>(0,e.jsx)("div",{className:"techdocs-reader-page",children:(0,e.jsx)(x.Y,{themeId:"documentation",children:s instanceof Function?s({entityRef:n,techdocsMetadataValue:u.value,entityMetadataValue:d.value,onReady:o}):s})})})})}},84036:function(I,v,t){t.r(v),t.d(v,{TechDocsReaderLayout:function(){return e.b},TechDocsReaderPage:function(){return e.W}});var e=t(93160)},39299:function(I,v,t){t.d(v,{Z:function(){return F}});var e=t(31085),a=t(14041),P=t(58837),x=t(29365),A=t(75173),D=t(71677),B=t(37757),L=t(10394),S=t(9684),K=t(86892),U=t(72020),R=t(99730);const W=(0,P.A)(C=>({root:{gridArea:"pageSubheader",flexDirection:"column",minHeight:"auto",padding:C.spacing(3,3,0),"@media print":{display:"none"}}})),F=C=>{const M=W(),[O,p]=(0,a.useState)(null),H=(0,a.useCallback)(j=>{p(j.currentTarget)},[]),$=(0,a.useCallback)(()=>{p(null)},[]),{entityMetadata:{value:Y,loading:N}}=(0,K.V)(),T=(0,U.YR)(),y=T.renderComponentsByLocation(R.e.Subheader),m=T.renderComponentsByLocation(R.e.Settings);return!y&&!m||N===!1&&!Y?null:(0,e.jsx)(A.A,{classes:M,...C.toolbarProps,children:(0,e.jsxs)(L.A,{display:"flex",justifyContent:"flex-end",width:"100%",flexWrap:"wrap",children:[y,m?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(D.Ay,{title:"Settings",children:(0,e.jsx)(x.A,{"aria-controls":"tech-docs-reader-page-settings","aria-haspopup":"true",onClick:H,children:(0,e.jsx)(S.A,{})})}),(0,e.jsx)(B.A,{id:"tech-docs-reader-page-settings",getContentAnchorEl:null,anchorEl:O,anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!!O,onClose:$,keepMounted:!0,children:(0,e.jsx)("div",{children:m})})]}):null]})})}}}]);})();
|
|
2
|
-
|
|
3
|
-
//# sourceMapp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AAU,SAAUC,WAAY,OAAQ,EACxDC,KAAMC,EAAQpC,EACdqC,QAAShC,EACTiC,YAAW,G,YAEX,OAACvD,MAAAA,C,SAAKgC,C,QAGR,I,KAIZ,C","sources":["webpack://techdocs-cli-embedded-app/../core-plugin-api/src/routing/useRouteRefParams.ts","webpack://techdocs-cli-embedded-app/../../node_modules/@react-hookz/web/src/useAsync/index.js","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/hooks/useCookieAuthRefresh/useCookieAuthRefresh.tsx","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useParams } from 'react-router-dom';\nimport { RouteRef, AnyParams, SubRouteRef } from './types';\n\n/**\n * React hook for retrieving dynamic params from the current URL.\n * @param _routeRef - Ref of the current route.\n * @public\n */\nexport function useRouteRefParams<Params extends AnyParams>(\n _routeRef: RouteRef<Params> | SubRouteRef<Params>,\n): Params {\n return useParams() as Params;\n}\n","import { useMemo, useRef, useState } from 'react';\nimport { useSyncedRef } from '../useSyncedRef/index.js';\nexport function useAsync(asyncFn, initialValue) {\n const [state, setState] = useState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n const promiseRef = useRef();\n const argsRef = useRef();\n const methods = useSyncedRef({\n execute(...params) {\n argsRef.current = params;\n const promise = asyncFn(...params);\n promiseRef.current = promise;\n setState((s) => ({ ...s, status: 'loading' }));\n promise.then((result) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'success', error: undefined, result }));\n }\n }, (error) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'error', error }));\n }\n });\n return promise;\n },\n reset() {\n setState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n promiseRef.current = undefined;\n argsRef.current = undefined;\n },\n });\n return [\n state,\n useMemo(() => ({\n reset() {\n methods.current.reset();\n },\n execute: (...params) => methods.current.execute(...params),\n }), []),\n { promise: promiseRef.current, lastArgs: argsRef.current },\n ];\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useCallback, useMemo } from 'react';\nimport {\n discoveryApiRef,\n fetchApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsync, useMountEffect } from '@react-hookz/web';\nimport { ResponseError } from '@backstage/errors';\n\nconst COOKIE_PATH = '/.backstage/auth/v1/cookie';\n\n/**\n * @public\n * A hook that will refresh the cookie when it is about to expire.\n * @param options - Options for configuring the refresh cookie endpoint\n */\nexport function useCookieAuthRefresh(options: {\n // The plugin id used for discovering the API origin\n pluginId: string;\n}):\n | { status: 'loading' }\n | { status: 'error'; error: Error; retry: () => void }\n | { status: 'success'; data: { expiresAt: string } } {\n const { pluginId } = options ?? {};\n const fetchApi = useApi(fetchApiRef);\n const discoveryApi = useApi(discoveryApiRef);\n\n const channel = useMemo(() => {\n return 'BroadcastChannel' in window\n ? new BroadcastChannel(`${pluginId}-auth-cookie-expires-at`)\n : null;\n }, [pluginId]);\n\n const [state, actions] = useAsync<{ expiresAt: string }>(async () => {\n const apiOrigin = await discoveryApi.getBaseUrl(pluginId);\n const requestUrl = `${apiOrigin}${COOKIE_PATH}`;\n const response = await fetchApi.fetch(`${requestUrl}`, {\n credentials: 'include',\n });\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n const data = await response.json();\n if (!data.expiresAt) {\n throw new Error('No expiration date found in response');\n }\n return data;\n });\n\n useMountEffect(actions.execute);\n\n const retry = useCallback(() => {\n actions.execute();\n }, [actions]);\n\n const refresh = useCallback(\n (params: { expiresAt: string }) => {\n // Randomize the refreshing margin with a margin of 1-4 minutes to avoid all tabs refreshing at the same time\n // It cannot be less than 5 minutes otherwise the backend will return the same expiration date\n const margin = (1 + 3 * Math.random()) * 60000;\n const delay = Date.parse(params.expiresAt) - Date.now() - margin;\n const timeout = setTimeout(retry, delay);\n return () => clearTimeout(timeout);\n },\n [retry],\n );\n\n useEffect(() => {\n // Only schedule a refresh if we have a successful response\n if (state.status !== 'success' || !state.result) {\n return () => {};\n }\n channel?.postMessage({\n action: 'COOKIE_REFRESH_SUCCESS',\n payload: state.result,\n });\n let cancel = refresh(state.result);\n const listener = (\n event: MessageEvent<{ action: string; payload: { expiresAt: string } }>,\n ) => {\n const { action, payload } = event.data;\n if (action === 'COOKIE_REFRESH_SUCCESS') {\n cancel();\n cancel = refresh(payload);\n }\n };\n channel?.addEventListener('message', listener);\n return () => {\n cancel();\n channel?.removeEventListener('message', listener);\n };\n }, [state, refresh, channel]);\n\n // Initialising\n if (state.status === 'not-executed') {\n return { status: 'loading' };\n }\n\n // First refresh or retrying without any success before\n // Possible state transitions:\n // e.g. not-executed -> loading (first-refresh)\n // e.g. not-executed -> loading (first-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && !state.result) {\n return { status: 'loading' };\n }\n\n // Retrying after having succeeding at least once\n // Current state is: { status: 'loading', result: {...}, error: undefined | Error }\n // e.g. not-executed -> loading (first-refresh) -> success -> loading (scheduled-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && state.error) {\n return { status: 'loading' };\n }\n\n // Something went wrong during any situation of a refresh\n if (state.status === 'error' && state.error) {\n return { status: 'error', error: state.error, retry };\n }\n\n // At this point it should be safe to assume that we have a successful refresh\n return { status: 'success', data: state.result! };\n}\n","/*\n * Copyright 2024 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, { ReactNode } from 'react';\nimport { ErrorPanel } from '@backstage/core-components';\nimport { useApp } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport { useCookieAuthRefresh } from '../../hooks';\n\n/**\n * @public\n * Props for the {@link CookieAuthRefreshProvider} component.\n */\nexport type CookieAuthRefreshProviderProps = {\n // The plugin ID used for discovering the API origin\n pluginId: string;\n // The children to render when the refresh is successful\n children: ReactNode;\n};\n\n/**\n * @public\n * A provider that will refresh the cookie when it is about to expire.\n */\nexport function CookieAuthRefreshProvider(\n props: CookieAuthRefreshProviderProps,\n): JSX.Element {\n const { children, ...options } = props;\n const app = useApp();\n const { Progress } = app.getComponents();\n\n const result = useCookieAuthRefresh(options);\n\n if (result.status === 'loading') {\n return <Progress />;\n }\n\n if (result.status === 'error') {\n return (\n <ErrorPanel error={result.error}>\n <Button variant=\"outlined\" onClick={result.retry}>\n Retry\n </Button>\n </ErrorPanel>\n );\n }\n\n return <>{children}</>;\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode, Children, ReactElement } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nimport { Page } from '@backstage/core-components';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport {\n TECHDOCS_ADDONS_WRAPPER_KEY,\n TECHDOCS_ADDONS_KEY,\n TechDocsReaderPageProvider,\n} from '@backstage/plugin-techdocs-react';\n\nimport { TechDocsReaderPageRenderFunction } from '../../../types';\n\nimport { TechDocsReaderPageContent } from '../TechDocsReaderPageContent';\nimport { TechDocsReaderPageHeader } from '../TechDocsReaderPageHeader';\nimport { TechDocsReaderPageSubheader } from '../TechDocsReaderPageSubheader';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n getComponentData,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\n\nimport { CookieAuthRefreshProvider } from '@backstage/plugin-auth-react';\n\n/* An explanation for the multiple ways of customizing the TechDocs reader page\n\nPlease refer to this page on the microsite for the latest recommended approach:\nhttps://backstage.io/docs/features/techdocs/how-to-guides#how-to-customize-the-techdocs-reader-page\n\nThe <TechDocsReaderPage> component is responsible for rendering the <TechDocsReaderPageProvider> and\nits contained version of a <Page>, which in turn renders the <TechDocsReaderPageContent>.\n\nHistorically, there have been different approaches on how this <Page> can be customized, and how the\n<TechDocsReaderPageContent> inside could be exchanged for a custom implementation (which was not\npossible before). Also, the current implementation supports every scenario to avoid breaking default\nconfigurations of TechDocs.\n\nIn particular, there are 4 different TechDocs page configurations:\n\nCONFIGURATION 1: <TechDocsReaderPage> only, no children\n\n<Route path=\"/docs/:namespace/:kind/:name/*\" element={<TechDocsReaderPage />} >\n\nThis is the simplest way to use TechDocs. Only a full page is passed, assuming that it comes with\nits content inside. Since we allowed customizing it, we started providing <TechDocsReaderLayout> as\na default implementation (which contains <TechDocsReaderPageContent>).\n\nCONFIGURATION 2 (not advised): <TechDocsReaderPage> with element children\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {techdocsPage}\n </TechDocsReaderPage>\n }\n/>\n\nPreviously, there were two ways of passing children to <TechDocsReaderPage>: either as elements (as\nshown above), or as a render function (described below in CONFIGURATION 3). The \"techdocsPage\" is\nlocated in packages/app/src/components/techdocs and is the default implementation of the content\ninside.\n\nCONFIGURATION 3 (not advised): <TechDocsReaderPage> with render function as child\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {({ metadata, entityMetadata, onReady }) => (\n techdocsPage\n )}\n </TechDocsReaderPage>\n }\n/>\n\nSimilar to CONFIGURATION 2, the direct children will be passed to the <TechDocsReaderPage> but in\nthis case interpreted as render prop.\n\nCONFIGURATION 4: <TechDocsReaderPage> and provided content in <Route>\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n>\n {techDocsPage}\n <TechDocsAddons>\n <ExpandableNavigation />\n <ReportIssue />\n <TextSize />\n <LightBox />\n </TechDocsAddons>\n</Route>\n\nThis is the current state in packages/app/src/App.tsx and moved the location of children from inside\nthe element prop in the <Route> to the children of the <Route>. Then, in <TechDocsReaderPage> they\nare retrieved using the useOutlet hook from React Router.\n\nNOTE: Render functions are no longer supported in this approach.\n*/\n\n/**\n * Props for {@link TechDocsReaderLayout}\n * @public\n */\nexport type TechDocsReaderLayoutProps = {\n /**\n * Show or hide the header, defaults to true.\n */\n withHeader?: boolean;\n /**\n * Show or hide the content search bar, defaults to true.\n */\n withSearch?: boolean;\n};\n\n/**\n * Default TechDocs reader page structure composed with a header and content\n * @public\n */\nexport const TechDocsReaderLayout = (props: TechDocsReaderLayoutProps) => {\n const { withSearch, withHeader = true } = props;\n return (\n <Page themeId=\"documentation\">\n {withHeader && <TechDocsReaderPageHeader />}\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={withSearch} />\n </Page>\n );\n};\n\n/**\n * @public\n */\nexport type TechDocsReaderPageProps = {\n entityRef?: CompoundEntityRef;\n children?: TechDocsReaderPageRenderFunction | ReactNode;\n};\n\n/**\n * An addon-aware implementation of the TechDocsReaderPage.\n *\n * @public\n */\nexport const TechDocsReaderPage = (props: TechDocsReaderPageProps) => {\n const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);\n const { children, entityRef = { kind, name, namespace } } = props;\n\n const outlet = useOutlet();\n\n if (!children) {\n const childrenList = outlet ? Children.toArray(outlet.props.children) : [];\n\n const grandChildren = childrenList.flatMap<ReactElement>(\n child => (child as ReactElement)?.props?.children ?? [],\n );\n\n const page: React.ReactNode = grandChildren.find(\n grandChild =>\n !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) &&\n !getComponentData(grandChild, TECHDOCS_ADDONS_KEY),\n );\n\n // As explained above, \"page\" is configuration 4 and <TechDocsReaderLayout> is 1\n return (\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {(page as JSX.Element) || <TechDocsReaderLayout />}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n );\n }\n\n // As explained above, a render function is configuration 3 and React element is 2\n return (\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {({ metadata, entityMetadata, onReady }) => (\n <div className=\"techdocs-reader-page\">\n <Page themeId=\"documentation\">\n {children instanceof Function\n ? children({\n entityRef,\n techdocsMetadataValue: metadata.value,\n entityMetadataValue: entityMetadata.value,\n onReady,\n })\n : children}\n </Page>\n </div>\n )}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { MouseEvent, useState, useCallback } from 'react';\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport { ToolbarProps } from '@material-ui/core/Toolbar';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Menu from '@material-ui/core/Menu';\nimport Box from '@material-ui/core/Box';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport {\n TechDocsAddonLocations as locations,\n useTechDocsAddons,\n useTechDocsReaderPage,\n} from '@backstage/plugin-techdocs-react';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageSubheader',\n flexDirection: 'column',\n minHeight: 'auto',\n padding: theme.spacing(3, 3, 0),\n '@media print': {\n display: 'none',\n },\n },\n}));\n\n/**\n * Renders the reader page subheader.\n * Please use the Tech Docs add-ons to customize it\n * @public\n */\nexport const TechDocsReaderPageSubheader = (props: {\n toolbarProps?: ToolbarProps;\n}) => {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const handleClose = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n const {\n entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },\n } = useTechDocsReaderPage();\n\n const addons = useTechDocsAddons();\n\n const subheaderAddons = addons.renderComponentsByLocation(\n locations.Subheader,\n );\n\n const settingsAddons = addons.renderComponentsByLocation(locations.Settings);\n\n if (!subheaderAddons && !settingsAddons) return null;\n\n // No entity metadata = 404. Don't render subheader on 404.\n if (entityMetadataLoading === false && !entityMetadata) return null;\n\n return (\n <Toolbar classes={classes} {...props.toolbarProps}>\n <Box\n display=\"flex\"\n justifyContent=\"flex-end\"\n width=\"100%\"\n flexWrap=\"wrap\"\n >\n {subheaderAddons}\n {settingsAddons ? (\n <>\n <Tooltip title=\"Settings\">\n <IconButton\n aria-controls=\"tech-docs-reader-page-settings\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n >\n <SettingsIcon />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"tech-docs-reader-page-settings\"\n getContentAnchorEl={null}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n open={Boolean(anchorEl)}\n onClose={handleClose}\n keepMounted\n >\n <div>{settingsAddons}</div>\n </Menu>\n </>\n ) : null}\n </Box>\n </Toolbar>\n );\n};\n"],"names":["useRouteRefParams","_routeRef","useParams","useAsync","asyncFn","initialValue","state","setState","promiseRef","argsRef","methods","useSyncedRef","params","promise","s","result","error","COOKIE_PATH","useCookieAuthRefresh","options","pluginId","fetchApi","useApi","fetchApiRef","discoveryApi","discoveryApiRef","channel","useMemo","window","BroadcastChannel","actions","requestUrl","getBaseUrl","response","fetch","credentials","ok","ResponseError","fromResponse","data","json","expiresAt","Error","useMountEffect","execute","retry","useCallback","refresh","margin","Math","random","delay","Date","parse","now","timeout","setTimeout","clearTimeout","useEffect","status","postMessage","action","payload","cancel","listener","event","addEventListener","removeEventListener","CookieAuthRefreshProvider","props","children","app","useApp","Progress","getComponents","ErrorPanel","Button","variant","onClick","TechDocsReaderLayout","withSearch","withHeader","Page","themeId","TechDocsReaderPageHeader","TechDocsReaderPageSubheader","TechDocsReaderPageContent","TechDocsReaderPage","kind","name","namespace","rootDocsRouteRef","entityRef","outlet","useOutlet","page","Children","toArray","flatMap","child","find","grandChild","getComponentData","TECHDOCS_ADDONS_WRAPPER_KEY","TECHDOCS_ADDONS_KEY","TechDocsReaderPageProvider","metadata","entityMetadata","onReady","div","className","Function","techdocsMetadataValue","value","entityMetadataValue","useStyles","makeStyles","theme","root","gridArea","flexDirection","minHeight","padding","spacing","display","classes","anchorEl","setAnchorEl","useState","handleClick","currentTarget","handleClose","loading","entityMetadataLoading","useTechDocsReaderPage","addons","useTechDocsAddons","subheaderAddons","renderComponentsByLocation","locations","Subheader","settingsAddons","Settings","Toolbar","toolbarProps","Box","justifyContent","width","flexWrap","Tooltip","title","IconButton","aria-controls","aria-haspopup","SettingsIcon","Menu","id","getContentAnchorEl","anchorOrigin","vertical","horizontal","open","Boolean","onClose","keepMounted"],"sourceRoot":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[9605,5788],{70048:function(N,g,t){t.d(g,{K:function(){return l}});var n=t(18690);function l(f){return(0,n.g)()}},99538:function(N,g,t){t.d(g,{T7:function(){return T},TY:function(){return S},tN:function(){return L}});var n=t(31085),l=t(6820),f=t(25862),x=t(43836),C=t(10602),M=t(14041);const p=(0,x.tK)("entity-context"),T=c=>{const{children:m,entity:D,loading:P,error:R,refresh:O}=c,I={entity:D,loading:P,error:R,refresh:O};return(0,n.jsx)(p.Provider,{value:(0,C.B)({1:I}),children:(0,n.jsx)(f.Ig,{attributes:{...D?{entityRef:(0,l.U2)(D)}:void 0},children:m})})},K=c=>_jsx(T,{entity:c.entity,loading:!c.entity,error:void 0,refresh:void 0,children:c.children});function L(){const c=(0,x.qO)("entity-context");if(!c)throw new Error("Entity context is not available");const m=c.atVersion(1);if(!m)throw new Error("EntityContext v1 not available");if(!m.entity)throw new Error("useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.");return{entity:m.entity}}function S(){const c=(0,x.qO)("entity-context");if(!c)throw new Error("Entity context is not available");const m=c.atVersion(1);if(!m)throw new Error("EntityContext v1 not available");const{entity:D,loading:P,error:R,refresh:O}=m;return{entity:D,loading:P,error:R,refresh:O}}},29605:function(N,g,t){t.r(g),t.d(g,{EmbeddedDocsRouter:function(){return y},Router:function(){return V},isTechDocsAvailable:function(){return W}});var n=t(31085),l=t(14041),f=t(18690),x=t(6820),C=t(39278),M=t(16203),p=t(39299);const T="backstage.io/techdocs-entity",K=({entity:a})=>{var o;let r=(0,x.sM)(a);if(!((o=a.metadata.annotations)===null||o===void 0)&&o[T])try{var e;r=(0,x.KU)((e=a.metadata.annotations)===null||e===void 0?void 0:e[T])}catch{}return(0,n.jsxs)(C.Wj,{entityRef:r,children:[(0,n.jsx)(p.Z,{}),(0,n.jsx)(M.p,{withSearch:!1})]})};var L=t(85788),S=t(93160),c=t(99538),m=t(10394),D=t(64947),P=t(58837),R=t(72501),O=t(44186),I=t(77310),H=t(72072);const F=(0,P.A)(a=>({code:{borderRadius:6,margin:a.spacing(2,0),background:a.palette.type==="dark"?"#444":a.palette.common.white}}),{name:"BackstageMissingAnnotationEmptyState"});function $(a,o){var r,e;const s=(o==null?void 0:o.kind)||"Component",E=(o==null?void 0:o.metadata.name)||"example",h=(o==null||(r=o.spec)===null||r===void 0?void 0:r.type)||"website",u=(o==null||(e=o.spec)===null||e===void 0?void 0:e.owner)||"user:default/guest",d=`apiVersion: backstage.io/v1alpha1
|
|
2
|
-
kind: ${s}
|
|
3
|
-
metadata:
|
|
4
|
-
name: ${E}
|
|
5
|
-
annotations:${a.map(A=>`
|
|
6
|
-
${A}: value`).join("")}
|
|
7
|
-
spec:
|
|
8
|
-
type: ${h}
|
|
9
|
-
owner: ${u}`;let i=6;const v=[];return a.forEach(()=>{v.push(i),i++}),{yamlText:d,lineNumbers:v}}function Y(a,o="Component"){const r=a.length<=1;return(0,n.jsxs)(n.Fragment,{children:["The ",r?"annotation":"annotations"," ",a.map(e=>(0,n.jsx)("code",{children:e})).reduce((e,s)=>(0,n.jsxs)(n.Fragment,{children:[e,", ",s]}))," ",r?"is":"are"," missing. You need to add the"," ",r?"annotation":"annotations"," to your ",o," if you want to enable this tool."]})}function U(a){let o;try{o=(0,c.tN)().entity}catch{}const{annotation:r,readMoreUrl:e}=a,s=Array.isArray(r)?r:[r],E=e||"https://backstage.io/docs/features/software-catalog/well-known-annotations",h=F(),u=(o==null?void 0:o.kind)||"Component",{yamlText:d,lineNumbers:i}=$(s,o);return(0,n.jsx)(O.p,{missing:"field",title:"Missing Annotation",description:Y(s,u),action:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(R.A,{variant:"body1",children:["Add the annotation to your ",u," YAML as shown in the highlighted example below:"]}),(0,n.jsx)(m.A,{className:h.code,children:(0,n.jsx)(I.z,{text:d,language:"yaml",showLineNumbers:!0,highlightedNumbers:i,customStyle:{background:"inherit",fontSize:"115%"}})}),(0,n.jsx)(D.A,{color:"primary",component:H.N_,to:E,children:"Read more"})]})})}const B="backstage.io/techdocs-ref",j="backstage.io/techdocs-entity",W=a=>{var o,r,e,s;return!!(!(a==null||(r=a.metadata)===null||r===void 0||(o=r.annotations)===null||o===void 0)&&o[B])||!!(!(a==null||(s=a.metadata)===null||s===void 0||(e=s.annotations)===null||e===void 0)&&e[j])},V=()=>(0,n.jsxs)(f.BV,{children:[(0,n.jsx)(f.qh,{path:"/",element:(0,n.jsx)(L.TechDocsIndexPage,{})}),(0,n.jsx)(f.qh,{path:"/:namespace/:kind/:name/*",element:(0,n.jsx)(S.W,{})})]}),y=a=>{var o,r;const{children:e}=a,{entity:s}=(0,c.tN)(),E=(0,f.Ye)([{path:"/*",element:(0,n.jsx)(K,{entity:s}),children:[{path:"*",element:e}]}]);return((o=s.metadata.annotations)===null||o===void 0?void 0:o[B])||((r=s.metadata.annotations)===null||r===void 0?void 0:r[j])?E:(0,n.jsx)(U,{annotation:[B]})}},85788:function(N,g,t){t.r(g),t.d(g,{TechDocsIndexPage:function(){return C}});var n=t(31085),l=t(14041),f=t(18690),x=t(85920);const C=M=>(0,f.P1)()||(0,n.jsx)(x.K,{...M})},93160:function(N,g,t){t.d(g,{b:function(){return W},W:function(){return V}});var n=t(31085),l=t(14041),f=t(18690),x=t(24504),C=t(72020),M=t(86892),p=t(16203),T=t(45061),K=t(39299),L=t(82779),S=t(70048),c=t(19402),m=t(22020),D=t(82266),P=t(64947),R=t(72427),O=t(70795),I=t(57405),H=t(16261);function F(y,a){const[o,r]=(0,l.useState)({status:"not-executed",error:void 0,result:a}),e=(0,l.useRef)(),s=(0,l.useRef)(),E=(0,H.J)({execute(...h){s.current=h;const u=y(...h);return e.current=u,r(d=>({...d,status:"loading"})),u.then(d=>{u===e.current&&r(i=>({...i,status:"success",error:void 0,result:d}))},d=>{u===e.current&&r(i=>({...i,status:"error",error:d}))}),u},reset(){r({status:"not-executed",error:void 0,result:a}),e.current=void 0,s.current=void 0}});return[o,(0,l.useMemo)(()=>({reset(){E.current.reset()},execute:(...h)=>E.current.execute(...h)}),[]),{promise:e.current,lastArgs:s.current}]}var $=t(76842),Y=t(70835);const U="/.backstage/auth/v1/cookie";function B(y){const{pluginId:a}=y!=null?y:{},o=(0,R.gf)(O.a),r=(0,R.gf)(I.I),e=(0,l.useMemo)(()=>"BroadcastChannel"in window?new BroadcastChannel(`${a}-auth-cookie-expires-at`):null,[a]),[s,E]=F(async()=>{const i=`${await r.getBaseUrl(a)}${U}`,v=await o.fetch(`${i}`,{credentials:"include"});if(!v.ok)throw await Y.o.fromResponse(v);const A=await v.json();if(!A.expiresAt)throw new Error("No expiration date found in response");return A});(0,$.u)(E.execute);const h=(0,l.useCallback)(()=>{E.execute()},[E]),u=(0,l.useCallback)(d=>{const i=(1+3*Math.random())*6e4,v=Date.parse(d.expiresAt)-Date.now()-i,A=setTimeout(h,v);return()=>clearTimeout(A)},[h]);return(0,l.useEffect)(()=>{if(s.status!=="success"||!s.result)return()=>{};e==null||e.postMessage({action:"COOKIE_REFRESH_SUCCESS",payload:s.result});let d=u(s.result);const i=v=>{const{action:A,payload:z}=v.data;A==="COOKIE_REFRESH_SUCCESS"&&(d(),d=u(z))};return e==null||e.addEventListener("message",i),()=>{d(),e==null||e.removeEventListener("message",i)}},[s,u,e]),s.status==="not-executed"?{status:"loading"}:s.status==="loading"&&!s.result?{status:"loading"}:s.status==="loading"&&s.error?{status:"loading"}:s.status==="error"&&s.error?{status:"error",error:s.error,retry:h}:{status:"success",data:s.result}}function j(y){const{children:a,...o}=y,r=(0,D.n)(),{Progress:e}=r.getComponents(),s=B(o);return s.status==="loading"?(0,n.jsx)(e,{}):s.status==="error"?(0,n.jsx)(m.b,{error:s.error,children:(0,n.jsx)(P.A,{variant:"outlined",onClick:s.retry,children:"Retry"})}):(0,n.jsx)(n.Fragment,{children:a})}const W=y=>{const{withSearch:a,withHeader:o=!0}=y;return(0,n.jsxs)(x.Y,{themeId:"documentation",children:[o&&(0,n.jsx)(T.T,{}),(0,n.jsx)(K.Z,{}),(0,n.jsx)(p.p,{withSearch:a})]})},V=y=>{const{kind:a,name:o,namespace:r}=(0,S.K)(L.Oc),{children:e,entityRef:s={kind:a,name:o,namespace:r}}=y,E=(0,f.P1)();if(!e){const d=(E?l.Children.toArray(E.props.children):[]).flatMap(i=>{var v,A;return(A=i==null||(v=i.props)===null||v===void 0?void 0:v.children)!==null&&A!==void 0?A:[]}).find(i=>!(0,c.E)(i,C.AF)&&!(0,c.E)(i,C.Wm));return(0,n.jsx)(j,{pluginId:"techdocs",children:(0,n.jsx)(M.R,{entityRef:s,children:d||(0,n.jsx)(W,{})})})}return(0,n.jsx)(j,{pluginId:"techdocs",children:(0,n.jsx)(M.R,{entityRef:s,children:({metadata:h,entityMetadata:u,onReady:d})=>(0,n.jsx)("div",{className:"techdocs-reader-page",children:(0,n.jsx)(x.Y,{themeId:"documentation",children:e instanceof Function?e({entityRef:s,techdocsMetadataValue:h.value,entityMetadataValue:u.value,onReady:d}):e})})})})}},39299:function(N,g,t){t.d(g,{Z:function(){return D}});var n=t(31085),l=t(14041),f=t(58837),x=t(29365),C=t(75173),M=t(71677),p=t(37757),T=t(10394),K=t(9684),L=t(86892),S=t(72020),c=t(99730);const m=(0,f.A)(P=>({root:{gridArea:"pageSubheader",flexDirection:"column",minHeight:"auto",padding:P.spacing(3,3,0),"@media print":{display:"none"}}})),D=P=>{const R=m(),[O,I]=(0,l.useState)(null),H=(0,l.useCallback)(W=>{I(W.currentTarget)},[]),F=(0,l.useCallback)(()=>{I(null)},[]),{entityMetadata:{value:$,loading:Y}}=(0,L.V)(),U=(0,S.YR)(),B=U.renderComponentsByLocation(c.e.Subheader),j=U.renderComponentsByLocation(c.e.Settings);return!B&&!j||Y===!1&&!$?null:(0,n.jsx)(C.A,{classes:R,...P.toolbarProps,children:(0,n.jsxs)(T.A,{display:"flex",justifyContent:"flex-end",width:"100%",flexWrap:"wrap",children:[B,j?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(M.Ay,{title:"Settings",children:(0,n.jsx)(x.A,{"aria-controls":"tech-docs-reader-page-settings","aria-haspopup":"true",onClick:H,children:(0,n.jsx)(K.A,{})})}),(0,n.jsx)(p.A,{id:"tech-docs-reader-page-settings",getContentAnchorEl:null,anchorEl:O,anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!!O,onClose:F,keepMounted:!0,children:(0,n.jsx)("div",{children:j})})]}):null]})})}}}]);})();
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=9605.3cd9c86f.chunk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static/9605.3cd9c86f.chunk.js","mappings":"uMAwBO,SAASA,EACdC,EAAiD,CAEjD,SAAOC,EAAAA,GAAU,CACnB,C,8KCOA,MAAMC,KAAmBC,EAAAA,IACvB,gBAAgB,EAqBLC,EAAuBC,GAAAA,CAClC,KAAM,CAAEC,SAAAA,EAAUC,OAAAA,EAAQC,QAAAA,EAASC,MAAAA,EAAOC,QAAAA,CAAQ,EAAIL,EAChDM,EAAQ,CAAEJ,OAAAA,EAAQC,QAAAA,EAASC,MAAAA,EAAOC,QAAAA,CAAQ,EAGhD,SACE,OAACR,EAAiBU,SAAQ,CA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AAAA,C,SAAKwB,C,QAGR,I,KAIZ,C","sources":["webpack://techdocs-cli-embedded-app/../core-plugin-api/src/routing/useRouteRefParams.ts","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/hooks/useEntity.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/EntityPageDocs.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/components/MissingAnnotationEmptyState/MissingAnnotationEmptyState.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/Router.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/TechDocsIndexPage.tsx","webpack://techdocs-cli-embedded-app/../../node_modules/@react-hookz/web/src/useAsync/index.js","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/hooks/useCookieAuthRefresh/useCookieAuthRefresh.tsx","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useParams } from 'react-router-dom';\nimport { RouteRef, AnyParams, SubRouteRef } from './types';\n\n/**\n * React hook for retrieving dynamic params from the current URL.\n * @param _routeRef - Ref of the current route.\n * @public\n */\nexport function useRouteRefParams<Params extends AnyParams>(\n _routeRef: RouteRef<Params> | SubRouteRef<Params>,\n): Params {\n return useParams() as Params;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { AnalyticsContext } from '@backstage/core-plugin-api';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n useVersionedContext,\n} from '@backstage/version-bridge';\nimport React, { ReactNode } from 'react';\n\n/** @public */\nexport type EntityLoadingStatus<TEntity extends Entity = Entity> = {\n entity?: TEntity;\n loading: boolean;\n error?: Error;\n refresh?: VoidFunction;\n};\n\n// This context has support for multiple concurrent versions of this package.\n// It is currently used in parallel with the old context in order to provide\n// a smooth transition, but will eventually be the only context we use.\nconst NewEntityContext = createVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n);\n\n/**\n * Properties for the AsyncEntityProvider component.\n *\n * @public\n */\nexport interface AsyncEntityProviderProps {\n children: ReactNode;\n entity?: Entity;\n loading: boolean;\n error?: Error;\n refresh?: VoidFunction;\n}\n\n/**\n * Provides a loaded entity to be picked up by the `useEntity` hook.\n *\n * @public\n */\nexport const AsyncEntityProvider = (props: AsyncEntityProviderProps) => {\n const { children, entity, loading, error, refresh } = props;\n const value = { entity, loading, error, refresh };\n // We provide both the old and the new context, since\n // consumers might be doing things like `useContext(EntityContext)`\n return (\n <NewEntityContext.Provider value={createVersionedValueMap({ 1: value })}>\n <AnalyticsContext\n attributes={{\n ...(entity ? { entityRef: stringifyEntityRef(entity) } : undefined),\n }}\n >\n {children}\n </AnalyticsContext>\n </NewEntityContext.Provider>\n );\n};\n\n/**\n * Properties for the EntityProvider component.\n *\n * @public\n */\nexport interface EntityProviderProps {\n children: ReactNode;\n entity?: Entity;\n}\n\n/**\n * Provides an entity to be picked up by the `useEntity` hook.\n *\n * @public\n */\nexport const EntityProvider = (props: EntityProviderProps) => (\n <AsyncEntityProvider\n entity={props.entity}\n loading={!Boolean(props.entity)}\n error={undefined}\n refresh={undefined}\n children={props.children}\n />\n);\n\n/**\n * Grab the current entity from the context, throws if the entity has not yet been loaded\n * or is not available.\n *\n * @public\n */\nexport function useEntity<TEntity extends Entity = Entity>(): {\n entity: TEntity;\n} {\n const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n );\n\n if (!versionedHolder) {\n throw new Error('Entity context is not available');\n }\n\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('EntityContext v1 not available');\n }\n\n if (!value.entity) {\n throw new Error(\n 'useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.',\n );\n }\n\n return { entity: value.entity as TEntity };\n}\n\n/**\n * Grab the current entity from the context, provides loading state and errors, and the ability to refresh.\n *\n * @public\n */\nexport function useAsyncEntity<\n TEntity extends Entity = Entity,\n>(): EntityLoadingStatus<TEntity> {\n const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n );\n\n if (!versionedHolder) {\n throw new Error('Entity context is not available');\n }\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('EntityContext v1 not available');\n }\n\n const { entity, loading, error, refresh } = value;\n return { entity: entity as TEntity, loading, error, refresh };\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 {\n Entity,\n getCompoundEntityRef,\n parseEntityRef,\n} from '@backstage/catalog-model';\n\nimport React from 'react';\nimport { TechDocsReaderPage } from './plugin';\nimport { TechDocsReaderPageContent } from './reader/components/TechDocsReaderPageContent';\nimport { TechDocsReaderPageSubheader } from './reader/components/TechDocsReaderPageSubheader';\n\nconst TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity';\n\ntype EntityPageDocsProps = { entity: Entity };\n\nexport const EntityPageDocs = ({ entity }: EntityPageDocsProps) => {\n let entityRef = getCompoundEntityRef(entity);\n\n if (entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) {\n try {\n entityRef = parseEntityRef(\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION],\n );\n } catch {\n // not a fan of this but we don't care if the parseEntityRef fails\n }\n }\n\n return (\n <TechDocsReaderPage entityRef={entityRef}>\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={false} />\n </TechDocsReaderPage>\n );\n};\n","/*\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 Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport { CodeSnippet, Link, EmptyState } from '@backstage/core-components';\nimport { Entity } from '@backstage/catalog-model';\nimport { useEntity } from '../../hooks';\n\n/** @public */\nexport type MissingAnnotationEmptyStateClassKey = 'code';\n\nconst useStyles = makeStyles(\n theme => ({\n code: {\n borderRadius: 6,\n margin: theme.spacing(2, 0),\n background:\n theme.palette.type === 'dark' ? '#444' : theme.palette.common.white,\n },\n }),\n { name: 'BackstageMissingAnnotationEmptyState' },\n);\n\nfunction generateYamlExample(\n annotations: string[],\n entity?: Entity,\n): { yamlText: string; lineNumbers: number[] } {\n const kind = entity?.kind || 'Component';\n const name = entity?.metadata.name || 'example';\n const type = entity?.spec?.type || 'website';\n const owner = entity?.spec?.owner || 'user:default/guest';\n\n const yamlText = `apiVersion: backstage.io/v1alpha1\nkind: ${kind}\nmetadata:\n name: ${name}\n annotations:${annotations.map(ann => `\\n ${ann}: value`).join('')}\nspec:\n type: ${type}\n owner: ${owner}`;\n\n let line = 6; // Line 6 is the line number that annotations are added to.\n const lineNumbers: number[] = [];\n annotations.forEach(() => {\n lineNumbers.push(line);\n line++;\n });\n\n return {\n yamlText,\n lineNumbers,\n };\n}\n\nfunction generateDescription(annotations: string[], entityKind = 'Component') {\n const isSingular = annotations.length <= 1;\n return (\n <>\n The {isSingular ? 'annotation' : 'annotations'}{' '}\n {annotations\n .map(ann => <code>{ann}</code>)\n .reduce((prev, curr) => (\n <>\n {prev}, {curr}\n </>\n ))}{' '}\n {isSingular ? 'is' : 'are'} missing. You need to add the{' '}\n {isSingular ? 'annotation' : 'annotations'} to your {entityKind} if you\n want to enable this tool.\n </>\n );\n}\n\n/**\n * @public\n * Renders an empty state when an annotation is missing from an entity.\n */\nexport function MissingAnnotationEmptyState(props: {\n annotation: string | string[];\n readMoreUrl?: string;\n}) {\n let entity: Entity | undefined;\n try {\n const entityContext = useEntity();\n entity = entityContext.entity;\n } catch (err) {\n // ignore when entity context doesnt exist\n }\n\n const { annotation, readMoreUrl } = props;\n const annotations = Array.isArray(annotation) ? annotation : [annotation];\n const url =\n readMoreUrl ||\n 'https://backstage.io/docs/features/software-catalog/well-known-annotations';\n const classes = useStyles();\n\n const entityKind = entity?.kind || 'Component';\n const { yamlText, lineNumbers } = generateYamlExample(annotations, entity);\n return (\n <EmptyState\n missing=\"field\"\n title=\"Missing Annotation\"\n description={generateDescription(annotations, entityKind)}\n action={\n <>\n <Typography variant=\"body1\">\n Add the annotation to your {entityKind} YAML as shown in the\n highlighted example below:\n </Typography>\n <Box className={classes.code}>\n <CodeSnippet\n text={yamlText}\n language=\"yaml\"\n showLineNumbers\n highlightedNumbers={lineNumbers}\n customStyle={{ background: 'inherit', fontSize: '115%' }}\n />\n </Box>\n <Button color=\"primary\" component={Link} to={url}>\n Read more\n </Button>\n </>\n }\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 React, { PropsWithChildren } from 'react';\nimport { Route, Routes, useRoutes } from 'react-router-dom';\n\nimport { Entity } from '@backstage/catalog-model';\nimport { EntityPageDocs } from './EntityPageDocs';\nimport { TechDocsIndexPage } from './home/components/TechDocsIndexPage';\nimport { TechDocsReaderPage } from './reader/components/TechDocsReaderPage';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\n\nconst TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref';\n\nconst TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity';\n\n/**\n * Helper that takes in entity and returns true/false if TechDocs is available for the entity\n *\n * @public\n */\nexport const isTechDocsAvailable = (entity: Entity) =>\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_ANNOTATION]) ||\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]);\n\n/**\n * Responsible for registering routes for TechDocs, TechDocs Homepage and separate TechDocs page\n *\n * @public\n */\nexport const Router = () => {\n return (\n <Routes>\n <Route path=\"/\" element={<TechDocsIndexPage />} />\n <Route\n path=\"/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n />\n </Routes>\n );\n};\n\n/**\n * Responsible for registering route to view docs on Entity page\n *\n * @public\n */\nexport const EmbeddedDocsRouter = (props: PropsWithChildren<{}>) => {\n const { children } = props;\n const { entity } = useEntity();\n\n // Using objects instead of <Route> elements, otherwise \"outlet\" will be null on sub-pages and add-ons won't render\n const element = useRoutes([\n {\n path: '/*',\n element: <EntityPageDocs entity={entity} />,\n children: [\n {\n path: '*',\n element: children,\n },\n ],\n },\n ]);\n\n const projectId =\n entity.metadata.annotations?.[TECHDOCS_ANNOTATION] ||\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION];\n\n if (!projectId) {\n return <MissingAnnotationEmptyState annotation={[TECHDOCS_ANNOTATION]} />;\n }\n\n return element;\n};\n","/*\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-dom';\nimport { TableColumn, TableProps } from '@backstage/core-components';\nimport { UserListFilterKind } from '@backstage/plugin-catalog-react';\nimport { DefaultTechDocsHome } from './DefaultTechDocsHome';\nimport { DocsTableRow } from './Tables';\n\n/**\n * Props for {@link TechDocsIndexPage}\n *\n * @public\n */\nexport type TechDocsIndexPageProps = {\n initialFilter?: UserListFilterKind;\n columns?: TableColumn<DocsTableRow>[];\n actions?: TableProps<DocsTableRow>['actions'];\n};\n\nexport const TechDocsIndexPage = (props: TechDocsIndexPageProps) => {\n const outlet = useOutlet();\n\n return outlet || <DefaultTechDocsHome {...props} />;\n};\n","import { useMemo, useRef, useState } from 'react';\nimport { useSyncedRef } from '../useSyncedRef/index.js';\nexport function useAsync(asyncFn, initialValue) {\n const [state, setState] = useState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n const promiseRef = useRef();\n const argsRef = useRef();\n const methods = useSyncedRef({\n execute(...params) {\n argsRef.current = params;\n const promise = asyncFn(...params);\n promiseRef.current = promise;\n setState((s) => ({ ...s, status: 'loading' }));\n promise.then((result) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'success', error: undefined, result }));\n }\n }, (error) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'error', error }));\n }\n });\n return promise;\n },\n reset() {\n setState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n promiseRef.current = undefined;\n argsRef.current = undefined;\n },\n });\n return [\n state,\n useMemo(() => ({\n reset() {\n methods.current.reset();\n },\n execute: (...params) => methods.current.execute(...params),\n }), []),\n { promise: promiseRef.current, lastArgs: argsRef.current },\n ];\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useCallback, useMemo } from 'react';\nimport {\n discoveryApiRef,\n fetchApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsync, useMountEffect } from '@react-hookz/web';\nimport { ResponseError } from '@backstage/errors';\n\nconst COOKIE_PATH = '/.backstage/auth/v1/cookie';\n\n/**\n * @public\n * A hook that will refresh the cookie when it is about to expire.\n * @param options - Options for configuring the refresh cookie endpoint\n */\nexport function useCookieAuthRefresh(options: {\n // The plugin id used for discovering the API origin\n pluginId: string;\n}):\n | { status: 'loading' }\n | { status: 'error'; error: Error; retry: () => void }\n | { status: 'success'; data: { expiresAt: string } } {\n const { pluginId } = options ?? {};\n const fetchApi = useApi(fetchApiRef);\n const discoveryApi = useApi(discoveryApiRef);\n\n const channel = useMemo(() => {\n return 'BroadcastChannel' in window\n ? new BroadcastChannel(`${pluginId}-auth-cookie-expires-at`)\n : null;\n }, [pluginId]);\n\n const [state, actions] = useAsync<{ expiresAt: string }>(async () => {\n const apiOrigin = await discoveryApi.getBaseUrl(pluginId);\n const requestUrl = `${apiOrigin}${COOKIE_PATH}`;\n const response = await fetchApi.fetch(`${requestUrl}`, {\n credentials: 'include',\n });\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n const data = await response.json();\n if (!data.expiresAt) {\n throw new Error('No expiration date found in response');\n }\n return data;\n });\n\n useMountEffect(actions.execute);\n\n const retry = useCallback(() => {\n actions.execute();\n }, [actions]);\n\n const refresh = useCallback(\n (params: { expiresAt: string }) => {\n // Randomize the refreshing margin with a margin of 1-4 minutes to avoid all tabs refreshing at the same time\n // It cannot be less than 5 minutes otherwise the backend will return the same expiration date\n const margin = (1 + 3 * Math.random()) * 60000;\n const delay = Date.parse(params.expiresAt) - Date.now() - margin;\n const timeout = setTimeout(retry, delay);\n return () => clearTimeout(timeout);\n },\n [retry],\n );\n\n useEffect(() => {\n // Only schedule a refresh if we have a successful response\n if (state.status !== 'success' || !state.result) {\n return () => {};\n }\n channel?.postMessage({\n action: 'COOKIE_REFRESH_SUCCESS',\n payload: state.result,\n });\n let cancel = refresh(state.result);\n const listener = (\n event: MessageEvent<{ action: string; payload: { expiresAt: string } }>,\n ) => {\n const { action, payload } = event.data;\n if (action === 'COOKIE_REFRESH_SUCCESS') {\n cancel();\n cancel = refresh(payload);\n }\n };\n channel?.addEventListener('message', listener);\n return () => {\n cancel();\n channel?.removeEventListener('message', listener);\n };\n }, [state, refresh, channel]);\n\n // Initialising\n if (state.status === 'not-executed') {\n return { status: 'loading' };\n }\n\n // First refresh or retrying without any success before\n // Possible state transitions:\n // e.g. not-executed -> loading (first-refresh)\n // e.g. not-executed -> loading (first-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && !state.result) {\n return { status: 'loading' };\n }\n\n // Retrying after having succeeding at least once\n // Current state is: { status: 'loading', result: {...}, error: undefined | Error }\n // e.g. not-executed -> loading (first-refresh) -> success -> loading (scheduled-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && state.error) {\n return { status: 'loading' };\n }\n\n // Something went wrong during any situation of a refresh\n if (state.status === 'error' && state.error) {\n return { status: 'error', error: state.error, retry };\n }\n\n // At this point it should be safe to assume that we have a successful refresh\n return { status: 'success', data: state.result! };\n}\n","/*\n * Copyright 2024 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, { ReactNode } from 'react';\nimport { ErrorPanel } from '@backstage/core-components';\nimport { useApp } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport { useCookieAuthRefresh } from '../../hooks';\n\n/**\n * @public\n * Props for the {@link CookieAuthRefreshProvider} component.\n */\nexport type CookieAuthRefreshProviderProps = {\n // The plugin ID used for discovering the API origin\n pluginId: string;\n // The children to render when the refresh is successful\n children: ReactNode;\n};\n\n/**\n * @public\n * A provider that will refresh the cookie when it is about to expire.\n */\nexport function CookieAuthRefreshProvider(\n props: CookieAuthRefreshProviderProps,\n): JSX.Element {\n const { children, ...options } = props;\n const app = useApp();\n const { Progress } = app.getComponents();\n\n const result = useCookieAuthRefresh(options);\n\n if (result.status === 'loading') {\n return <Progress />;\n }\n\n if (result.status === 'error') {\n return (\n <ErrorPanel error={result.error}>\n <Button variant=\"outlined\" onClick={result.retry}>\n Retry\n </Button>\n </ErrorPanel>\n );\n }\n\n return <>{children}</>;\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode, Children, ReactElement } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nimport { Page } from '@backstage/core-components';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport {\n TECHDOCS_ADDONS_WRAPPER_KEY,\n TECHDOCS_ADDONS_KEY,\n TechDocsReaderPageProvider,\n} from '@backstage/plugin-techdocs-react';\n\nimport { TechDocsReaderPageRenderFunction } from '../../../types';\n\nimport { TechDocsReaderPageContent } from '../TechDocsReaderPageContent';\nimport { TechDocsReaderPageHeader } from '../TechDocsReaderPageHeader';\nimport { TechDocsReaderPageSubheader } from '../TechDocsReaderPageSubheader';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n getComponentData,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\n\nimport { CookieAuthRefreshProvider } from '@backstage/plugin-auth-react';\n\n/* An explanation for the multiple ways of customizing the TechDocs reader page\n\nPlease refer to this page on the microsite for the latest recommended approach:\nhttps://backstage.io/docs/features/techdocs/how-to-guides#how-to-customize-the-techdocs-reader-page\n\nThe <TechDocsReaderPage> component is responsible for rendering the <TechDocsReaderPageProvider> and\nits contained version of a <Page>, which in turn renders the <TechDocsReaderPageContent>.\n\nHistorically, there have been different approaches on how this <Page> can be customized, and how the\n<TechDocsReaderPageContent> inside could be exchanged for a custom implementation (which was not\npossible before). Also, the current implementation supports every scenario to avoid breaking default\nconfigurations of TechDocs.\n\nIn particular, there are 4 different TechDocs page configurations:\n\nCONFIGURATION 1: <TechDocsReaderPage> only, no children\n\n<Route path=\"/docs/:namespace/:kind/:name/*\" element={<TechDocsReaderPage />} >\n\nThis is the simplest way to use TechDocs. Only a full page is passed, assuming that it comes with\nits content inside. Since we allowed customizing it, we started providing <TechDocsReaderLayout> as\na default implementation (which contains <TechDocsReaderPageContent>).\n\nCONFIGURATION 2 (not advised): <TechDocsReaderPage> with element children\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {techdocsPage}\n </TechDocsReaderPage>\n }\n/>\n\nPreviously, there were two ways of passing children to <TechDocsReaderPage>: either as elements (as\nshown above), or as a render function (described below in CONFIGURATION 3). The \"techdocsPage\" is\nlocated in packages/app/src/components/techdocs and is the default implementation of the content\ninside.\n\nCONFIGURATION 3 (not advised): <TechDocsReaderPage> with render function as child\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {({ metadata, entityMetadata, onReady }) => (\n techdocsPage\n )}\n </TechDocsReaderPage>\n }\n/>\n\nSimilar to CONFIGURATION 2, the direct children will be passed to the <TechDocsReaderPage> but in\nthis case interpreted as render prop.\n\nCONFIGURATION 4: <TechDocsReaderPage> and provided content in <Route>\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n>\n {techDocsPage}\n <TechDocsAddons>\n <ExpandableNavigation />\n <ReportIssue />\n <TextSize />\n <LightBox />\n </TechDocsAddons>\n</Route>\n\nThis is the current state in packages/app/src/App.tsx and moved the location of children from inside\nthe element prop in the <Route> to the children of the <Route>. Then, in <TechDocsReaderPage> they\nare retrieved using the useOutlet hook from React Router.\n\nNOTE: Render functions are no longer supported in this approach.\n*/\n\n/**\n * Props for {@link TechDocsReaderLayout}\n * @public\n */\nexport type TechDocsReaderLayoutProps = {\n /**\n * Show or hide the header, defaults to true.\n */\n withHeader?: boolean;\n /**\n * Show or hide the content search bar, defaults to true.\n */\n withSearch?: boolean;\n};\n\n/**\n * Default TechDocs reader page structure composed with a header and content\n * @public\n */\nexport const TechDocsReaderLayout = (props: TechDocsReaderLayoutProps) => {\n const { withSearch, withHeader = true } = props;\n return (\n <Page themeId=\"documentation\">\n {withHeader && <TechDocsReaderPageHeader />}\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={withSearch} />\n </Page>\n );\n};\n\n/**\n * @public\n */\nexport type TechDocsReaderPageProps = {\n entityRef?: CompoundEntityRef;\n children?: TechDocsReaderPageRenderFunction | ReactNode;\n};\n\n/**\n * An addon-aware implementation of the TechDocsReaderPage.\n *\n * @public\n */\nexport const TechDocsReaderPage = (props: TechDocsReaderPageProps) => {\n const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);\n const { children, entityRef = { kind, name, namespace } } = props;\n\n const outlet = useOutlet();\n\n if (!children) {\n const childrenList = outlet ? Children.toArray(outlet.props.children) : [];\n\n const grandChildren = childrenList.flatMap<ReactElement>(\n child => (child as ReactElement)?.props?.children ?? [],\n );\n\n const page: React.ReactNode = grandChildren.find(\n grandChild =>\n !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) &&\n !getComponentData(grandChild, TECHDOCS_ADDONS_KEY),\n );\n\n // As explained above, \"page\" is configuration 4 and <TechDocsReaderLayout> is 1\n return (\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {(page as JSX.Element) || <TechDocsReaderLayout />}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n );\n }\n\n // As explained above, a render function is configuration 3 and React element is 2\n return (\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {({ metadata, entityMetadata, onReady }) => (\n <div className=\"techdocs-reader-page\">\n <Page themeId=\"documentation\">\n {children instanceof Function\n ? children({\n entityRef,\n techdocsMetadataValue: metadata.value,\n entityMetadataValue: entityMetadata.value,\n onReady,\n })\n : children}\n </Page>\n </div>\n )}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { MouseEvent, useState, useCallback } from 'react';\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport { ToolbarProps } from '@material-ui/core/Toolbar';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Menu from '@material-ui/core/Menu';\nimport Box from '@material-ui/core/Box';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport {\n TechDocsAddonLocations as locations,\n useTechDocsAddons,\n useTechDocsReaderPage,\n} from '@backstage/plugin-techdocs-react';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageSubheader',\n flexDirection: 'column',\n minHeight: 'auto',\n padding: theme.spacing(3, 3, 0),\n '@media print': {\n display: 'none',\n },\n },\n}));\n\n/**\n * Renders the reader page subheader.\n * Please use the Tech Docs add-ons to customize it\n * @public\n */\nexport const TechDocsReaderPageSubheader = (props: {\n toolbarProps?: ToolbarProps;\n}) => {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const handleClose = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n const {\n entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },\n } = useTechDocsReaderPage();\n\n const addons = useTechDocsAddons();\n\n const subheaderAddons = addons.renderComponentsByLocation(\n locations.Subheader,\n );\n\n const settingsAddons = addons.renderComponentsByLocation(locations.Settings);\n\n if (!subheaderAddons && !settingsAddons) return null;\n\n // No entity metadata = 404. Don't render subheader on 404.\n if (entityMetadataLoading === false && !entityMetadata) return null;\n\n return (\n <Toolbar classes={classes} {...props.toolbarProps}>\n <Box\n display=\"flex\"\n justifyContent=\"flex-end\"\n width=\"100%\"\n flexWrap=\"wrap\"\n >\n {subheaderAddons}\n {settingsAddons ? (\n <>\n <Tooltip title=\"Settings\">\n <IconButton\n aria-controls=\"tech-docs-reader-page-settings\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n >\n <SettingsIcon />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"tech-docs-reader-page-settings\"\n getContentAnchorEl={null}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n open={Boolean(anchorEl)}\n onClose={handleClose}\n keepMounted\n >\n <div>{settingsAddons}</div>\n </Menu>\n </>\n ) : null}\n </Box>\n </Toolbar>\n );\n};\n"],"names":["useRouteRefParams","_routeRef","useParams","NewEntityContext","createVersionedContext","AsyncEntityProvider","props","children","entity","loading","error","refresh","value","Provider","createVersionedValueMap","AnalyticsContext","attributes","entityRef","stringifyEntityRef","undefined","EntityProvider","useEntity","versionedHolder","useVersionedContext","Error","atVersion","useAsyncEntity","TECHDOCS_EXTERNAL_ANNOTATION","EntityPageDocs","getCompoundEntityRef","metadata","annotations","parseEntityRef","TechDocsReaderPage","TechDocsReaderPageSubheader","TechDocsReaderPageContent","withSearch","useStyles","makeStyles","theme","code","borderRadius","margin","spacing","background","palette","type","common","white","name","generateYamlExample","kind","spec","owner","yamlText","map","ann","join","line","lineNumbers","forEach","push","generateDescription","entityKind","isSingular","length","reduce","prev","curr","MissingAnnotationEmptyState","annotation","readMoreUrl","Array","isArray","url","classes","EmptyState","missing","title","description","action","Typography","variant","Box","className","CodeSnippet","text","language","showLineNumbers","highlightedNumbers","customStyle","fontSize","Button","color","component","Link","to","TECHDOCS_ANNOTATION","isTechDocsAvailable","Boolean","Router","Routes","Route","path","element","TechDocsIndexPage","EmbeddedDocsRouter","useRoutes","useOutlet","DefaultTechDocsHome","useAsync","asyncFn","initialValue","state","setState","promiseRef","argsRef","methods","useSyncedRef","params","promise","s","result","COOKIE_PATH","useCookieAuthRefresh","options","pluginId","fetchApi","useApi","fetchApiRef","discoveryApi","discoveryApiRef","channel","useMemo","window","BroadcastChannel","actions","requestUrl","getBaseUrl","response","fetch","credentials","ok","ResponseError","fromResponse","data","json","expiresAt","useMountEffect","execute","retry","useCallback","Math","random","delay","Date","parse","now","timeout","setTimeout","clearTimeout","useEffect","status","postMessage","payload","cancel","listener","event","addEventListener","removeEventListener","CookieAuthRefreshProvider","app","useApp","Progress","getComponents","ErrorPanel","onClick","TechDocsReaderLayout","withHeader","Page","themeId","TechDocsReaderPageHeader","namespace","rootDocsRouteRef","outlet","page","Children","toArray","flatMap","child","find","grandChild","getComponentData","TECHDOCS_ADDONS_WRAPPER_KEY","TECHDOCS_ADDONS_KEY","TechDocsReaderPageProvider","entityMetadata","onReady","div","Function","techdocsMetadataValue","entityMetadataValue","root","gridArea","flexDirection","minHeight","padding","display","anchorEl","setAnchorEl","useState","handleClick","currentTarget","handleClose","entityMetadataLoading","useTechDocsReaderPage","addons","useTechDocsAddons","subheaderAddons","renderComponentsByLocation","locations","Subheader","settingsAddons","Settings","Toolbar","toolbarProps","justifyContent","width","flexWrap","Tooltip","IconButton","aria-controls","aria-haspopup","SettingsIcon","Menu","id","getContentAnchorEl","anchorOrigin","vertical","horizontal","open","onClose","keepMounted"],"sourceRoot":""}
|