@techdocs/cli 1.7.0 → 1.8.0-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.
Files changed (72) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/{generate-5fb2bc8c.cjs.js → generate-f9a039d6.cjs.js} +3 -2
  3. package/dist/cjs/{generate-5fb2bc8c.cjs.js.map → generate-f9a039d6.cjs.js.map} +1 -1
  4. package/dist/embedded-app/.config-schema.json +773 -224
  5. package/dist/embedded-app/index.html +1 -1
  6. package/dist/embedded-app/static/{1032.88fa9fda.chunk.js → 1032.8ff1a4ae.chunk.js} +2 -2
  7. package/dist/embedded-app/static/{1032.88fa9fda.chunk.js.map → 1032.8ff1a4ae.chunk.js.map} +1 -1
  8. package/dist/embedded-app/static/{1105.2ef0665c.chunk.js → 1105.cdd66625.chunk.js} +2 -2
  9. package/dist/embedded-app/static/{1105.2ef0665c.chunk.js.map → 1105.cdd66625.chunk.js.map} +1 -1
  10. package/dist/embedded-app/static/{184.8fc549e9.chunk.js → 184.c5591ae8.chunk.js} +2 -2
  11. package/dist/embedded-app/static/{184.8fc549e9.chunk.js.map → 184.c5591ae8.chunk.js.map} +1 -1
  12. package/dist/embedded-app/static/{2440.2451b337.chunk.js → 2440.f1360e66.chunk.js} +2 -2
  13. package/dist/embedded-app/static/{2440.2451b337.chunk.js.map → 2440.f1360e66.chunk.js.map} +1 -1
  14. package/dist/embedded-app/static/{3487.1c93df49.chunk.js → 3487.8e09c79a.chunk.js} +2 -2
  15. package/dist/embedded-app/static/{3487.1c93df49.chunk.js.map → 3487.8e09c79a.chunk.js.map} +1 -1
  16. package/dist/embedded-app/static/{3510.6d8cb98c.chunk.js → 3510.3082d0d9.chunk.js} +1 -1
  17. package/dist/embedded-app/static/{3510.6d8cb98c.chunk.js.map → 3510.3082d0d9.chunk.js.map} +1 -1
  18. package/dist/embedded-app/static/{4109.6335d16f.chunk.js → 4109.703c7257.chunk.js} +1 -1
  19. package/dist/embedded-app/static/4109.703c7257.chunk.js.map +1 -0
  20. package/dist/embedded-app/static/{5458.abed4572.chunk.js → 5458.8860bd67.chunk.js} +2 -2
  21. package/dist/embedded-app/static/{5458.abed4572.chunk.js.map → 5458.8860bd67.chunk.js.map} +1 -1
  22. package/dist/embedded-app/static/{5877.c521a57f.chunk.js → 5877.a7d3fb6d.chunk.js} +2 -2
  23. package/dist/embedded-app/static/5877.a7d3fb6d.chunk.js.map +1 -0
  24. package/dist/embedded-app/static/{5914.633b2934.chunk.js → 5914.1a3da6a4.chunk.js} +1 -1
  25. package/dist/embedded-app/static/{5914.633b2934.chunk.js.map → 5914.1a3da6a4.chunk.js.map} +1 -1
  26. package/dist/embedded-app/static/{6051.9eefea24.chunk.js → 6051.b5d6107a.chunk.js} +1 -1
  27. package/dist/embedded-app/static/{6051.9eefea24.chunk.js.map → 6051.b5d6107a.chunk.js.map} +1 -1
  28. package/dist/embedded-app/static/{7750.cb06dc85.chunk.js → 7750.80c8867a.chunk.js} +1 -1
  29. package/dist/embedded-app/static/7750.80c8867a.chunk.js.map +1 -0
  30. package/dist/embedded-app/static/{8096.752da27d.chunk.js → 8096.c58c75a0.chunk.js} +1 -1
  31. package/dist/embedded-app/static/8096.c58c75a0.chunk.js.map +1 -0
  32. package/dist/embedded-app/static/{8662.7243a5c6.chunk.js → 8662.f83727a2.chunk.js} +1 -1
  33. package/dist/embedded-app/static/{8662.7243a5c6.chunk.js.map → 8662.f83727a2.chunk.js.map} +1 -1
  34. package/dist/embedded-app/static/{8951.6ae94626.chunk.js → 8951.1fe70f2a.chunk.js} +1 -1
  35. package/dist/embedded-app/static/{8951.6ae94626.chunk.js.map → 8951.1fe70f2a.chunk.js.map} +1 -1
  36. package/dist/embedded-app/static/{9545.8e4a2868.chunk.js → 9545.d08cf7be.chunk.js} +2 -2
  37. package/dist/embedded-app/static/9545.d08cf7be.chunk.js.map +1 -0
  38. package/dist/embedded-app/static/{9770.2d75fe33.chunk.js → 9770.733a2bbb.chunk.js} +2 -2
  39. package/dist/embedded-app/static/{9770.2d75fe33.chunk.js.map → 9770.733a2bbb.chunk.js.map} +1 -1
  40. package/dist/embedded-app/static/9814.d48dafd2.chunk.js +3 -0
  41. package/dist/embedded-app/static/9814.d48dafd2.chunk.js.map +1 -0
  42. package/dist/embedded-app/static/main.2b22ee03.js +487 -0
  43. package/dist/embedded-app/static/main.2b22ee03.js.map +1 -0
  44. package/dist/embedded-app/static/{module-material-ui.263ce9b5.js → module-material-ui.0420d68d.js} +2 -2
  45. package/dist/embedded-app/static/{module-material-ui.263ce9b5.js.map → module-material-ui.0420d68d.js.map} +1 -1
  46. package/dist/embedded-app/static/module-react-router-dom.48ea1f60.js +22 -0
  47. package/dist/embedded-app/static/module-react-router-dom.48ea1f60.js.map +1 -0
  48. package/dist/embedded-app/static/module-react-router.67245b2c.js +22 -0
  49. package/dist/embedded-app/static/module-react-router.67245b2c.js.map +1 -0
  50. package/dist/embedded-app/static/{runtime.6ea4af3c.js → runtime.2b22ee03.js} +3 -3
  51. package/dist/embedded-app/static/runtime.2b22ee03.js.map +1 -0
  52. package/dist/embedded-app/static/vendor.2b22ee03.js +159 -0
  53. package/dist/embedded-app/static/vendor.2b22ee03.js.map +1 -0
  54. package/dist/index.cjs.js +6 -2
  55. package/dist/index.cjs.js.map +1 -1
  56. package/package.json +4 -4
  57. package/dist/embedded-app/static/1600.ec5e759e.chunk.js +0 -3
  58. package/dist/embedded-app/static/1600.ec5e759e.chunk.js.map +0 -1
  59. package/dist/embedded-app/static/4109.6335d16f.chunk.js.map +0 -1
  60. package/dist/embedded-app/static/5877.c521a57f.chunk.js.map +0 -1
  61. package/dist/embedded-app/static/7750.cb06dc85.chunk.js.map +0 -1
  62. package/dist/embedded-app/static/8096.752da27d.chunk.js.map +0 -1
  63. package/dist/embedded-app/static/9545.8e4a2868.chunk.js.map +0 -1
  64. package/dist/embedded-app/static/main.6ea4af3c.js +0 -487
  65. package/dist/embedded-app/static/main.6ea4af3c.js.map +0 -1
  66. package/dist/embedded-app/static/module-react-router-dom.9e5a6865.js +0 -22
  67. package/dist/embedded-app/static/module-react-router-dom.9e5a6865.js.map +0 -1
  68. package/dist/embedded-app/static/module-react-router.d96a5b36.js +0 -22
  69. package/dist/embedded-app/static/module-react-router.d96a5b36.js.map +0 -1
  70. package/dist/embedded-app/static/runtime.6ea4af3c.js.map +0 -1
  71. package/dist/embedded-app/static/vendor.6ea4af3c.js +0 -207
  72. package/dist/embedded-app/static/vendor.6ea4af3c.js.map +0 -1
package/dist/index.cjs.js CHANGED
@@ -43,7 +43,11 @@ function registerCommands(program) {
43
43
  "--defaultPlugin [defaultPlugins...]",
44
44
  "Plugins which should be added automatically to the mkdocs.yaml file",
45
45
  []
46
- ).alias("build").action(lazy(() => Promise.resolve().then(function () { return require('./cjs/generate-5fb2bc8c.cjs.js'); }).then((m) => m.default)));
46
+ ).option(
47
+ "--runAsDefaultUser",
48
+ "Bypass setting the container user as the same user and group id as host for Linux and MacOS",
49
+ false
50
+ ).alias("build").action(lazy(() => Promise.resolve().then(function () { return require('./cjs/generate-f9a039d6.cjs.js'); }).then((m) => m.default)));
47
51
  program.command("migrate").description(
48
52
  "Migrate objects with case-sensitive entity triplets to lower-case versions."
49
53
  ).requiredOption(
@@ -212,7 +216,7 @@ function lazy(getActionFunc) {
212
216
  };
213
217
  }
214
218
 
215
- var version = "1.7.0";
219
+ var version = "1.8.0-next.0";
216
220
 
217
221
  const main = (argv) => {
218
222
  commander.program.name("techdocs-cli").version(version);
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/commands/index.ts","../src/index.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 { Command } from 'commander';\nimport { TechdocsGenerator } from '@backstage/plugin-techdocs-node';\n\nconst defaultDockerImage = TechdocsGenerator.defaultDockerImage;\nconst defaultPreviewAppPort = '3000';\n\nexport function registerCommands(program: Command) {\n program\n .command('generate')\n .description('Generate TechDocs documentation site using MkDocs.')\n .option(\n '--source-dir <PATH>',\n 'Source directory containing mkdocs.yml and docs/ directory.',\n '.',\n )\n .option(\n '--output-dir <PATH>',\n 'Output directory containing generated TechDocs site.',\n './site/',\n )\n .option(\n '--docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option('--no-pull', 'Do not pull the latest docker image')\n .option(\n '--no-docker',\n 'Do not use Docker, use MkDocs executable and plugins in current user environment.',\n )\n .option(\n '--techdocs-ref <HOST_TYPE:URL>',\n 'The repository hosting documentation source files e.g. url:https://ghe.mycompany.net.com/org/repo.' +\n '\\nThis value is same as the backstage.io/techdocs-ref annotation of the corresponding Backstage entity.' +\n '\\nIt is completely fine to skip this as it is only being used to set repo_url in mkdocs.yml if not found.\\n',\n )\n .option(\n '--etag <ETAG>',\n 'A unique identifier for the prepared tree e.g. commit SHA. If provided it will be stored in techdocs_metadata.json.',\n )\n .option(\n '--site-name',\n 'Name for site when using default MkDocs config',\n 'Documentation Site',\n )\n .option('-v --verbose', 'Enable verbose output.', false)\n .option(\n '--omitTechdocsCoreMkdocsPlugin',\n \"Don't patch MkDocs file automatically with techdocs-core plugin.\",\n false,\n )\n .option(\n '--legacyCopyReadmeMdToIndexMd',\n 'Attempt to ensure an index.md exists falling back to using <docs-dir>/README.md or README.md in case a default <docs-dir>/index.md is not provided.',\n false,\n )\n .option(\n '--defaultPlugin [defaultPlugins...]',\n 'Plugins which should be added automatically to the mkdocs.yaml file',\n [],\n )\n .alias('build')\n .action(lazy(() => import('./generate/generate').then(m => m.default)));\n\n program\n .command('migrate')\n .description(\n 'Migrate objects with case-sensitive entity triplets to lower-case versions.',\n )\n .requiredOption(\n '--publisher-type <TYPE>',\n '(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml',\n )\n .requiredOption(\n '--storage-name <BUCKET/CONTAINER NAME>',\n '(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName',\n )\n .option(\n '--azureAccountName <AZURE ACCOUNT NAME>',\n '(Required for Azure) specify when --publisher-type azureBlobStorage',\n )\n .option(\n '--azureAccountKey <AZURE ACCOUNT KEY>',\n 'Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.',\n )\n .option(\n '--awsRoleArn <AWS ROLE ARN>',\n 'Optional AWS ARN of role to be assumed.',\n )\n .option(\n '--awsEndpoint <AWS ENDPOINT>',\n 'Optional AWS endpoint to send requests to.',\n )\n .option(\n '--awsS3ForcePathStyle',\n 'Optional AWS S3 option to force path style.',\n )\n .option(\n '--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osAuthUrl <OPENSTACK SWIFT AUTHURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--removeOriginal',\n 'Optional Files are copied by default. If flag is set, files are renamed/moved instead.',\n false,\n )\n .option(\n '--concurrency <MAX CONCURRENT REQS>',\n 'Optional Controls the number of API requests allowed to be performed simultaneously.',\n '25',\n )\n .option('-v --verbose', 'Enable verbose output.', false)\n .action(lazy(() => import('./migrate/migrate').then(m => m.default)));\n\n program\n .command('publish')\n .description(\n 'Publish generated TechDocs site to an external storage AWS S3, Google GCS, etc.',\n )\n .requiredOption(\n '--publisher-type <TYPE>',\n '(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml',\n )\n .requiredOption(\n '--storage-name <BUCKET/CONTAINER NAME>',\n '(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName',\n )\n .requiredOption(\n '--entity <NAMESPACE/KIND/NAME>',\n '(Required always) Entity uid separated by / in namespace/kind/name order (case-sensitive). Example: default/Component/myEntity ',\n )\n .option(\n '--legacyUseCaseSensitiveTripletPaths',\n 'Publishes objects with cased entity triplet prefix when set (e.g. namespace/Kind/name). Only use if your TechDocs backend is configured the same way.',\n false,\n )\n .option(\n '--azureAccountName <AZURE ACCOUNT NAME>',\n '(Required for Azure) specify when --publisher-type azureBlobStorage',\n )\n .option(\n '--azureAccountKey <AZURE ACCOUNT KEY>',\n 'Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.',\n )\n .option(\n '--awsRoleArn <AWS ROLE ARN>',\n 'Optional AWS ARN of role to be assumed.',\n )\n .option(\n '--awsEndpoint <AWS ENDPOINT>',\n 'Optional AWS endpoint to send requests to.',\n )\n .option(\n '--awsProxy <HTTPS Proxy>',\n 'Optional Proxy to use for AWS requests.',\n )\n .option('--awsS3sse <AWS SSE>', 'Optional AWS S3 Server Side Encryption.')\n .option(\n '--awsS3ForcePathStyle',\n 'Optional AWS S3 option to force path style.',\n )\n .option(\n '--awsBucketRootPath <AWS BUCKET ROOT PATH>',\n 'Optional sub-directory to store files in Amazon S3',\n )\n .option(\n '--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osAuthUrl <OPENSTACK SWIFT AUTHURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--gcsBucketRootPath <GCS BUCKET ROOT PATH>',\n 'Optional sub-directory to store files in Google cloud storage',\n )\n .option(\n '--directory <PATH>',\n 'Path of the directory containing generated files to publish',\n './site/',\n )\n .action(lazy(() => import('./publish/publish').then(m => m.default)));\n\n program\n .command('serve:mkdocs')\n .description('Serve a documentation project locally using MkDocs serve.')\n .option(\n '-i, --docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option(\n '--docker-entrypoint <DOCKER_ENTRYPOINT>',\n 'Override the image entrypoint',\n )\n .option(\n '--docker-option <DOCKER_OPTION...>',\n 'Extra options to pass to the docker run command, e.g. \"--add-host=internal.host:192.168.11.12\" (can be added multiple times).',\n )\n .option(\n '--no-docker',\n 'Do not use Docker, run `mkdocs serve` in current user environment.',\n )\n .option(\n '--site-name',\n 'Name for site when using default MkDocs config',\n 'Documentation Site',\n )\n .option('-p, --port <PORT>', 'Port to serve documentation locally', '8000')\n .option('-v --verbose', 'Enable verbose output.', false)\n .action(lazy(() => import('./serve/mkdocs').then(m => m.default)));\n\n program\n .command('serve')\n .description(\n 'Serve a documentation project locally in a Backstage app-like environment',\n )\n .option(\n '-i, --docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option(\n '--docker-entrypoint <DOCKER_ENTRYPOINT>',\n 'Override the image entrypoint',\n )\n .option(\n '--docker-option <DOCKER_OPTION...>',\n 'Extra options to pass to the docker run command, e.g. \"--add-host=internal.host:192.168.11.12\" (can be added multiple times).',\n )\n .option(\n '--no-docker',\n 'Do not use Docker, use MkDocs executable in current user environment.',\n )\n .option(\n '--site-name',\n 'Name for site when using default MkDocs config',\n 'Documentation Site',\n )\n .option('--mkdocs-port <PORT>', 'Port for MkDocs server to use', '8000')\n .option('-v --verbose', 'Enable verbose output.', false)\n .option(\n '--preview-app-bundle-path <PATH_TO_BUNDLE>',\n 'Preview documentation using another web app',\n )\n .option(\n '--preview-app-port <PORT>',\n 'Port for the preview app to be served on',\n defaultPreviewAppPort,\n )\n .option(\n '-c, --mkdocs-config-file-name <FILENAME>',\n 'Mkdocs config file name',\n )\n .hook('preAction', command => {\n if (\n command.opts().previewAppPort !== defaultPreviewAppPort &&\n !command.opts().previewAppBundlePath\n ) {\n command.error(\n '--preview-app-port can only be used together with --preview-app-bundle-path',\n );\n }\n })\n .action(lazy(() => import('./serve/serve').then(m => m.default)));\n}\n\n// Wraps an action function so that it always exits and handles errors\n// Humbly taken from backstage-cli's registerCommands\nfunction lazy(\n getActionFunc: () => Promise<(...args: any[]) => Promise<void>>,\n): (...args: any[]) => Promise<never> {\n return async (...args: any[]) => {\n try {\n const actionFunc = await getActionFunc();\n await actionFunc(...args);\n process.exit(0);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error.message);\n process.exit(1);\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 { program } from 'commander';\nimport { registerCommands } from './commands';\nimport { version } from '../package.json';\n\nconst main = (argv: string[]) => {\n program.name('techdocs-cli').version(version);\n\n registerCommands(program);\n\n program.parse(argv);\n};\n\nmain(process.argv);\n"],"names":["TechdocsGenerator","program"],"mappings":";;;;;AAmBA,M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OAAA,KAAA;AAC5B,IACE,IAAA,OAAA,CAAQ,MAAO,CAAA,cAAA,KAAmB,yBAClC,CAAC,OAAA,CAAQ,IAAK,EAAA,CAAE,oBAChB,EAAA;AACA,MAAQ,OAAA,CAAA,KAAA;AAAA,QACN,6EAAA;AAAA,OACF,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CACA,MAAO,CAAA,IAAA,CAAK,MAAM,oDAAO,6BAAe,KAAA,CAAE,IAAK,CAAA,CAAA,CAAA,KAAK,CAAE,CAAA,OAAO,CAAC,CAAC,CAAA,CAAA;AACpE,CAAA;AAIA,SAAS,KACP,aACoC,EAAA;AACpC,EAAA,OAAO,UAAU,IAAgB,KAAA;AAC/B,IAAI,IAAA;AACF,MAAM,MAAA,UAAA,GAAa,MAAM,aAAc,EAAA,CAAA;AACvC,MAAM,MAAA,UAAA,CAAW,GAAG,IAAI,CAAA,CAAA;AACxB,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAA;AAAA,aACP,KAAO,EAAA;AAEd,MAAQ,OAAA,CAAA,KAAA,CAAM,MAAM,OAAO,CAAA,CAAA;AAC3B,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAA;AAAA,KAChB;AAAA,GACF,CAAA;AACF;;;;AC5SA,MAAM,IAAA,GAAO,CAAC,IAAmB,KAAA;AAC/B,EAAAC,iBAAA,CAAQ,IAAK,CAAA,cAAc,CAAE,CAAA,OAAA,CAAQ,OAAO,CAAA,CAAA;AAE5C,EAAA,gBAAA,CAAiBA,iBAAO,CAAA,CAAA;AAExB,EAAAA,iBAAA,CAAQ,MAAM,IAAI,CAAA,CAAA;AACpB,CAAA,CAAA;AAEA,IAAA,CAAK,QAAQ,IAAI,CAAA;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/commands/index.ts","../src/index.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 { Command } from 'commander';\nimport { TechdocsGenerator } from '@backstage/plugin-techdocs-node';\n\nconst defaultDockerImage = TechdocsGenerator.defaultDockerImage;\nconst defaultPreviewAppPort = '3000';\n\nexport function registerCommands(program: Command) {\n program\n .command('generate')\n .description('Generate TechDocs documentation site using MkDocs.')\n .option(\n '--source-dir <PATH>',\n 'Source directory containing mkdocs.yml and docs/ directory.',\n '.',\n )\n .option(\n '--output-dir <PATH>',\n 'Output directory containing generated TechDocs site.',\n './site/',\n )\n .option(\n '--docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option('--no-pull', 'Do not pull the latest docker image')\n .option(\n '--no-docker',\n 'Do not use Docker, use MkDocs executable and plugins in current user environment.',\n )\n .option(\n '--techdocs-ref <HOST_TYPE:URL>',\n 'The repository hosting documentation source files e.g. url:https://ghe.mycompany.net.com/org/repo.' +\n '\\nThis value is same as the backstage.io/techdocs-ref annotation of the corresponding Backstage entity.' +\n '\\nIt is completely fine to skip this as it is only being used to set repo_url in mkdocs.yml if not found.\\n',\n )\n .option(\n '--etag <ETAG>',\n 'A unique identifier for the prepared tree e.g. commit SHA. If provided it will be stored in techdocs_metadata.json.',\n )\n .option(\n '--site-name',\n 'Name for site when using default MkDocs config',\n 'Documentation Site',\n )\n .option('-v --verbose', 'Enable verbose output.', false)\n .option(\n '--omitTechdocsCoreMkdocsPlugin',\n \"Don't patch MkDocs file automatically with techdocs-core plugin.\",\n false,\n )\n .option(\n '--legacyCopyReadmeMdToIndexMd',\n 'Attempt to ensure an index.md exists falling back to using <docs-dir>/README.md or README.md in case a default <docs-dir>/index.md is not provided.',\n false,\n )\n .option(\n '--defaultPlugin [defaultPlugins...]',\n 'Plugins which should be added automatically to the mkdocs.yaml file',\n [],\n )\n .option(\n '--runAsDefaultUser',\n 'Bypass setting the container user as the same user and group id as host for Linux and MacOS',\n false,\n )\n .alias('build')\n .action(lazy(() => import('./generate/generate').then(m => m.default)));\n\n program\n .command('migrate')\n .description(\n 'Migrate objects with case-sensitive entity triplets to lower-case versions.',\n )\n .requiredOption(\n '--publisher-type <TYPE>',\n '(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml',\n )\n .requiredOption(\n '--storage-name <BUCKET/CONTAINER NAME>',\n '(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName',\n )\n .option(\n '--azureAccountName <AZURE ACCOUNT NAME>',\n '(Required for Azure) specify when --publisher-type azureBlobStorage',\n )\n .option(\n '--azureAccountKey <AZURE ACCOUNT KEY>',\n 'Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.',\n )\n .option(\n '--awsRoleArn <AWS ROLE ARN>',\n 'Optional AWS ARN of role to be assumed.',\n )\n .option(\n '--awsEndpoint <AWS ENDPOINT>',\n 'Optional AWS endpoint to send requests to.',\n )\n .option(\n '--awsS3ForcePathStyle',\n 'Optional AWS S3 option to force path style.',\n )\n .option(\n '--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osAuthUrl <OPENSTACK SWIFT AUTHURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--removeOriginal',\n 'Optional Files are copied by default. If flag is set, files are renamed/moved instead.',\n false,\n )\n .option(\n '--concurrency <MAX CONCURRENT REQS>',\n 'Optional Controls the number of API requests allowed to be performed simultaneously.',\n '25',\n )\n .option('-v --verbose', 'Enable verbose output.', false)\n .action(lazy(() => import('./migrate/migrate').then(m => m.default)));\n\n program\n .command('publish')\n .description(\n 'Publish generated TechDocs site to an external storage AWS S3, Google GCS, etc.',\n )\n .requiredOption(\n '--publisher-type <TYPE>',\n '(Required always) awsS3 | googleGcs | azureBlobStorage | openStackSwift - same as techdocs.publisher.type in Backstage app-config.yaml',\n )\n .requiredOption(\n '--storage-name <BUCKET/CONTAINER NAME>',\n '(Required always) In case of AWS/GCS, use the bucket name. In case of Azure, use container name. Same as techdocs.publisher.[TYPE].bucketName',\n )\n .requiredOption(\n '--entity <NAMESPACE/KIND/NAME>',\n '(Required always) Entity uid separated by / in namespace/kind/name order (case-sensitive). Example: default/Component/myEntity ',\n )\n .option(\n '--legacyUseCaseSensitiveTripletPaths',\n 'Publishes objects with cased entity triplet prefix when set (e.g. namespace/Kind/name). Only use if your TechDocs backend is configured the same way.',\n false,\n )\n .option(\n '--azureAccountName <AZURE ACCOUNT NAME>',\n '(Required for Azure) specify when --publisher-type azureBlobStorage',\n )\n .option(\n '--azureAccountKey <AZURE ACCOUNT KEY>',\n 'Azure Storage Account key to use for authentication. If not specified, you must set AZURE_TENANT_ID, AZURE_CLIENT_ID & AZURE_CLIENT_SECRET as environment variables.',\n )\n .option(\n '--awsRoleArn <AWS ROLE ARN>',\n 'Optional AWS ARN of role to be assumed.',\n )\n .option(\n '--awsEndpoint <AWS ENDPOINT>',\n 'Optional AWS endpoint to send requests to.',\n )\n .option(\n '--awsProxy <HTTPS Proxy>',\n 'Optional Proxy to use for AWS requests.',\n )\n .option('--awsS3sse <AWS SSE>', 'Optional AWS S3 Server Side Encryption.')\n .option(\n '--awsS3ForcePathStyle',\n 'Optional AWS S3 option to force path style.',\n )\n .option(\n '--awsBucketRootPath <AWS BUCKET ROOT PATH>',\n 'Optional sub-directory to store files in Amazon S3',\n )\n .option(\n '--osCredentialId <OPENSTACK SWIFT APPLICATION CREDENTIAL ID>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSecret <OPENSTACK SWIFT APPLICATION CREDENTIAL SECRET>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osAuthUrl <OPENSTACK SWIFT AUTHURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--osSwiftUrl <OPENSTACK SWIFT SWIFTURL>',\n '(Required for OpenStack) specify when --publisher-type openStackSwift',\n )\n .option(\n '--gcsBucketRootPath <GCS BUCKET ROOT PATH>',\n 'Optional sub-directory to store files in Google cloud storage',\n )\n .option(\n '--directory <PATH>',\n 'Path of the directory containing generated files to publish',\n './site/',\n )\n .action(lazy(() => import('./publish/publish').then(m => m.default)));\n\n program\n .command('serve:mkdocs')\n .description('Serve a documentation project locally using MkDocs serve.')\n .option(\n '-i, --docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option(\n '--docker-entrypoint <DOCKER_ENTRYPOINT>',\n 'Override the image entrypoint',\n )\n .option(\n '--docker-option <DOCKER_OPTION...>',\n 'Extra options to pass to the docker run command, e.g. \"--add-host=internal.host:192.168.11.12\" (can be added multiple times).',\n )\n .option(\n '--no-docker',\n 'Do not use Docker, run `mkdocs serve` in current user environment.',\n )\n .option(\n '--site-name',\n 'Name for site when using default MkDocs config',\n 'Documentation Site',\n )\n .option('-p, --port <PORT>', 'Port to serve documentation locally', '8000')\n .option('-v --verbose', 'Enable verbose output.', false)\n .action(lazy(() => import('./serve/mkdocs').then(m => m.default)));\n\n program\n .command('serve')\n .description(\n 'Serve a documentation project locally in a Backstage app-like environment',\n )\n .option(\n '-i, --docker-image <DOCKER_IMAGE>',\n 'The mkdocs docker container to use',\n defaultDockerImage,\n )\n .option(\n '--docker-entrypoint <DOCKER_ENTRYPOINT>',\n 'Override the image entrypoint',\n )\n .option(\n '--docker-option <DOCKER_OPTION...>',\n 'Extra options to pass to the docker run command, e.g. \"--add-host=internal.host:192.168.11.12\" (can be added multiple times).',\n )\n .option(\n '--no-docker',\n 'Do not use Docker, use MkDocs executable in current user environment.',\n )\n .option(\n '--site-name',\n 'Name for site when using default MkDocs config',\n 'Documentation Site',\n )\n .option('--mkdocs-port <PORT>', 'Port for MkDocs server to use', '8000')\n .option('-v --verbose', 'Enable verbose output.', false)\n .option(\n '--preview-app-bundle-path <PATH_TO_BUNDLE>',\n 'Preview documentation using another web app',\n )\n .option(\n '--preview-app-port <PORT>',\n 'Port for the preview app to be served on',\n defaultPreviewAppPort,\n )\n .option(\n '-c, --mkdocs-config-file-name <FILENAME>',\n 'Mkdocs config file name',\n )\n .hook('preAction', command => {\n if (\n command.opts().previewAppPort !== defaultPreviewAppPort &&\n !command.opts().previewAppBundlePath\n ) {\n command.error(\n '--preview-app-port can only be used together with --preview-app-bundle-path',\n );\n }\n })\n .action(lazy(() => import('./serve/serve').then(m => m.default)));\n}\n\n// Wraps an action function so that it always exits and handles errors\n// Humbly taken from backstage-cli's registerCommands\nfunction lazy(\n getActionFunc: () => Promise<(...args: any[]) => Promise<void>>,\n): (...args: any[]) => Promise<never> {\n return async (...args: any[]) => {\n try {\n const actionFunc = await getActionFunc();\n await actionFunc(...args);\n process.exit(0);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error.message);\n process.exit(1);\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 { program } from 'commander';\nimport { registerCommands } from './commands';\nimport { version } from '../package.json';\n\nconst main = (argv: string[]) => {\n program.name('techdocs-cli').version(version);\n\n registerCommands(program);\n\n program.parse(argv);\n};\n\nmain(process.argv);\n"],"names":["TechdocsGenerator","program"],"mappings":";;;;;AAmBA,MAAM,qBAAqBA,oCAAkB,CAAA,kBAAA,CAAA;AAC7C,MAAM,qBAAwB,GAAA,MAAA,CAAA;AAEvB,SAAS,iBAAiB,OAAkB,EAAA;AACjD,EAAA,OAAA,CACG,OAAQ,CAAA,UAAU,CAClB,CAAA,WAAA,CAAY,oDAAoD,CAChE,CAAA,MAAA;AAAA,IACC,qBAAA;AAAA,IACA,6DAAA;AAAA,IACA,GAAA;AAAA,GAED,CAAA,MAAA;AAAA,IACC,qBAAA;AAAA,IACA,sDAAA;AAAA,IACA,SAAA;AAAA,GAED,CAAA,MAAA;AAAA,IACC,+BAAA;AAAA,IACA,oCAAA;AAAA,IACA,kBAAA;AAAA,GAED,CAAA,MAAA,CAAO,WAAa,EAAA,qCAAqC,CACzD,CAAA,MAAA;AAAA,IACC,aAAA;AAAA,IACA,mFAAA;AAAA,GAED,CAAA,MAAA;AAAA,IACC,gCAAA;AAAA,IACA,sTAAA;AAAA,GAID,CAAA,MAAA;AAAA,IACC,eAAA;AAAA,IACA,qHAAA;AAAA,GAED,CAAA,MAAA;AAAA,IACC,aAAA;AAAA,IACA,gDAAA;AAAA,IACA,oBAAA;AAAA,GAED,CAAA,MAAA,CAAO,cAAgB,EAAA,wBAAA,EAA0B,KAAK,CACtD,CAAA,MAAA;AAAA,IACC,gCAAA;AAAA,IACA,kEAAA;AAAA,IACA,KAAA;AAAA,GAED,CAAA,MAAA;AAAA,IACC,+BAAA;AAAA,IACA,qJAAA;AAAA,IACA,KAAA;AAAA,GAED,CAAA,MAAA;AAAA,IACC,qCAAA;AAAA,IACA,qEAAA;AAAA,IACA,EAAC;AAAA,GAEF,CAAA,MAAA;AAAA,IACC,oBAAA;AAAA,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EAAAA,iBAAA,CAAQ,MAAM,IAAI,CAAA,CAAA;AACpB,CAAA,CAAA;AAEA,IAAA,CAAK,QAAQ,IAAI,CAAA;;"}
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.7.0",
4
+ "version": "1.8.0-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.24.0",
38
+ "@backstage/cli": "^0.24.1-next.0",
39
39
  "@types/commander": "^2.12.2",
40
40
  "@types/fs-extra": "^9.0.6",
41
41
  "@types/http-proxy": "^1.17.4",
@@ -57,11 +57,11 @@
57
57
  "ext": "ts"
58
58
  },
59
59
  "dependencies": {
60
- "@backstage/backend-common": "^0.19.9",
60
+ "@backstage/backend-common": "^0.20.0-next.0",
61
61
  "@backstage/catalog-model": "^1.4.3",
62
62
  "@backstage/cli-common": "^0.1.13",
63
63
  "@backstage/config": "^1.1.1",
64
- "@backstage/plugin-techdocs-node": "^1.10.0",
64
+ "@backstage/plugin-techdocs-node": "^1.11.0-next.0",
65
65
  "@types/dockerode": "^3.3.0",
66
66
  "commander": "^9.1.0",
67
67
  "dockerode": "^3.3.1",
@@ -1,3 +0,0 @@
1
- "use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[1600],{59119:function(ft,B,t){t.d(B,{O:function(){return W}});var e=t(52322),v=t(79692),I=t(80030),z=t(2784),U=t(15277),N=t.n(U),$=t(29862);const H=(0,v.Z)({container:{overflow:"visible !important"}},{name:"BackstageOverflowTooltip"});function W(T){const[V,Q]=(0,z.useState)(!1),b=(0,$.t)(),E=H(),G=O=>{b()&&Q(O)};var Z;return(0,e.jsx)(I.ZP,{title:(Z=T.title)!==null&&Z!==void 0?Z:T.text||"",placement:T.placement,disableHoverListener:!V,children:(0,e.jsx)(N(),{text:T.text,line:T.line,onToggled:G,containerClassName:E.container})})}},51600:function(ft,B,t){t.r(B),t.d(B,{BaseCatalogPage:function(){return ct},CatalogPage:function(){return ue},DefaultCatalogPage:function(){return ut}});var e=t(52322),v=t(2784),I=t(73557),z=t(32166),U=t(42398),N=t(30706),$=t(77277),H=t(61837),W=t(41156),T=t(71597),V=t(88188);function Q(n){const{title:l,to:a}=n,s=(0,W.Z)(d=>d.breakpoints.down("xs"));return a?s?(0,e.jsx)(H.Z,{component:T.rU,color:"primary",title:l,size:"small",to:a,children:(0,e.jsx)(V.Z,{})}):(0,e.jsx)($.Z,{component:T.rU,variant:"contained",color:"primary",to:a,children:l}):null}var b=t(13788),E=t(44394),G=t(6542),Z=t(37321),O=t(25942),X=t(30389),q=t(35879),_=t(78847),Y=t(62774),F=t(4967),tt=t(64279),et=t(88624);function pt(){const n=(0,E.h_)(et.A),{error:l,loading:a,value:s}=(0,tt.default)(async()=>await n.getEntityFacets({facets:["kind"]}).then(o=>{var r;return((r=o.facets.kind)===null||r===void 0?void 0:r.map(i=>i.value).sort())||[]}),[n]);return{loading:a,error:l,allKinds:s!=null?s:[]}}function yt(n,l,a){let s=n;return l&&(s=s.filter(o=>l.some(r=>r.toLocaleLowerCase("en-US")===o.toLocaleLowerCase("en-US")))),a&&!n.some(o=>o.toLocaleLowerCase("en-US")===a.toLocaleLowerCase("en-US"))&&(s=s.concat([a])),s.sort().reduce((o,r)=>(o[r.toLocaleLowerCase("en-US")]=r,o),{})}function gt(n){var l;const{filters:a,queryParameters:{kind:s},updateFilters:d}=(0,O.wp)(),o=(0,v.useMemo)(()=>[s].flat()[0],[s]);var r;const[i,c]=(0,v.useState)((r=o!=null?o:(l=a.kind)===null||l===void 0?void 0:l.value)!==null&&r!==void 0?r:n.initialFilter);(0,v.useEffect)(()=>{o&&c(o)},[o]),(0,v.useEffect)(()=>{var P;if(!((P=a.kind)===null||P===void 0)&&P.value){var S;c((S=a.kind)===null||S===void 0?void 0:S.value)}},[a.kind]),(0,v.useEffect)(()=>{d({kind:i?new F.zo(i):void 0})},[i,d]);const{allKinds:u,loading:f,error:h}=pt();return{loading:f,error:h,allKinds:u!=null?u:[],selectedKind:i,setSelectedKind:c}}const ht=n=>{const{allowedKinds:l,hidden:a,initialFilter:s="component"}=n,d=(0,E.h_)(_.$),{error:o,allKinds:r,selectedKind:i,setSelectedKind:c}=gt({initialFilter:s});if((0,v.useEffect)(()=>{o&&d.post({message:"Failed to load entity kinds",severity:"error"})},[o,d]),o)return null;const u=yt(r,l,i),f=Object.keys(u).map(h=>({value:h,label:u[h]}));return a?null:(0,e.jsx)(Y.Z,{pb:1,pt:1,children:(0,e.jsx)(q.H,{label:"Kind",items:f,selected:i.toLocaleLowerCase("en-US"),onChange:h=>c(String(h))})})};var Ct=t(18149),xt=t.n(Ct),St=t(829),jt=t.n(St);function Et(){const n=(0,E.h_)(et.A),{filters:{kind:l,type:a},queryParameters:{type:s},updateFilters:d}=(0,O.wp)(),o=(0,v.useMemo)(()=>[s].flat().filter(Boolean),[s]);var r;const[i,c]=(0,v.useState)(o.length?o:(r=a==null?void 0:a.getTypes())!==null&&r!==void 0?r:[]);(0,v.useEffect)(()=>{o.length&&c(o)},[o]);const[u,f]=(0,v.useState)([]),h=(0,v.useMemo)(()=>l==null?void 0:l.value,[l]),{error:P,loading:S,value:x}=(0,tt.default)(async()=>h?await n.getEntityFacets({filter:{kind:h},facets:["spec.type"]}).then(A=>A.facets["spec.type"]||[]):[],[h,n]),j=(0,v.useRef)(x);return(0,v.useEffect)(()=>{const M=j.current;if(j.current=x,S||!h||M===x||!x)return;const A=[...new Set(jt()(x,L=>-L.count).map(L=>L.value.toLocaleLowerCase("en-US")))];f(A);const K=i.filter(L=>A.includes(L));xt()(i,K)||c(K)},[S,h,i,c,x]),(0,v.useEffect)(()=>{d({type:i.length?new F.Bf(i):void 0})},[i,d]),{loading:S,error:P,availableTypes:u,selectedTypes:i,setSelectedTypes:c}}const Tt=n=>{const{hidden:l,initialFilter:a}=n,s=(0,E.h_)(_.$),{error:d,availableTypes:o,selectedTypes:r,setSelectedTypes:i}=Et();if((0,v.useEffect)(()=>{d&&s.post({message:"Failed to load entity types",severity:"error"}),a&&i([a])},[d,s,a,i]),o.length===0||d)return null;const c=[{value:"all",label:"all"},...o.map(f=>({value:f,label:f}))];var u;return l?null:(0,e.jsx)(Y.Z,{pb:1,pt:1,children:(0,e.jsx)(q.H,{label:"Type",items:c,selected:(u=c.length>1?r[0]:void 0)!==null&&u!==void 0?u:"all",onChange:f=>i(f==="all"?[]:[String(f)])})})};var Pt=t(32494),Ot=t(63833),J=t(79692),nt=t(77605);const Lt=(0,J.Z)({input:{}},{name:"CatalogReactEntityLifecyclePicker"}),Ft=n=>{const{initialFilter:l=[]}=n,a=Lt();return(0,e.jsx)(nt.K,{label:"Lifecycle",name:"lifecycles",path:"spec.lifecycle",Filter:F.zH,InputProps:{className:a.input},initialSelectedOptions:l})};var At=t(97894),D=t(90436),Kt=t(5806),Zt=t(21324),Rt=t(86619),Mt=t(19996),Bt=t(25505),Dt=t(38016),It=t(88013);const zt=(0,J.Z)({input:{}},{name:"CatalogReactEntityProcessingStatusPickerPicker"}),Ut=(0,e.jsx)(Bt.Z,{fontSize:"small"}),Nt=(0,e.jsx)(Mt.Z,{fontSize:"small"}),$t=()=>{const n=zt(),{updateFilters:l}=(0,O.wp)(),[a,s]=(0,v.useState)([]);function d(i){l({orphan:i?new F.mM(i):void 0})}function o(i){l({error:i?new F.A5(i):void 0})}const r=["Is Orphan","Has Error"];return(0,e.jsx)(Y.Z,{pb:1,pt:1,children:(0,e.jsxs)(D.Z,{variant:"button",component:"label",children:["Processing Status",(0,e.jsx)(It.ZP,{multiple:!0,disableCloseOnSelect:!0,options:r,value:a,onChange:(i,c)=>{s(c),d(c.includes("Is Orphan")),o(c.includes("Has Error"))},renderOption:(i,{selected:c})=>(0,e.jsx)(Kt.Z,{control:(0,e.jsx)(Zt.Z,{icon:Ut,checkedIcon:Nt,checked:c}),onClick:u=>u.preventDefault(),label:i}),size:"small",popupIcon:(0,e.jsx)(Dt.Z,{"data-testid":"processing-status-picker-expand"}),renderInput:i=>(0,e.jsx)(Rt.Z,{...i,className:n.input,variant:"outlined"})})]})})},Ht=(0,J.Z)({input:{}},{name:"CatalogReactEntityNamespacePicker"}),Wt=()=>{const n=Ht();return(0,e.jsx)(nt.K,{label:"Namespace",name:"namespace",path:"metadata.namespace",Filter:F.Qe,InputProps:{className:n.input}})};var Vt=t(65524),at=t(34106),lt=t(8709),Qt=t(74314),bt=t(538),Gt=t(9791),Xt=t(84462),R=t(86540),Yt=t(42870),st=t(75435),Jt=t(15459),k=t(93750),kt=t(27604),wt=t(2997),qt=t(11640),_t=t(28347),te=t(76635),ee=t(19928),ne=t.n(ee),ae=t(84719),ot=t(51194),it=t(7089),rt=t(59119);const g=Object.freeze({createNameColumn(n){function l(a){var s;return((s=a.metadata)===null||s===void 0?void 0:s.title)||(0,R.$)(a,{defaultKind:n==null?void 0:n.defaultKind})}return{title:"Name",field:"resolved.entityRef",highlight:!0,customSort({entity:a},{entity:s}){return l(a).localeCompare(l(s))},render:({entity:a})=>(0,e.jsx)(ae.d,{entityRef:a,defaultKind:(n==null?void 0:n.defaultKind)||"Component"})}},createSystemColumn(){return{title:"System",field:"resolved.partOfSystemRelationTitle",render:({resolved:n})=>(0,e.jsx)(ot.r,{entityRefs:n.partOfSystemRelations,defaultKind:"system"})}},createOwnerColumn(){return{title:"Owner",field:"resolved.ownedByRelationsTitle",render:({resolved:n})=>(0,e.jsx)(ot.r,{entityRefs:n.ownedByRelations,defaultKind:"group"})}},createSpecTargetsColumn(){return{title:"Targets",field:"entity.spec.targets",render:({entity:n})=>{var l,a;return(0,e.jsx)(e.Fragment,{children:((n==null||(l=n.spec)===null||l===void 0?void 0:l.targets)||(n==null||(a=n.spec)===null||a===void 0?void 0:a.target))&&(0,e.jsx)(rt.O,{text:(n.spec.targets||[n.spec.target]).join(", "),placement:"bottom-start"})})}}},createSpecTypeColumn(){return{title:"Type",field:"entity.spec.type",hidden:!0,width:"auto"}},createSpecLifecycleColumn(){return{title:"Lifecycle",field:"entity.spec.lifecycle"}},createMetadataDescriptionColumn(){return{title:"Description",field:"entity.metadata.description",render:({entity:n})=>(0,e.jsx)(rt.O,{text:n.metadata.description,placement:"bottom-start"}),width:"auto"}},createTagsColumn(){return{title:"Tags",field:"entity.metadata.tags",cellStyle:{padding:"0px 16px 0px 20px"},render:({entity:n})=>(0,e.jsx)(e.Fragment,{children:n.metadata.tags&&n.metadata.tags.map(l=>(0,e.jsx)(it.Z,{label:l,size:"small",variant:"outlined",style:{marginBottom:"0px"}},l))}),width:"auto"}},createTitleColumn(n){return{title:"Title",field:"entity.metadata.title",hidden:n==null?void 0:n.hidden,searchable:!0}},createLabelColumn(n,l){return{title:(l==null?void 0:l.title)||"Label",field:"entity.metadata.labels",cellStyle:{padding:"0px 16px 0px 20px"},render:({entity:a})=>{var s;const d=(s=a.metadata)===null||s===void 0?void 0:s.labels,o=d&&d[n]||(l==null?void 0:l.defaultValue);return(0,e.jsx)(e.Fragment,{children:o&&(0,e.jsx)(it.Z,{label:o,size:"small",variant:"outlined"},o)})},width:"auto"}},createNamespaceColumn(){return{title:"Namespace",field:"entity.metadata.namespace",width:"auto"}}}),le=(0,Jt.Z)({root:{color:"#f3ba37"}})(qt.Z),se=(n,l)=>{const a=s=>s.metadata.title||(0,R.$)(s,{defaultKind:"Component"});return a(n).localeCompare(a(l))},w=n=>{var l,a,s,d;const{columns:o,actions:r,tableOptions:i,subtitle:c,emptyContent:u}=n,{isStarredEntity:f,toggleStarredEntity:h}=(0,Yt.C)(),{loading:P,error:S,entities:x,filters:j}=(0,O.wp)(),M=(0,v.useMemo)(()=>{var m;return[g.createTitleColumn({hidden:!0}),g.createNameColumn({defaultKind:(m=j.kind)===null||m===void 0?void 0:m.value}),...y(),g.createMetadataDescriptionColumn(),g.createTagsColumn()];function y(){var p;const C=[g.createSystemColumn(),g.createOwnerColumn(),g.createSpecTypeColumn(),g.createSpecLifecycleColumn()];switch((p=j.kind)===null||p===void 0?void 0:p.value){case"user":return[];case"domain":case"system":return[g.createOwnerColumn()];case"group":case"template":return[g.createSpecTypeColumn()];case"location":return[g.createSpecTypeColumn(),g.createSpecTargetsColumn()];default:return x.every(ge=>ge.metadata.namespace==="default")?C:[...C,g.createNamespaceColumn()]}}},[(l=j.kind)===null||l===void 0?void 0:l.value,x]),A=j.type===void 0;var K;const L=(0,te.capitalize)((K=(a=j.user)===null||a===void 0?void 0:a.value)!==null&&K!==void 0?K:"all");if(S)return(0,e.jsx)("div",{children:(0,e.jsx)(bt.G,{severity:"error",title:"Could not fetch catalog entities.",children:(0,e.jsx)(Gt.O,{language:"text",text:S.toString()})})});const ve=[({entity:m})=>{var y;const p=(y=m.metadata.annotations)===null||y===void 0?void 0:y[at.l2],C="View";return{icon:()=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(D.Z,{style:k.Z,children:C}),(0,e.jsx)(wt.Z,{fontSize:"small"})]}),tooltip:C,disabled:!p,onClick:()=>{p&&window.open(p,"_blank")}}},({entity:m})=>{var y;const p=(y=m.metadata.annotations)===null||y===void 0?void 0:y[at.Tf],C="Edit";return{icon:()=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(D.Z,{style:k.Z,children:C}),(0,e.jsx)(kt.Z,{fontSize:"small"})]}),tooltip:C,disabled:!p,onClick:()=>{p&&window.open(p,"_blank")}}},({entity:m})=>{const y=f(m),p=y?"Remove from favorites":"Add to favorites";return{cellStyle:{paddingLeft:"1em"},icon:()=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(D.Z,{style:k.Z,children:p}),y?(0,e.jsx)(le,{}):(0,e.jsx)(_t.Z,{})]}),tooltip:p,onClick:()=>h(m)}}],vt=x.sort(se).map(m=>{const y=(0,st.h)(m,lt.cz,{kind:"system"}),p=(0,st.h)(m,lt.S4);return{entity:m,resolved:{name:(0,R.$)(m,{defaultKind:"Component"}),entityRef:(0,Qt.eE)(m),ownedByRelationsTitle:p.map(C=>(0,R.$)(C,{defaultKind:"group"})).join(", "),ownedByRelations:p,partOfSystemRelationTitle:y.map(C=>(0,R.$)(C,{defaultKind:"system"})).join(", "),partOfSystemRelations:y}}}),mt=(o||M).find(m=>m.title==="Type");mt&&(mt.hidden=!A);const me=vt.length>20,fe=((s=j.kind)===null||s===void 0?void 0:s.value)||"",pe=((d=j.type)===null||d===void 0?void 0:d.value)||"",ye=[L,pe,ne()(fe)].filter(m=>m).join(" ");return(0,e.jsx)(Xt.i,{isLoading:P,columns:o||M,options:{paging:me,pageSize:20,actionsColumnIndex:-1,loadingType:"linear",showEmptyDataSourceMessage:!P,padding:"dense",pageSizeOptions:[20,50,100],...i},title:`${ye} (${x.length})`,data:vt,actions:r||ve,subtitle:c,emptyContent:u})};w.columns=g;var oe=t(35304);const ie=(0,oe.F)({id:"catalog",messages:{catalog_page_title:"{{orgName}} Catalog",catalog_page_create_button_title:"Create"}});var re=t(58513),de=t(96253);const dt=new WeakSet,ce=n=>{const l=(0,E.h_)(re.V),a=(0,E.h_)(de.o),[s,d]=(0,v.useState)(()=>a.getTranslation(n)),o=(0,v.useMemo)(()=>a.translation$(n),[a,n]),r=(0,v.useCallback)(c=>{if(!dt.has(n)){const u=`Failed to load translation resource '${n.id}'; caused by ${c}`;console.error(u),l.post(new Error(u)),dt.add(n)}},[l,n]);(0,v.useEffect)(()=>{const c=o.subscribe({next(u){u.ready&&d(u)},error(u){r(u)}});return()=>{c.unsubscribe()}},[o,r]);const i=(0,v.useRef)(!0);if((0,v.useEffect)(()=>{i.current?i.current=!1:d(a.getTranslation(n))},[a,n]),!s.ready)throw new Promise(c=>{const u=o.subscribe({next(f){f.ready&&(u.unsubscribe(),c())},error(f){u.unsubscribe(),r(f),c()}})});return{t:s.t}};function ct(n){const{filters:l,content:a=(0,e.jsx)(w,{})}=n;var s;const d=(s=(0,E.h_)(G.D).getOptionalString("organization.name"))!==null&&s!==void 0?s:"Backstage",o=(0,Z.t)(Vt.yw),{t:r}=ce(ie);return(0,e.jsx)(z.g,{title:r("catalog_page_title",{orgName:d}),themeId:"home",children:(0,e.jsxs)(U.V,{children:[(0,e.jsxs)(N.y,{title:"",children:[(0,e.jsx)(Q,{title:r("catalog_page_create_button_title"),to:o&&o()}),(0,e.jsx)(b.q,{children:"All your software catalog entities"})]}),(0,e.jsx)(O.UO,{children:(0,e.jsxs)(X._i,{children:[(0,e.jsx)(X._i.Filters,{children:l}),(0,e.jsx)(X._i.Content,{children:a})]})})]})})}function ut(n){const{columns:l,actions:a,initiallySelectedFilter:s="owned",initialKind:d="component",tableOptions:o={},emptyContent:r,ownerPickerMode:i}=n;return(0,e.jsx)(ct,{filters:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ht,{initialFilter:d}),(0,e.jsx)(Tt,{}),(0,e.jsx)(Pt.E,{initialFilter:s}),(0,e.jsx)(Ot.d,{mode:i}),(0,e.jsx)(Ft,{}),(0,e.jsx)(At.x,{}),(0,e.jsx)($t,{}),(0,e.jsx)(Wt,{})]}),content:(0,e.jsx)(w,{columns:l,actions:a,tableOptions:o,emptyContent:r})})}function ue(n){return(0,I.pC)()||(0,e.jsx)(ut,{...n})}}}]);})();
2
-
3
- //# sourceMappingURL=1600.ec5e759e.chunk.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"static/1600.ec5e759e.chunk.js","mappings":"kQAgCA,MAAMA,KAAYC,EAAAA,GAChB,CACEC,UAAW,CACTC,SAAU,oBACZ,CACF,EACA,CAAEC,KAAM,0BAA2B,CAAC,EAG/B,SAASC,EAAgBC,EAAc,CAC5C,KAAM,CAACC,EAAOC,CAAQ,KAAIC,EAAAA,UAAS,EAAK,EAClCC,KAAYC,EAAAA,GAAa,EACzBC,EAAUZ,EAAU,EAEpBa,EAAiBC,GAAAA,CACjBJ,EAAU,GACZF,EAASM,CAAS,CAEtB,E,IAIWR,EAF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B,OAAC1N,GAAqBA,CAAAA,CAAAA,KACtB,OAAC8N,GAAAA,EAAeA,CAAAA,CAAAA,KAChB,OAACjN,GAA4BA,CAAAA,CAAAA,KAC7B,OAAC6B,GAAqBA,CAAAA,CAAAA,C,IAG1B8J,WACE,OAACpG,EAAYA,CACXC,QAASA,EACTC,QAASA,EACTC,aAAcA,EACdE,aAAcA,C,IAKxB,CC5GO,SAASsH,GAAY5V,EAAgC,CAG1D,SAFe6V,EAAAA,IAAU,MAER,OAACT,GAAkBA,CAAE,GAAGpV,C,EAC3C,C","sources":["webpack://techdocs-cli-embedded-app/../core-components/src/components/OverflowTooltip/OverflowTooltip.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/CreateButton/CreateButton.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/components/EntityKindPicker/kindFilterUtils.ts","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/hooks/useEntityTypeFilter.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/components/EntityLifecyclePicker/EntityLifecyclePicker.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/components/EntityProcessingStatusPicker/EntityProcessingStatusPicker.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/components/EntityNamespacePicker/EntityNamespacePicker.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogTable/columns.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogTable/CatalogTable.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/translation.ts","webpack://techdocs-cli-embedded-app/../core-plugin-api/src/translation/useTranslationRef.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"],"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 { makeStyles } from '@material-ui/core/styles';\nimport Tooltip, { TooltipProps } from '@material-ui/core/Tooltip';\nimport React, { useState } from 'react';\nimport TextTruncate, { TextTruncateProps } from 'react-text-truncate';\nimport { useIsMounted } from '@react-hookz/web';\n\ntype Props = {\n text: TextTruncateProps['text'];\n line?: TextTruncateProps['line'];\n element?: TextTruncateProps['element'];\n title?: TooltipProps['title'];\n placement?: TooltipProps['placement'];\n};\n\nexport type OverflowTooltipClassKey = 'container';\n\nconst useStyles = makeStyles(\n {\n container: {\n overflow: 'visible !important',\n },\n },\n { name: 'BackstageOverflowTooltip' },\n);\n\nexport function OverflowTooltip(props: Props) {\n const [hover, setHover] = useState(false);\n const isMounted = useIsMounted();\n const classes = useStyles();\n\n const handleToggled = (truncated: boolean) => {\n if (isMounted()) {\n setHover(truncated);\n }\n };\n\n return (\n <Tooltip\n title={props.title ?? (props.text || '')}\n placement={props.placement}\n disableHoverListener={!hover}\n >\n <TextTruncate\n text={props.text}\n line={props.line}\n onToggled={handleToggled}\n containerClassName={classes.container}\n />\n </Tooltip>\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 { BackstageTheme } from '@backstage/theme';\nimport Button from '@material-ui/core/Button';\nimport IconButton from '@material-ui/core/IconButton';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\nimport React from 'react';\nimport { Link as RouterLink, LinkProps } from 'react-router-dom';\nimport AddCircleOutline from '@material-ui/icons/AddCircleOutline';\n\n/**\n * Properties for {@link CreateButton}\n *\n * @public\n */\nexport type CreateButtonProps = {\n title: string;\n} & Partial<Pick<LinkProps, 'to'>>;\n\n/**\n * Responsive Button giving consistent UX for creation of different things\n *\n * @public\n */\nexport function CreateButton(props: CreateButtonProps) {\n const { title, to } = props;\n const isXSScreen = useMediaQuery<BackstageTheme>(theme =>\n theme.breakpoints.down('xs'),\n );\n\n if (!to) {\n return null;\n }\n\n return isXSScreen ? (\n <IconButton\n component={RouterLink}\n color=\"primary\"\n title={title}\n size=\"small\"\n to={to}\n >\n <AddCircleOutline />\n </IconButton>\n ) : (\n <Button component={RouterLink} variant=\"contained\" color=\"primary\" to={to}>\n {title}\n </Button>\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 { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/lib/useAsync';\nimport { catalogApiRef } from '../../api';\n\n/**\n * Fetch and return all availible kinds.\n */\nexport function useAllKinds(): {\n loading: boolean;\n error?: Error;\n allKinds: string[];\n} {\n const catalogApi = useApi(catalogApiRef);\n\n const {\n error,\n loading,\n value: allKinds,\n } = useAsync(async () => {\n const items = await catalogApi\n .getEntityFacets({ facets: ['kind'] })\n .then(response => response.facets.kind?.map(f => f.value).sort() || []);\n return items;\n }, [catalogApi]);\n\n return { loading, error, allKinds: allKinds ?? [] };\n}\n\n/**\n * Filter and capitalize accessible kinds.\n */\nexport function filterKinds(\n allKinds: string[],\n allowedKinds?: string[],\n forcedKinds?: string,\n): Record<string, string> {\n // Before allKinds is loaded, or when a kind is entered manually in the URL, selectedKind may not\n // be present in allKinds. It should still be shown in the dropdown, but may not have the nice\n // enforced casing from the catalog-backend. This makes a key/value record for the Select options,\n // including selectedKind if it's unknown - but allows the selectedKind to get clobbered by the\n // more proper catalog kind if it exists.\n let availableKinds = allKinds;\n if (allowedKinds) {\n availableKinds = availableKinds.filter(k =>\n allowedKinds.some(\n a => a.toLocaleLowerCase('en-US') === k.toLocaleLowerCase('en-US'),\n ),\n );\n }\n if (\n forcedKinds &&\n !allKinds.some(\n a =>\n a.toLocaleLowerCase('en-US') === forcedKinds.toLocaleLowerCase('en-US'),\n )\n ) {\n availableKinds = availableKinds.concat([forcedKinds]);\n }\n\n const kindsMap = availableKinds.sort().reduce((acc, kind) => {\n acc[kind.toLocaleLowerCase('en-US')] = kind;\n return acc;\n }, {} as Record<string, string>);\n\n return kindsMap;\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 { Select } from '@backstage/core-components';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport { Box } from '@material-ui/core';\nimport React, { useEffect, useMemo, useState } from 'react';\nimport { EntityKindFilter } from '../../filters';\nimport { useEntityList } from '../../hooks';\nimport { filterKinds, useAllKinds } from './kindFilterUtils';\n\nfunction useEntityKindFilter(opts: { initialFilter: string }): {\n loading: boolean;\n error?: Error;\n allKinds: string[];\n selectedKind: string;\n setSelectedKind: (kind: string) => void;\n} {\n const {\n filters,\n queryParameters: { kind: kindParameter },\n updateFilters,\n } = useEntityList();\n\n const queryParamKind = useMemo(\n () => [kindParameter].flat()[0],\n [kindParameter],\n );\n\n const [selectedKind, setSelectedKind] = useState(\n queryParamKind ?? filters.kind?.value ?? opts.initialFilter,\n );\n\n // Set selected kinds on query parameter updates; this happens at initial page load and from\n // external updates to the page location.\n useEffect(() => {\n if (queryParamKind) {\n setSelectedKind(queryParamKind);\n }\n }, [queryParamKind]);\n\n // Set selected kind from filters; this happens when the kind filter is\n // updated from another component\n useEffect(() => {\n if (filters.kind?.value) {\n setSelectedKind(filters.kind?.value);\n }\n }, [filters.kind]);\n\n useEffect(() => {\n updateFilters({\n kind: selectedKind ? new EntityKindFilter(selectedKind) : undefined,\n });\n }, [selectedKind, updateFilters]);\n\n const { allKinds, loading, error } = useAllKinds();\n\n return {\n loading,\n error,\n allKinds: allKinds ?? [],\n selectedKind,\n setSelectedKind,\n };\n}\n\n/**\n * Props for {@link EntityKindPicker}.\n *\n * @public\n */\nexport interface EntityKindPickerProps {\n /**\n * Entity kinds to show in the dropdown; by default all kinds are fetched from the catalog and\n * displayed.\n */\n allowedKinds?: string[];\n initialFilter?: string;\n hidden?: boolean;\n}\n\n/** @public */\nexport const EntityKindPicker = (props: EntityKindPickerProps) => {\n const { allowedKinds, hidden, initialFilter = 'component' } = props;\n\n const alertApi = useApi(alertApiRef);\n\n const { error, allKinds, selectedKind, setSelectedKind } =\n useEntityKindFilter({\n initialFilter: initialFilter,\n });\n\n useEffect(() => {\n if (error) {\n alertApi.post({\n message: `Failed to load entity kinds`,\n severity: 'error',\n });\n }\n }, [error, alertApi]);\n\n if (error) return null;\n\n const options = filterKinds(allKinds, allowedKinds, selectedKind);\n\n const items = Object.keys(options).map(key => ({\n value: key,\n label: options[key],\n }));\n\n return hidden ? null : (\n <Box pb={1} pt={1}>\n <Select\n label=\"Kind\"\n items={items}\n selected={selectedKind.toLocaleLowerCase('en-US')}\n onChange={value => setSelectedKind(String(value))}\n />\n </Box>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport useAsync from 'react-use/lib/useAsync';\nimport isEqual from 'lodash/isEqual';\nimport sortBy from 'lodash/sortBy';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { catalogApiRef } from '../api';\nimport { useEntityList } from './useEntityListProvider';\nimport { EntityTypeFilter } from '../filters';\n\n/**\n * A hook built on top of `useEntityList` for enabling selection of valid `spec.type` values\n * based on the selected EntityKindFilter.\n * @public\n */\nexport function useEntityTypeFilter(): {\n loading: boolean;\n error?: Error;\n availableTypes: string[];\n selectedTypes: string[];\n setSelectedTypes: (types: string[]) => void;\n} {\n const catalogApi = useApi(catalogApiRef);\n const {\n filters: { kind: kindFilter, type: typeFilter },\n queryParameters: { type: typeParameter },\n updateFilters,\n } = useEntityList();\n\n const flattenedQueryTypes = useMemo(\n () => [typeParameter].flat().filter(Boolean) as string[],\n [typeParameter],\n );\n\n const [selectedTypes, setSelectedTypes] = useState(\n flattenedQueryTypes.length\n ? flattenedQueryTypes\n : typeFilter?.getTypes() ?? [],\n );\n\n // Set selected types on query parameter updates; this happens at initial page load and from\n // external updates to the page location.\n useEffect(() => {\n if (flattenedQueryTypes.length) {\n setSelectedTypes(flattenedQueryTypes);\n }\n }, [flattenedQueryTypes]);\n\n const [availableTypes, setAvailableTypes] = useState<string[]>([]);\n const kind = useMemo(() => kindFilter?.value, [kindFilter]);\n\n // Load all valid spec.type values straight from the catalogApi, paying attention to only the\n // kind filter for a complete list.\n const {\n error,\n loading,\n value: facets,\n } = useAsync(async () => {\n if (kind) {\n const items = await catalogApi\n .getEntityFacets({\n filter: { kind },\n facets: ['spec.type'],\n })\n .then(response => response.facets['spec.type'] || []);\n return items;\n }\n return [];\n }, [kind, catalogApi]);\n\n const facetsRef = useRef(facets);\n useEffect(() => {\n const oldFacets = facetsRef.current;\n facetsRef.current = facets;\n // Delay processing hook until kind and facets load updates have settled to generate list of types;\n // This prevents resetting the type filter due to saved type value from query params not matching the\n // empty set of type values while values are still being loaded; also only run this hook on changes\n // to facets\n if (loading || !kind || oldFacets === facets || !facets) {\n return;\n }\n\n // Sort by facet count descending, so the most common types appear on top\n const newTypes = [\n ...new Set(\n sortBy(facets, f => -f.count).map(f =>\n f.value.toLocaleLowerCase('en-US'),\n ),\n ),\n ];\n setAvailableTypes(newTypes);\n\n // Update type filter to only valid values when the list of available types has changed\n const stillValidTypes = selectedTypes.filter(value =>\n newTypes.includes(value),\n );\n if (!isEqual(selectedTypes, stillValidTypes)) {\n setSelectedTypes(stillValidTypes);\n }\n }, [loading, kind, selectedTypes, setSelectedTypes, facets]);\n\n useEffect(() => {\n updateFilters({\n type: selectedTypes.length\n ? new EntityTypeFilter(selectedTypes)\n : undefined,\n });\n }, [selectedTypes, updateFilters]);\n\n return {\n loading,\n error,\n availableTypes,\n selectedTypes,\n setSelectedTypes,\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 } from 'react';\nimport { Box } from '@material-ui/core';\nimport { useEntityTypeFilter } from '../../hooks/useEntityTypeFilter';\n\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport { Select } from '@backstage/core-components';\n\n/**\n * Props for {@link EntityTypePicker}.\n *\n * @public\n */\nexport interface EntityTypePickerProps {\n initialFilter?: string;\n hidden?: boolean;\n}\n\n/** @public */\nexport const EntityTypePicker = (props: EntityTypePickerProps) => {\n const { hidden, initialFilter } = props;\n const alertApi = useApi(alertApiRef);\n const { error, availableTypes, selectedTypes, setSelectedTypes } =\n useEntityTypeFilter();\n\n useEffect(() => {\n if (error) {\n alertApi.post({\n message: `Failed to load entity types`,\n severity: 'error',\n });\n }\n if (initialFilter) {\n setSelectedTypes([initialFilter]);\n }\n }, [error, alertApi, initialFilter, setSelectedTypes]);\n\n if (availableTypes.length === 0 || error) return null;\n\n const items = [\n { value: 'all', label: 'all' },\n ...availableTypes.map((type: string) => ({\n value: type,\n label: type,\n })),\n ];\n\n return hidden ? null : (\n <Box pb={1} pt={1}>\n <Select\n label=\"Type\"\n items={items}\n selected={(items.length > 1 ? selectedTypes[0] : undefined) ?? 'all'}\n onChange={value =>\n setSelectedTypes(value === 'all' ? [] : [String(value)])\n }\n />\n </Box>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { makeStyles } from '@material-ui/core';\nimport React from 'react';\nimport { EntityLifecycleFilter } from '../../filters';\nimport { EntityAutocompletePicker } from '../EntityAutocompletePicker';\n\n/** @public */\nexport type CatalogReactEntityLifecyclePickerClassKey = 'input';\n\nconst useStyles = makeStyles(\n {\n input: {},\n },\n {\n name: 'CatalogReactEntityLifecyclePicker',\n },\n);\n\n/** @public */\nexport const EntityLifecyclePicker = (props: { initialFilter?: string[] }) => {\n const { initialFilter = [] } = props;\n const classes = useStyles();\n\n return (\n <EntityAutocompletePicker\n label=\"Lifecycle\"\n name=\"lifecycles\"\n path=\"spec.lifecycle\"\n Filter={EntityLifecycleFilter}\n InputProps={{ className: classes.input }}\n initialSelectedOptions={initialFilter}\n />\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 { EntityErrorFilter, EntityOrphanFilter } from '../../filters';\nimport {\n Box,\n Checkbox,\n FormControlLabel,\n makeStyles,\n TextField,\n Typography,\n} from '@material-ui/core';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport React, { useState } from 'react';\nimport { useEntityList } from '../../hooks';\nimport { Autocomplete } from '@material-ui/lab';\n\n/** @public */\nexport type CatalogReactEntityProcessingStatusPickerClassKey = 'input';\n\nconst useStyles = makeStyles(\n {\n input: {},\n },\n {\n name: 'CatalogReactEntityProcessingStatusPickerPicker',\n },\n);\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\n/** @public */\nexport const EntityProcessingStatusPicker = () => {\n const classes = useStyles();\n const { updateFilters } = useEntityList();\n\n const [selectedAdvancedItems, setSelectedAdvancedItems] = useState<string[]>(\n [],\n );\n\n function orphanChange(value: boolean) {\n updateFilters({\n orphan: value ? new EntityOrphanFilter(value) : undefined,\n });\n }\n\n function errorChange(value: boolean) {\n updateFilters({\n error: value ? new EntityErrorFilter(value) : undefined,\n });\n }\n\n const availableAdvancedItems = ['Is Orphan', 'Has Error'];\n\n return (\n <Box pb={1} pt={1}>\n <Typography variant=\"button\" component=\"label\">\n Processing Status\n <Autocomplete\n multiple\n disableCloseOnSelect\n options={availableAdvancedItems}\n value={selectedAdvancedItems}\n onChange={(_: object, value: string[]) => {\n setSelectedAdvancedItems(value);\n orphanChange(value.includes('Is Orphan'));\n errorChange(value.includes('Has Error'));\n }}\n renderOption={(option, { selected }) => (\n <FormControlLabel\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={selected}\n />\n }\n onClick={event => event.preventDefault()}\n label={option}\n />\n )}\n size=\"small\"\n popupIcon={\n <ExpandMoreIcon data-testid=\"processing-status-picker-expand\" />\n }\n renderInput={params => (\n <TextField\n {...params}\n className={classes.input}\n variant=\"outlined\"\n />\n )}\n />\n </Typography>\n </Box>\n );\n};\n","/*\n * Copyright 2023 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 { makeStyles } from '@material-ui/core';\n\nimport React from 'react';\nimport { EntityNamespaceFilter } from '../../filters';\nimport { EntityAutocompletePicker } from '../EntityAutocompletePicker';\n\n/** @public */\nexport type CatalogReactEntityNamespacePickerClassKey = 'input';\n\nconst useStyles = makeStyles(\n {\n input: {},\n },\n {\n name: 'CatalogReactEntityNamespacePicker',\n },\n);\n\n/** @public */\nexport const EntityNamespacePicker = () => {\n const classes = useStyles();\n return (\n <EntityAutocompletePicker\n label=\"Namespace\"\n name=\"namespace\"\n path=\"metadata.namespace\"\n Filter={EntityNamespaceFilter}\n InputProps={{ className: classes.input }}\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 */\nimport React from 'react';\nimport {\n humanizeEntityRef,\n EntityRefLink,\n EntityRefLinks,\n} from '@backstage/plugin-catalog-react';\nimport { Chip } from '@material-ui/core';\nimport { CatalogTableRow } from './types';\nimport { OverflowTooltip, TableColumn } from '@backstage/core-components';\nimport { Entity } from '@backstage/catalog-model';\nimport { JsonArray } from '@backstage/types';\n\n// The columnFactories symbol is not directly exported, but through the\n// CatalogTable.columns field.\n/** @public */\nexport const columnFactories = Object.freeze({\n createNameColumn(options?: {\n defaultKind?: string;\n }): TableColumn<CatalogTableRow> {\n function formatContent(entity: Entity): string {\n return (\n entity.metadata?.title ||\n humanizeEntityRef(entity, {\n defaultKind: options?.defaultKind,\n })\n );\n }\n\n return {\n title: 'Name',\n field: 'resolved.entityRef',\n highlight: true,\n customSort({ entity: entity1 }, { entity: entity2 }) {\n // TODO: We could implement this more efficiently by comparing field by field.\n // This has similar issues as above.\n return formatContent(entity1).localeCompare(formatContent(entity2));\n },\n render: ({ entity }) => (\n <EntityRefLink\n entityRef={entity}\n defaultKind={options?.defaultKind || 'Component'}\n />\n ),\n };\n },\n createSystemColumn(): TableColumn<CatalogTableRow> {\n return {\n title: 'System',\n field: 'resolved.partOfSystemRelationTitle',\n render: ({ resolved }) => (\n <EntityRefLinks\n entityRefs={resolved.partOfSystemRelations}\n defaultKind=\"system\"\n />\n ),\n };\n },\n createOwnerColumn(): TableColumn<CatalogTableRow> {\n return {\n title: 'Owner',\n field: 'resolved.ownedByRelationsTitle',\n render: ({ resolved }) => (\n <EntityRefLinks\n entityRefs={resolved.ownedByRelations}\n defaultKind=\"group\"\n />\n ),\n };\n },\n createSpecTargetsColumn(): TableColumn<CatalogTableRow> {\n return {\n title: 'Targets',\n field: 'entity.spec.targets',\n render: ({ entity }) => (\n <>\n {(entity?.spec?.targets || entity?.spec?.target) && (\n <OverflowTooltip\n text={(\n (entity!.spec!.targets as JsonArray) || [entity.spec.target]\n ).join(', ')}\n placement=\"bottom-start\"\n />\n )}\n </>\n ),\n };\n },\n createSpecTypeColumn(): TableColumn<CatalogTableRow> {\n return {\n title: 'Type',\n field: 'entity.spec.type',\n hidden: true,\n width: 'auto',\n };\n },\n createSpecLifecycleColumn(): TableColumn<CatalogTableRow> {\n return {\n title: 'Lifecycle',\n field: 'entity.spec.lifecycle',\n };\n },\n createMetadataDescriptionColumn(): TableColumn<CatalogTableRow> {\n return {\n title: 'Description',\n field: 'entity.metadata.description',\n render: ({ entity }) => (\n <OverflowTooltip\n text={entity.metadata.description}\n placement=\"bottom-start\"\n />\n ),\n width: 'auto',\n };\n },\n createTagsColumn(): TableColumn<CatalogTableRow> {\n return {\n title: 'Tags',\n field: 'entity.metadata.tags',\n cellStyle: {\n padding: '0px 16px 0px 20px',\n },\n render: ({ entity }) => (\n <>\n {entity.metadata.tags &&\n entity.metadata.tags.map(t => (\n <Chip\n key={t}\n label={t}\n size=\"small\"\n variant=\"outlined\"\n style={{ marginBottom: '0px' }}\n />\n ))}\n </>\n ),\n width: 'auto',\n };\n },\n createTitleColumn(options?: {\n hidden?: boolean;\n }): TableColumn<CatalogTableRow> {\n return {\n title: 'Title',\n field: 'entity.metadata.title',\n hidden: options?.hidden,\n searchable: true,\n };\n },\n createLabelColumn(\n key: string,\n options?: { title?: string; defaultValue?: string },\n ): TableColumn<CatalogTableRow> {\n return {\n title: options?.title || 'Label',\n field: 'entity.metadata.labels',\n cellStyle: {\n padding: '0px 16px 0px 20px',\n },\n render: ({ entity }: { entity: Entity }) => {\n const labels: Record<string, string> | undefined =\n entity.metadata?.labels;\n const specifiedLabelValue =\n (labels && labels[key]) || options?.defaultValue;\n return (\n <>\n {specifiedLabelValue && (\n <Chip\n key={specifiedLabelValue}\n label={specifiedLabelValue}\n size=\"small\"\n variant=\"outlined\"\n />\n )}\n </>\n );\n },\n width: 'auto',\n };\n },\n createNamespaceColumn(): TableColumn<CatalogTableRow> {\n return {\n title: 'Namespace',\n field: 'entity.metadata.namespace',\n width: 'auto',\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 */\nimport {\n ANNOTATION_EDIT_URL,\n ANNOTATION_VIEW_URL,\n Entity,\n RELATION_OWNED_BY,\n RELATION_PART_OF,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n CodeSnippet,\n Table,\n TableColumn,\n TableProps,\n WarningPanel,\n} from '@backstage/core-components';\nimport {\n getEntityRelations,\n humanizeEntityRef,\n useEntityList,\n useStarredEntities,\n} from '@backstage/plugin-catalog-react';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\nimport { visuallyHidden } from '@mui/utils';\nimport Edit from '@material-ui/icons/Edit';\nimport OpenInNew from '@material-ui/icons/OpenInNew';\nimport Star from '@material-ui/icons/Star';\nimport StarBorder from '@material-ui/icons/StarBorder';\nimport { capitalize } from 'lodash';\nimport pluralize from 'pluralize';\nimport React, { ReactNode, useMemo } from 'react';\nimport { columnFactories } from './columns';\nimport { CatalogTableRow } from './types';\n\n/**\n * Props for {@link CatalogTable}.\n *\n * @public\n */\nexport interface CatalogTableProps {\n columns?: TableColumn<CatalogTableRow>[];\n actions?: TableProps<CatalogTableRow>['actions'];\n tableOptions?: TableProps<CatalogTableRow>['options'];\n emptyContent?: ReactNode;\n subtitle?: string;\n}\n\nconst YellowStar = withStyles({\n root: {\n color: '#f3ba37',\n },\n})(Star);\n\nconst refCompare = (a: Entity, b: Entity) => {\n const toRef = (entity: Entity) =>\n entity.metadata.title ||\n humanizeEntityRef(entity, {\n defaultKind: 'Component',\n });\n\n return toRef(a).localeCompare(toRef(b));\n};\n\n/** @public */\nexport const CatalogTable = (props: CatalogTableProps) => {\n const { columns, actions, tableOptions, subtitle, emptyContent } = props;\n const { isStarredEntity, toggleStarredEntity } = useStarredEntities();\n const { loading, error, entities, filters } = useEntityList();\n\n const defaultColumns: TableColumn<CatalogTableRow>[] = useMemo(() => {\n return [\n columnFactories.createTitleColumn({ hidden: true }),\n columnFactories.createNameColumn({ defaultKind: filters.kind?.value }),\n ...createEntitySpecificColumns(),\n columnFactories.createMetadataDescriptionColumn(),\n columnFactories.createTagsColumn(),\n ];\n\n function createEntitySpecificColumns(): TableColumn<CatalogTableRow>[] {\n const baseColumns = [\n columnFactories.createSystemColumn(),\n columnFactories.createOwnerColumn(),\n columnFactories.createSpecTypeColumn(),\n columnFactories.createSpecLifecycleColumn(),\n ];\n switch (filters.kind?.value) {\n case 'user':\n return [];\n case 'domain':\n case 'system':\n return [columnFactories.createOwnerColumn()];\n case 'group':\n case 'template':\n return [columnFactories.createSpecTypeColumn()];\n case 'location':\n return [\n columnFactories.createSpecTypeColumn(),\n columnFactories.createSpecTargetsColumn(),\n ];\n default:\n return entities.every(\n entity => entity.metadata.namespace === 'default',\n )\n ? baseColumns\n : [...baseColumns, columnFactories.createNamespaceColumn()];\n }\n }\n }, [filters.kind?.value, entities]);\n\n const showTypeColumn = filters.type === undefined;\n // TODO(timbonicus): remove the title from the CatalogTable once using EntitySearchBar\n const titlePreamble = capitalize(filters.user?.value ?? 'all');\n\n if (error) {\n return (\n <div>\n <WarningPanel\n severity=\"error\"\n title=\"Could not fetch catalog entities.\"\n >\n <CodeSnippet language=\"text\" text={error.toString()} />\n </WarningPanel>\n </div>\n );\n }\n\n const defaultActions: TableProps<CatalogTableRow>['actions'] = [\n ({ entity }) => {\n const url = entity.metadata.annotations?.[ANNOTATION_VIEW_URL];\n const title = 'View';\n\n return {\n icon: () => (\n <>\n <Typography style={visuallyHidden}>{title}</Typography>\n <OpenInNew fontSize=\"small\" />\n </>\n ),\n tooltip: title,\n disabled: !url,\n onClick: () => {\n if (!url) return;\n window.open(url, '_blank');\n },\n };\n },\n ({ entity }) => {\n const url = entity.metadata.annotations?.[ANNOTATION_EDIT_URL];\n const title = 'Edit';\n\n return {\n icon: () => (\n <>\n <Typography style={visuallyHidden}>{title}</Typography>\n <Edit fontSize=\"small\" />\n </>\n ),\n tooltip: title,\n disabled: !url,\n onClick: () => {\n if (!url) return;\n window.open(url, '_blank');\n },\n };\n },\n ({ entity }) => {\n const isStarred = isStarredEntity(entity);\n const title = isStarred ? 'Remove from favorites' : 'Add to favorites';\n\n return {\n cellStyle: { paddingLeft: '1em' },\n icon: () => (\n <>\n <Typography style={visuallyHidden}>{title}</Typography>\n {isStarred ? <YellowStar /> : <StarBorder />}\n </>\n ),\n tooltip: title,\n onClick: () => toggleStarredEntity(entity),\n };\n },\n ];\n\n const rows = entities.sort(refCompare).map(entity => {\n const partOfSystemRelations = getEntityRelations(entity, RELATION_PART_OF, {\n kind: 'system',\n });\n const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);\n\n return {\n entity,\n resolved: {\n // This name is here for backwards compatibility mostly; the\n // presentation of refs in the table should in general be handled with\n // EntityRefLink / EntityName components\n name: humanizeEntityRef(entity, {\n defaultKind: 'Component',\n }),\n entityRef: stringifyEntityRef(entity),\n ownedByRelationsTitle: ownedByRelations\n .map(r => humanizeEntityRef(r, { defaultKind: 'group' }))\n .join(', '),\n ownedByRelations,\n partOfSystemRelationTitle: partOfSystemRelations\n .map(r =>\n humanizeEntityRef(r, {\n defaultKind: 'system',\n }),\n )\n .join(', '),\n partOfSystemRelations,\n },\n };\n });\n\n const typeColumn = (columns || defaultColumns).find(c => c.title === 'Type');\n if (typeColumn) {\n typeColumn.hidden = !showTypeColumn;\n }\n const showPagination = rows.length > 20;\n const currentKind = filters.kind?.value || '';\n const currentType = filters.type?.value || '';\n const titleDisplay = [titlePreamble, currentType, pluralize(currentKind)]\n .filter(s => s)\n .join(' ');\n\n return (\n <Table<CatalogTableRow>\n isLoading={loading}\n columns={columns || defaultColumns}\n options={{\n paging: showPagination,\n pageSize: 20,\n actionsColumnIndex: -1,\n loadingType: 'linear',\n showEmptyDataSourceMessage: !loading,\n padding: 'dense',\n pageSizeOptions: [20, 50, 100],\n ...tableOptions,\n }}\n title={`${titleDisplay} (${entities.length})`}\n data={rows}\n actions={actions || defaultActions}\n subtitle={subtitle}\n emptyContent={emptyContent}\n />\n );\n};\n\nCatalogTable.columns = columnFactories;\n","/*\n * Copyright 2023 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 { createTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @alpha */\nexport const catalogTranslationRef = createTranslationRef({\n id: 'catalog',\n messages: {\n catalog_page_title: `{{orgName}} Catalog`,\n catalog_page_create_button_title: 'Create',\n },\n});\n","/*\n * Copyright 2023 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 { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { errorApiRef, useApi } from '../apis';\nimport {\n translationApiRef,\n TranslationFunction,\n TranslationSnapshot,\n} from '../apis/alpha';\nimport { TranslationRef } from './TranslationRef';\n\n// Make sure we don't fill the logs with loading errors for the same ref\nconst loggedRefs = new WeakSet<TranslationRef<string, {}>>();\n\n/** @alpha */\nexport const useTranslationRef = <\n TMessages extends { [key in string]: string },\n>(\n translationRef: TranslationRef<string, TMessages>,\n): { t: TranslationFunction<TMessages> } => {\n const errorApi = useApi(errorApiRef);\n const translationApi = useApi(translationApiRef);\n\n const [snapshot, setSnapshot] = useState<TranslationSnapshot<TMessages>>(() =>\n translationApi.getTranslation(translationRef),\n );\n const observable = useMemo(\n () => translationApi.translation$(translationRef),\n [translationApi, translationRef],\n );\n\n const onError = useCallback(\n (error: Error) => {\n if (!loggedRefs.has(translationRef)) {\n const errMsg = `Failed to load translation resource '${translationRef.id}'; caused by ${error}`;\n // eslint-disable-next-line no-console\n console.error(errMsg);\n errorApi.post(new Error(errMsg));\n loggedRefs.add(translationRef);\n }\n },\n [errorApi, translationRef],\n );\n\n useEffect(() => {\n const subscription = observable.subscribe({\n next(next) {\n if (next.ready) {\n setSnapshot(next);\n }\n },\n error(error) {\n onError(error);\n },\n });\n\n return () => {\n subscription.unsubscribe();\n };\n }, [observable, onError]);\n\n // Keep track of if the provided translation ref changes, and in that case update the snapshot\n const initialRenderRef = useRef(true);\n useEffect(() => {\n if (initialRenderRef.current) {\n initialRenderRef.current = false;\n } else {\n setSnapshot(translationApi.getTranslation(translationRef));\n }\n }, [translationApi, translationRef]);\n\n if (!snapshot.ready) {\n throw new Promise<void>(resolve => {\n const subscription = observable.subscribe({\n next(next) {\n if (next.ready) {\n subscription.unsubscribe();\n resolve();\n }\n },\n error(error) {\n subscription.unsubscribe();\n onError(error);\n resolve();\n },\n });\n });\n }\n\n return { t: snapshot.t };\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 {\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 EntityNamespacePicker,\n EntityOwnerPickerProps,\n} from '@backstage/plugin-catalog-react';\nimport React, { ReactNode } from 'react';\nimport { createComponentRouteRef } from '../../routes';\nimport { CatalogTable, CatalogTableRow } from '../CatalogTable';\nimport { catalogTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @internal */\nexport interface BaseCatalogPageProps {\n filters: ReactNode;\n content?: ReactNode;\n}\n\n/** @internal */\nexport function BaseCatalogPage(props: BaseCatalogPageProps) {\n const { filters, content = <CatalogTable /> } = props;\n const orgName =\n useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';\n const createComponentLink = useRouteRef(createComponentRouteRef);\n const { t } = useTranslationRef(catalogTranslationRef);\n\n return (\n <PageWithHeader title={t('catalog_page_title', { orgName })} themeId=\"home\">\n <Content>\n <ContentHeader title=\"\">\n <CreateButton\n title={t('catalog_page_create_button_title')}\n to={createComponentLink && createComponentLink()}\n />\n <SupportButton>All your software catalog entities</SupportButton>\n </ContentHeader>\n <EntityListProvider>\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>{filters}</CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>{content}</CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </EntityListProvider>\n </Content>\n </PageWithHeader>\n );\n}\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 ownerPickerMode?: EntityOwnerPickerProps['mode'];\n}\n\nexport function DefaultCatalogPage(props: DefaultCatalogPageProps) {\n const {\n columns,\n actions,\n initiallySelectedFilter = 'owned',\n initialKind = 'component',\n tableOptions = {},\n emptyContent,\n ownerPickerMode,\n } = props;\n\n return (\n <BaseCatalogPage\n filters={\n <>\n <EntityKindPicker initialFilter={initialKind} />\n <EntityTypePicker />\n <UserListPicker initialFilter={initiallySelectedFilter} />\n <EntityOwnerPicker mode={ownerPickerMode} />\n <EntityLifecyclePicker />\n <EntityTagPicker />\n <EntityProcessingStatusPicker />\n <EntityNamespacePicker />\n </>\n }\n content={\n <CatalogTable\n columns={columns}\n actions={actions}\n tableOptions={tableOptions}\n emptyContent={emptyContent}\n />\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 from 'react';\nimport { useOutlet } from 'react-router-dom';\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"],"names":["useStyles","makeStyles","container","overflow","name","OverflowTooltip","props","hover","setHover","useState","isMounted","useIsMounted","classes","handleToggled","truncated","Tooltip","title","text","placement","disableHoverListener","TextTruncate","line","onToggled","containerClassName","CreateButton","to","isXSScreen","useMediaQuery","theme","breakpoints","down","IconButton","component","RouterLink","color","size","AddCircleOutline","Button","variant","useAllKinds","catalogApi","useApi","catalogApiRef","error","loading","value","allKinds","useAsync","getEntityFacets","facets","then","response","kind","map","f","sort","filterKinds","allowedKinds","forcedKinds","availableKinds","filter","k","some","a","toLocaleLowerCase","concat","reduce","acc","useEntityKindFilter","opts","filters","queryParameters","kindParameter","updateFilters","useEntityList","queryParamKind","useMemo","flat","selectedKind","setSelectedKind","initialFilter","useEffect","EntityKindFilter","undefined","EntityKindPicker","hidden","alertApi","alertApiRef","post","message","severity","options","items","Object","keys","key","label","Box","pb","pt","Select","selected","onChange","String","useEntityTypeFilter","kindFilter","type","typeFilter","typeParameter","flattenedQueryTypes","Boolean","selectedTypes","setSelectedTypes","length","getTypes","availableTypes","setAvailableTypes","facetsRef","useRef","oldFacets","current","newTypes","Set","sortBy","count","stillValidTypes","includes","isEqual","EntityTypeFilter","EntityTypePicker","input","EntityLifecyclePicker","EntityAutocompletePicker","path","Filter","EntityLifecycleFilter","InputProps","className","initialSelectedOptions","icon","CheckBoxOutlineBlankIcon","fontSize","checkedIcon","CheckBoxIcon","EntityProcessingStatusPicker","selectedAdvancedItems","setSelectedAdvancedItems","orphanChange","orphan","EntityOrphanFilter","errorChange","EntityErrorFilter","availableAdvancedItems","Typography","Autocomplete","multiple","disableCloseOnSelect","_","renderOption","option","FormControlLabel","control","Checkbox","checked","onClick","event","preventDefault","popupIcon","ExpandMoreIcon","data-testid","renderInput","params","TextField","EntityNamespacePicker","EntityNamespaceFilter","columnFactories","freeze","createNameColumn","formatContent","entity","metadata","humanizeEntityRef","defaultKind","field","highlight","customSort","entity1","entity2","localeCompare","render","EntityRefLink","entityRef","createSystemColumn","resolved","EntityRefLinks","entityRefs","partOfSystemRelations","createOwnerColumn","ownedByRelations","createSpecTargetsColumn","spec","targets","target","join","createSpecTypeColumn","width","createSpecLifecycleColumn","createMetadataDescriptionColumn","description","createTagsColumn","cellStyle","padding","tags","t","Chip","style","marginBottom","createTitleColumn","searchable","createLabelColumn","labels","specifiedLabelValue","defaultValue","createNamespaceColumn","YellowStar","withStyles","root","Star","refCompare","b","toRef","CatalogTable","columns","actions","tableOptions","subtitle","emptyContent","isStarredEntity","toggleStarredEntity","useStarredEntities","entities","defaultColumns","createEntitySpecificColumns","baseColumns","every","namespace","showTypeColumn","titlePreamble","capitalize","user","div","WarningPanel","CodeSnippet","language","toString","defaultActions","url","annotations","ANNOTATION_VIEW_URL","visuallyHidden","OpenInNew","tooltip","disabled","window","open","ANNOTATION_EDIT_URL","Edit","isStarred","paddingLeft","StarBorder","rows","getEntityRelations","RELATION_PART_OF","RELATION_OWNED_BY","stringifyEntityRef","ownedByRelationsTitle","r","partOfSystemRelationTitle","typeColumn","find","c","showPagination","currentKind","currentType","titleDisplay","pluralize","s","Table","isLoading","paging","pageSize","actionsColumnIndex","loadingType","showEmptyDataSourceMessage","pageSizeOptions","data","catalogTranslationRef","createTranslationRef","id","messages","catalog_page_title","catalog_page_create_button_title","loggedRefs","WeakSet","useTranslationRef","translationRef","errorApi","errorApiRef","translationApi","translationApiRef","snapshot","setSnapshot","getTranslation","observable","translation$","onError","useCallback","has","errMsg","console","Error","add","subscription","subscribe","next","ready","unsubscribe","initialRenderRef","Promise","resolve","BaseCatalogPage","content","orgName","configApiRef","getOptionalString","createComponentLink","useRouteRef","createComponentRouteRef","PageWithHeader","themeId","Content","ContentHeader","SupportButton","EntityListProvider","CatalogFilterLayout","Filters","DefaultCatalogPage","initiallySelectedFilter","initialKind","ownerPickerMode","UserListPicker","EntityOwnerPicker","mode","EntityTagPicker","CatalogPage","useOutlet"],"sourceRoot":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"static/4109.6335d16f.chunk.js","mappings":"kTAoCO,SAASA,GAAAA,CAId,MAAMC,KAAcC,EAAAA,IAAOC,EAAAA,CAAcA,EAGnC,CAAEC,QAAAA,EAASC,MAAOC,CAAK,KAAIC,EAAAA,SAC/B,UACE,KAAM,CAAEC,oBAAAA,CAAoB,EAAI,MAAMP,EAAYQ,qBAAqB,EACvE,OAAOD,CACT,EAEA,CAAC,CAAC,EAGEE,KAAgBC,EAAAA,SAAQ,KAC5B,MAAMC,EAAc,IAAIC,IAAIP,GAAAA,KAAAA,EAAQ,CAAC,CAAC,EAEtC,OAAQQ,GAAAA,CACN,MAAMC,KAAkBC,EAAAA,GAAmBF,EAAQG,EAAAA,EAAiBA,EAAEC,IACpEC,EAAAA,EAAkBA,EAEpB,UAAWC,KAAOL,EAChB,GAAIH,EAAYS,IAAID,CAAG,EACrB,MAAO,GAGX,MAAO,EACT,CACF,EAAG,CAACd,C,CAAK,EAET,MAAO,CAAEF,QAAAA,EAASM,cAAAA,CAAc,CAClC,C,sGC1CA,MAAMY,EAAUC,MACdC,EAAAA,GAAa,CACXC,KAAM,CACJC,QAAS,OACTC,oBAAqB,uCACrBC,aAAc,MACdC,QAASN,EAAMO,QAAQ,CAAC,CAC1B,CACF,CAAC,EAEGC,KAAYC,EAAAA,GAAWV,EAAQ,CAAEW,KAAM,uBAAwB,CAAC,EA0B/D,SAASC,EAAaC,EAA0B,CACrD,KAAM,CAAEC,SAAAA,EAAU,GAAGC,CAAW,EAAIF,EAC9BG,EAAUP,EAAUM,CAAU,EAC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AAMuC,EAAWvH,IAAI,CAAC,CAAEoG,MAAAA,CAAM,EAAGpD,KAAW,CAC1CsD,GAAItD,EAAMwF,SAAS,EACnBpC,MAAAA,CACF,EAAE,C,MAEJ,OAAC8B,EAAAA,EAAOA,CAACpF,cAAY,mB,SAClBkF,EAAiBzB,OAAOvG,IAAI,CAAC4C,EAAQI,OACpC,OAACyD,GAAAA,CAEC7D,OAAQA,EACRJ,SAAYA,GAAsB,CAAC,EACnCQ,MAAOA,C,EAHFA,CAAK,CAALA,C,KASjB,C","sources":["webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/hooks/useEntityOwnership.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ItemCard/ItemCardGrid.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ItemCard/ItemCardHeader.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/Grids/DocsCardGrid.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/HeaderTabs/HeaderTabs.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/TechDocsCustomHome.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Entity,\n RELATION_OWNED_BY,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useMemo } from 'react';\nimport useAsync from 'react-use/lib/useAsync';\nimport { getEntityRelations } from '../utils/getEntityRelations';\n\n/**\n * Returns a function that checks whether the currently signed-in user is an\n * owner of a given entity. When the hook is initially mounted, the loading\n * flag will be true and the results returned from the function will always be\n * false.\n *\n * @public\n *\n * @returns a function that checks if the signed in user owns an entity\n */\nexport function useEntityOwnership(): {\n loading: boolean;\n isOwnedEntity: (entity: Entity) => boolean;\n} {\n const identityApi = useApi(identityApiRef);\n\n // Trigger load only on mount\n const { loading, value: refs } = useAsync(\n async () => {\n const { ownershipEntityRefs } = await identityApi.getBackstageIdentity();\n return ownershipEntityRefs;\n },\n // load only on mount\n [],\n );\n\n const isOwnedEntity = useMemo(() => {\n const myOwnerRefs = new Set(refs ?? []);\n\n return (entity: Entity) => {\n const entityOwnerRefs = getEntityRelations(entity, RELATION_OWNED_BY).map(\n stringifyEntityRef,\n );\n for (const ref of entityOwnerRefs) {\n if (myOwnerRefs.has(ref)) {\n return true;\n }\n }\n return false;\n };\n }, [refs]);\n\n return { loading, isOwnedEntity };\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Box from '@material-ui/core/Box';\nimport {\n createStyles,\n makeStyles,\n Theme,\n WithStyles,\n} from '@material-ui/core/styles';\nimport React from 'react';\n\n/** @public */\nexport type ItemCardGridClassKey = 'root';\n\nconst styles = (theme: Theme) =>\n createStyles({\n root: {\n display: 'grid',\n gridTemplateColumns: 'repeat(auto-fill, minmax(22em, 1fr))',\n gridAutoRows: '1fr',\n gridGap: theme.spacing(2),\n },\n });\n\nconst useStyles = makeStyles(styles, { name: 'BackstageItemCardGrid' });\n\n/** @public */\nexport type ItemCardGridProps = Partial<WithStyles<typeof styles>> & {\n /**\n * The Card items of the grid.\n */\n children?: React.ReactNode;\n};\n\n/**\n * A default grid to use when arranging \"item cards\" - cards that let users\n * select among several options.\n *\n * @remarks\n * The immediate children are expected to be Material UI Card components.\n *\n * Styles for the grid can be overridden using the `classes` prop, e.g.:\n *\n * `<ItemCardGrid title=\"Hello\" classes={{ root: myClassName }} />`\n *\n * This can be useful for e.g. overriding gridTemplateColumns to adapt the\n * minimum size of the cells to fit the content better.\n *\n * @public\n */\nexport function ItemCardGrid(props: ItemCardGridProps) {\n const { children, ...otherProps } = props;\n const classes = useStyles(otherProps);\n return (\n <Box className={classes.root} {...otherProps}>\n {children}\n </Box>\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { BackstageTheme } from '@backstage/theme';\nimport Box from '@material-ui/core/Box';\nimport { createStyles, makeStyles, WithStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\n\n/** @public */\nexport type ItemCardHeaderClassKey = 'root';\n\nconst styles = (theme: BackstageTheme) =>\n createStyles({\n root: {\n color: theme.palette.common.white,\n padding: theme.spacing(2, 2, 3),\n backgroundImage: theme.getPageTheme({ themeId: 'card' }).backgroundImage,\n backgroundPosition: 0,\n backgroundSize: 'inherit',\n },\n });\n\nconst useStyles = makeStyles(styles, { name: 'BackstageItemCardHeader' });\n\n/** @public */\nexport type ItemCardHeaderProps = Partial<WithStyles<typeof styles>> & {\n /**\n * A large title to show in the header, providing the main heading.\n *\n * Use this if you want to have the default styling and placement of a title.\n */\n title?: React.ReactNode;\n /**\n * A slightly smaller title to show in the header, providing additional\n * details.\n *\n * Use this if you want to have the default styling and placement of a\n * subtitle.\n */\n subtitle?: React.ReactNode;\n /**\n * Custom children to draw in the header.\n *\n * If the title and/or subtitle were specified, the children are drawn below\n * those.\n */\n children?: React.ReactNode;\n};\n\n/**\n * A simple card header, rendering a default look for \"item cards\" - cards that\n * are arranged in a grid for users to select among several options.\n *\n * @remarks\n * This component expects to be placed within a Material UI `<CardMedia>`.\n *\n * Styles for the header can be overridden using the `classes` prop, e.g.:\n *\n * `<ItemCardHeader title=\"Hello\" classes={{ root: myClassName }} />`\n *\n * @public\n */\nexport function ItemCardHeader(props: ItemCardHeaderProps) {\n const { title, subtitle, children } = props;\n const classes = useStyles(props);\n return (\n <Box className={classes.root}>\n {subtitle && (\n <Typography variant=\"subtitle2\" component=\"h3\">\n {subtitle}\n </Typography>\n )}\n {title && (\n <Typography variant=\"h6\" component=\"h4\">\n {title}\n </Typography>\n )}\n {children}\n </Box>\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { rootDocsRouteRef } from '../../../routes';\nimport { toLowerMaybe } from '../../../helpers';\nimport { Entity } from '@backstage/catalog-model';\nimport { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';\nimport {\n LinkButton,\n ItemCardGrid,\n ItemCardHeader,\n} from '@backstage/core-components';\nimport { Card, CardActions, CardContent, CardMedia } from '@material-ui/core';\nimport React from 'react';\n\n/**\n * Props for {@link DocsCardGrid}\n *\n * @public\n */\nexport type DocsCardGridProps = {\n entities: Entity[] | undefined;\n};\n\n/**\n * Component which accepts a list of entities and renders a item card for each entity\n *\n * @public\n */\nexport const DocsCardGrid = (props: DocsCardGridProps) => {\n const { entities } = props;\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n if (!entities) return null;\n return (\n <ItemCardGrid data-testid=\"docs-explore\">\n {!entities?.length\n ? null\n : entities.map((entity, index: number) => (\n <Card key={index}>\n <CardMedia>\n <ItemCardHeader\n title={entity.metadata.title ?? entity.metadata.name}\n />\n </CardMedia>\n <CardContent>{entity.metadata.description}</CardContent>\n <CardActions>\n <LinkButton\n to={getRouteToReaderPageFor({\n namespace: toLowerMaybe(\n entity.metadata.namespace ?? 'default',\n config,\n ),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n })}\n color=\"primary\"\n data-testid=\"read_docs\"\n >\n Read Docs\n </LinkButton>\n </CardActions>\n </Card>\n ))}\n </ItemCardGrid>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Box from '@material-ui/core/Box';\nimport { makeStyles } from '@material-ui/core/styles';\nimport TabUI, { TabProps } from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport React, { useCallback, useEffect, useState } from 'react';\n\n// TODO(blam): Remove this implementation when the Tabs are ready\n// This is just a temporary solution to implementing tabs for now\n\n/** @public */\nexport type HeaderTabsClassKey =\n | 'tabsWrapper'\n | 'defaultTab'\n | 'selected'\n | 'tabRoot';\n\nconst useStyles = makeStyles(\n theme => ({\n tabsWrapper: {\n gridArea: 'pageSubheader',\n backgroundColor: theme.palette.background.paper,\n paddingLeft: theme.spacing(3),\n minWidth: 0,\n },\n defaultTab: {\n ...theme.typography.caption,\n padding: theme.spacing(3, 3),\n textTransform: 'uppercase',\n fontWeight: theme.typography.fontWeightBold,\n color: theme.palette.text.secondary,\n },\n selected: {\n color: theme.palette.text.primary,\n },\n tabRoot: {\n '&:hover': {\n backgroundColor: theme.palette.background.default,\n color: theme.palette.text.primary,\n },\n },\n }),\n { name: 'BackstageHeaderTabs' },\n);\n\nexport type Tab = {\n id: string;\n label: string;\n tabProps?: TabProps<React.ElementType, { component?: React.ElementType }>;\n};\n\ntype HeaderTabsProps = {\n tabs: Tab[];\n onChange?: (index: number) => void;\n selectedIndex?: number;\n};\n\n/**\n * Horizontal Tabs component\n *\n * @public\n *\n */\nexport function HeaderTabs(props: HeaderTabsProps) {\n const { tabs, onChange, selectedIndex } = props;\n const [selectedTab, setSelectedTab] = useState<number>(selectedIndex ?? 0);\n const styles = useStyles();\n\n const handleChange = useCallback(\n (_: React.ChangeEvent<{}>, index: number) => {\n if (selectedIndex === undefined) {\n setSelectedTab(index);\n }\n if (onChange) onChange(index);\n },\n [selectedIndex, onChange],\n );\n\n useEffect(() => {\n if (selectedIndex !== undefined) {\n setSelectedTab(selectedIndex);\n }\n }, [selectedIndex]);\n\n return (\n <Box className={styles.tabsWrapper}>\n <Tabs\n selectionFollowsFocus\n indicatorColor=\"primary\"\n textColor=\"inherit\"\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n aria-label=\"tabs\"\n onChange={handleChange}\n value={selectedTab}\n >\n {tabs.map((tab, index) => (\n <TabUI\n {...tab.tabProps}\n data-testid={`header-tab-${index}`}\n label={tab.label}\n key={tab.id}\n value={index}\n className={styles.defaultTab}\n classes={{ selected: styles.selected, root: styles.tabRoot }}\n />\n ))}\n </Tabs>\n </Box>\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useState } from 'react';\nimport useAsync from 'react-use/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"],"names":["useEntityOwnership","identityApi","useApi","identityApiRef","loading","value","refs","useAsync","ownershipEntityRefs","getBackstageIdentity","isOwnedEntity","useMemo","myOwnerRefs","Set","entity","entityOwnerRefs","getEntityRelations","RELATION_OWNED_BY","map","stringifyEntityRef","ref","has","styles","theme","createStyles","root","display","gridTemplateColumns","gridAutoRows","gridGap","spacing","useStyles","makeStyles","name","ItemCardGrid","props","children","otherProps","classes","Box","className","color","palette","common","white","padding","backgroundImage","getPageTheme","themeId","backgroundPosition","backgroundSize","ItemCardHeader","title","subtitle","Typography","variant","component","DocsCardGrid","entities","getRouteToReaderPageFor","useRouteRef","rootDocsRouteRef","config","configApiRef","data-testid","length","index","Card","CardMedia","metadata","CardContent","description","CardActions","LinkButton","to","namespace","toLowerMaybe","kind","tabsWrapper","gridArea","backgroundColor","background","paper","paddingLeft","minWidth","defaultTab","typography","caption","textTransform","fontWeight","fontWeightBold","text","secondary","selected","primary","tabRoot","default","HeaderTabs","tabs","onChange","selectedIndex","selectedTab","setSelectedTab","useState","handleChange","useCallback","_","undefined","useEffect","Tabs","selectionFollowsFocus","indicatorColor","textColor","scrollButtons","aria-label","tab","TabUI","tabProps","label","key","id","panels","DocsTable","CustomPanel","panelContainer","marginBottom","panelCSS","loadingOwnership","Panel","panelType","shownEntities","filter","filterPredicate","ContentHeader","SupportButton","div","TechDocsCustomHome","tabsConfig","catalogApi","catalogApiRef","error","getEntities","CATALOG_FILTER_EXISTS","fields","items","annotations","currentTabConfig","TechDocsPageWrapper","Content","Progress","WarningPanel","severity","CodeSnippet","language","toString"],"sourceRoot":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"static/5877.c521a57f.chunk.js","mappings":"yJAEIA,EAAyB,EAAQ,KAA8C,EAE/EC,EAA0B,EAAQ,KA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AAS,CACPC,OAAQ,GACRC,UAAW,GACXC,YAAa,SACb5G,OAAQ,GACRhD,QAAS,QACT6J,SAAU,EACVC,QAAS,GACTC,OAAQb,OAAOC,KAAKH,CAAM,EAAEI,OAAS,CACvC,C,IAKV,EC9DO,SAASY,EAAUzD,EAAgB,C,IACjCA,EACSA,EADhB,MAAOA,EAAAA,GAAAA,OAAAA,EAAAA,EAAQ0C,YAAQ,MAAhB1C,IAAAA,SAAAA,EAAkByC,OACrBE,OAAOC,KAAK5C,GAAAA,OAAAA,EAAAA,EAAQ0C,YAAQ,MAAhB1C,IAAAA,OAAAA,OAAAA,EAAkByC,MAAM,EAAEiB,KAAK/C,OAAO,EAClD,EACN,C","sources":["webpack://techdocs-cli-embedded-app/../../node_modules/@material-ui/icons/ArrowForward.js","webpack://techdocs-cli-embedded-app/../core-components/src/layout/BottomLink/BottomLink.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ErrorBoundary/ErrorBoundary.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/InfoCard/InfoCard.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/hooks/useEntity.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/EntityLabelsCard/EntityLabelsEmptyState.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/EntityLabelsCard/EntityLabelsCard.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/EntityLabelsCard/conditions.ts"],"sourcesContent":["\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nvar _interopRequireWildcard = require(\"@babel/runtime/helpers/interopRequireWildcard\");\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar React = _interopRequireWildcard(require(\"react\"));\n\nvar _createSvgIcon = _interopRequireDefault(require(\"./utils/createSvgIcon\"));\n\nvar _default = (0, _createSvgIcon.default)( /*#__PURE__*/React.createElement(\"path\", {\n d: \"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z\"\n}), 'ArrowForward');\n\nexports.default = _default;","/*\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 Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport ArrowIcon from '@material-ui/icons/ArrowForward';\nimport React from 'react';\nimport { Link } from '../../components/Link';\n\n/** @public */\nexport type BottomLinkClassKey = 'root' | 'boxTitle' | 'arrow';\n\nconst useStyles = makeStyles<BackstageTheme>(\n theme => ({\n root: {\n maxWidth: 'fit-content',\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n boxTitle: {\n margin: 0,\n color: theme.palette.textSubtle,\n },\n arrow: {\n color: theme.palette.textSubtle,\n },\n }),\n { name: 'BackstageBottomLink' },\n);\n\n/** @public */\nexport type BottomLinkProps = {\n link: string;\n title: string;\n onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;\n};\n\n/**\n * Footer with link used in {@link InfoCard } and {@link TabbedCard}\n *\n * @public\n *\n */\nexport function BottomLink(props: BottomLinkProps) {\n const { link, title, onClick } = props;\n const classes = useStyles();\n\n return (\n <Box>\n <Divider />\n <Link to={link} onClick={onClick} underline=\"none\">\n <Box display=\"flex\" alignItems=\"center\" className={classes.root}>\n <Box className={classes.boxTitle} fontWeight=\"fontWeightBold\" m={1}>\n <Typography>\n <strong>{title}</strong>\n </Typography>\n </Box>\n <ArrowIcon className={classes.arrow} />\n </Box>\n </Link>\n </Box>\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 Typography from '@material-ui/core/Typography';\nimport React, { ComponentClass, Component, ErrorInfo } from 'react';\nimport { LinkButton } from '../../components/LinkButton';\nimport { ErrorPanel } from '../../components/ErrorPanel';\n\ntype SlackChannel = {\n name: string;\n href?: string;\n};\n\n/** @public */\nexport type ErrorBoundaryProps = React.PropsWithChildren<{\n slackChannel?: string | SlackChannel;\n onError?: (error: Error, errorInfo: string) => null;\n}>;\n\ntype State = {\n error?: Error;\n errorInfo?: ErrorInfo;\n};\n\nconst SlackLink = (props: { slackChannel?: string | SlackChannel }) => {\n const { slackChannel } = props;\n\n if (!slackChannel) {\n return null;\n } else if (typeof slackChannel === 'string') {\n return <Typography>Please contact {slackChannel} for help.</Typography>;\n } else if (!slackChannel.href) {\n return (\n <Typography>Please contact {slackChannel.name} for help.</Typography>\n );\n }\n\n return (\n <LinkButton to={slackChannel.href} variant=\"contained\">\n {slackChannel.name}\n </LinkButton>\n );\n};\n\n/** @public */\nexport const ErrorBoundary: ComponentClass<\n ErrorBoundaryProps,\n State\n> = class ErrorBoundary extends Component<ErrorBoundaryProps, State> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = {\n error: undefined,\n errorInfo: undefined,\n };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n // eslint-disable-next-line no-console\n console.error(`ErrorBoundary, error: ${error}, info: ${errorInfo}`);\n this.setState({ error, errorInfo });\n }\n\n render() {\n const { slackChannel, children } = this.props;\n const { error } = this.state;\n\n if (!error) {\n return children;\n }\n\n return (\n <ErrorPanel title=\"Something Went Wrong\" error={error}>\n <SlackLink slackChannel={slackChannel} />\n </ErrorPanel>\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 Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader, { CardHeaderProps } from '@material-ui/core/CardHeader';\nimport Divider from '@material-ui/core/Divider';\nimport { makeStyles, withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport React, { ReactNode } from 'react';\nimport { BottomLink, BottomLinkProps } from '../BottomLink';\nimport { ErrorBoundary, ErrorBoundaryProps } from '../ErrorBoundary';\n\n/** @public */\nexport type InfoCardClassKey =\n | 'noPadding'\n | 'header'\n | 'headerTitle'\n | 'headerSubheader'\n | 'headerAvatar'\n | 'headerAction'\n | 'headerContent';\n\nconst useStyles = makeStyles(\n theme => ({\n noPadding: {\n padding: 0,\n '&:last-child': {\n paddingBottom: 0,\n },\n },\n header: {\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n headerTitle: {\n fontWeight: theme.typography.fontWeightBold,\n },\n headerSubheader: {\n paddingTop: theme.spacing(1),\n },\n headerAvatar: {},\n headerAction: {},\n headerContent: {},\n subheader: {\n display: 'flex',\n },\n }),\n { name: 'BackstageInfoCard' },\n);\n\n/** @public */\nexport type CardActionsTopRightClassKey = 'root';\n\nconst CardActionsTopRight = withStyles(\n theme => ({\n root: {\n display: 'inline-block',\n padding: theme.spacing(8, 8, 0, 0),\n float: 'right',\n },\n }),\n { name: 'BackstageInfoCardCardActionsTopRight' },\n)(CardActions);\n\nconst VARIANT_STYLES = {\n card: {\n flex: {\n display: 'flex',\n flexDirection: 'column',\n },\n fullHeight: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n },\n gridItem: {\n display: 'flex',\n flexDirection: 'column',\n height: 'calc(100% - 10px)', // for pages without content header\n marginBottom: '10px',\n breakInside: 'avoid-page',\n '@media print': {\n height: 'auto',\n },\n },\n },\n cardContent: {\n fullHeight: {\n flex: 1,\n },\n gridItem: {\n flex: 1,\n },\n },\n};\n\n/** @public */\nexport type InfoCardVariants = 'flex' | 'fullHeight' | 'gridItem';\n\n/**\n * InfoCard is used to display a paper-styled block on the screen, similar to a panel.\n *\n * You can custom style an InfoCard with the 'className' (outer container) and 'cardClassName' (inner container)\n * props. This is typically used with the material-ui makeStyles mechanism.\n *\n * The InfoCard serves as an error boundary. As a result, if you provide an 'errorBoundaryProps' property this\n * specifies the extra information to display in the error component that is displayed if an error occurs\n * in any descendent components.\n *\n * By default the InfoCard has no custom layout of its children, but is treated as a block element. A\n * couple common variants are provided and can be specified via the variant property:\n *\n * When the InfoCard is displayed as a grid item within a grid, you may want items to have the same height for all items.\n * Set to the 'gridItem' variant to display the InfoCard with full height suitable for Grid:\n *\n * `<InfoCard variant=\"gridItem\">...</InfoCard>`\n */\nexport type Props = {\n title?: ReactNode;\n subheader?: ReactNode;\n divider?: boolean;\n deepLink?: BottomLinkProps;\n /** @deprecated Use errorBoundaryProps instead */\n slackChannel?: string;\n errorBoundaryProps?: ErrorBoundaryProps;\n variant?: InfoCardVariants;\n children?: ReactNode;\n headerStyle?: object;\n headerProps?: CardHeaderProps;\n icon?: ReactNode;\n action?: ReactNode;\n actionsClassName?: string;\n actions?: ReactNode;\n cardClassName?: string;\n actionsTopRight?: ReactNode;\n className?: string;\n noPadding?: boolean;\n titleTypographyProps?: object;\n};\n\n/**\n * Material-ui card with header , content and actions footer\n *\n * @public\n *\n */\nexport function InfoCard(props: Props): JSX.Element {\n const {\n title,\n subheader,\n divider = true,\n deepLink,\n slackChannel,\n errorBoundaryProps,\n variant,\n children,\n headerStyle,\n headerProps,\n icon,\n action,\n actionsClassName,\n actions,\n cardClassName,\n actionsTopRight,\n className,\n noPadding,\n titleTypographyProps,\n } = props;\n const classes = useStyles();\n /**\n * If variant is specified, we build up styles for that particular variant for both\n * the Card and the CardContent (since these need to be synced)\n */\n let calculatedStyle = {};\n let calculatedCardStyle = {};\n if (variant) {\n const variants = variant.split(/[\\s]+/g);\n variants.forEach(name => {\n calculatedStyle = {\n ...calculatedStyle,\n ...VARIANT_STYLES.card[name as keyof (typeof VARIANT_STYLES)['card']],\n };\n calculatedCardStyle = {\n ...calculatedCardStyle,\n ...VARIANT_STYLES.cardContent[\n name as keyof (typeof VARIANT_STYLES)['cardContent']\n ],\n };\n });\n }\n\n const cardSubTitle = () => {\n if (!subheader && !icon) {\n return null;\n }\n\n return (\n <div\n className={classes.headerSubheader}\n data-testid=\"info-card-subheader\"\n >\n {subheader && <div className={classes.subheader}>{subheader}</div>}\n {icon}\n </div>\n );\n };\n\n const errProps: ErrorBoundaryProps =\n errorBoundaryProps || (slackChannel ? { slackChannel } : {});\n\n return (\n <Card style={calculatedStyle} className={className}>\n <ErrorBoundary {...errProps}>\n {title && (\n <CardHeader\n classes={{\n root: classes.header,\n title: classes.headerTitle,\n subheader: classes.headerSubheader,\n avatar: classes.headerAvatar,\n action: classes.headerAction,\n content: classes.headerContent,\n }}\n title={title}\n subheader={cardSubTitle()}\n action={action}\n style={{ ...headerStyle }}\n titleTypographyProps={titleTypographyProps}\n {...headerProps}\n />\n )}\n {actionsTopRight && (\n <CardActionsTopRight>{actionsTopRight}</CardActionsTopRight>\n )}\n {divider && <Divider />}\n <CardContent\n className={classNames(cardClassName, {\n [classes.noPadding]: noPadding,\n })}\n style={calculatedCardStyle}\n >\n {children}\n </CardContent>\n {actions && (\n <CardActions className={actionsClassName}>{actions}</CardActions>\n )}\n {deepLink && <BottomLink {...deepLink} />}\n </ErrorBoundary>\n </Card>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { 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 { 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 labels:\n javaVersion: 1.2.3`;\n\nconst useStyles = makeStyles<BackstageTheme>(\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: 'PluginCatalogEntityLabelsEmptyState' },\n);\n\nexport function EntityLabelsEmptyState() {\n const classes = useStyles();\n\n return (\n <>\n <Typography variant=\"body1\">\n No labels defined for this entity. You can add labels to your entity\n YAML 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#labels-optional\"\n >\n Read more\n </Button>\n </>\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 { useEntity } from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport {\n InfoCard,\n InfoCardVariants,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport { EntityLabelsEmptyState } from './EntityLabelsEmptyState';\nimport { makeStyles, Typography } from '@material-ui/core';\n\n/** @public */\nexport interface EntityLabelsCardProps {\n variant?: InfoCardVariants;\n title?: string;\n}\n\nconst useStyles = makeStyles(_ => ({\n key: {\n fontWeight: 'bold',\n },\n}));\n\nexport const EntityLabelsCard = (props: EntityLabelsCardProps) => {\n const { variant, title } = props;\n const { entity } = useEntity();\n const classes = useStyles();\n\n const columns: TableColumn<{ key: string; value: string }>[] = [\n {\n render: row => {\n return (\n <Typography className={classes.key} variant=\"body2\">\n {row.key}\n </Typography>\n );\n },\n },\n {\n field: 'value',\n },\n ];\n\n const labels = entity?.metadata?.labels;\n\n return (\n <InfoCard title={title || 'Labels'} variant={variant}>\n {!labels || Object.keys(labels).length === 0 ? (\n <EntityLabelsEmptyState />\n ) : (\n <Table\n columns={columns}\n data={Object.keys(labels).map(labelKey => ({\n key: labelKey,\n value: labels[labelKey],\n }))}\n options={{\n search: false,\n showTitle: true,\n loadingType: 'linear',\n header: false,\n padding: 'dense',\n pageSize: 5,\n toolbar: false,\n paging: Object.keys(labels).length > 5,\n }}\n />\n )}\n </InfoCard>\n );\n};\n","/*\n * Copyright 2023 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 { Entity } from '@backstage/catalog-model';\n\n/**\n * Returns true if the given entity has labels annotation given by the\n * catalog. For use by EntitySwitch\n *\n * @public\n */\nexport function hasLabels(entity: Entity) {\n return entity?.metadata?.labels\n ? Object.keys(entity?.metadata?.labels).some(Boolean)\n : false;\n}\n"],"names":["_interopRequireDefault","_interopRequireWildcard","exports","React","_createSvgIcon","_default","useStyles","makeStyles","theme","root","maxWidth","padding","spacing","boxTitle","margin","color","palette","textSubtle","arrow","name","BottomLink","props","link","title","onClick","classes","Box","Divider","Link","to","underline","display","alignItems","className","fontWeight","m","Typography","strong","ArrowIcon","SlackLink","slackChannel","href","LinkButton","variant","ErrorBoundary","Component","componentDidCatch","error","errorInfo","console","setState","render","children","state","ErrorPanel","constructor","undefined","noPadding","paddingBottom","header","headerTitle","typography","fontWeightBold","headerSubheader","paddingTop","headerAvatar","headerAction","headerContent","subheader","CardActionsTopRight","withStyles","float","CardActions","VARIANT_STYLES","card","flex","flexDirection","fullHeight","height","gridItem","marginBottom","breakInside","cardContent","InfoCard","divider","deepLink","errorBoundaryProps","headerStyle","headerProps","icon","action","actionsClassName","actions","cardClassName","actionsTopRight","titleTypographyProps","calculatedStyle","calculatedCardStyle","split","forEach","cardSubTitle","div","data-testid","errProps","Card","style","CardHeader","avatar","content","CardContent","classNames","NewEntityContext","createVersionedContext","AsyncEntityProvider","entity","loading","refresh","value","Provider","createVersionedValueMap","AnalyticsContext","attributes","entityRef","stringifyEntityRef","EntityProvider","Boolean","useEntity","versionedHolder","useVersionedContext","Error","atVersion","useAsyncEntity","ENTITY_YAML","code","borderRadius","background","type","common","white","EntityLabelsEmptyState","CodeSnippet","text","language","showLineNumbers","highlightedNumbers","customStyle","fontSize","Button","target","_","key","EntityLabelsCard","columns","row","field","labels","metadata","Object","keys","length","Table","data","map","labelKey","options","search","showTitle","loadingType","pageSize","toolbar","paging","hasLabels","some"],"sourceRoot":""}