@techdocs/cli 1.8.25 → 1.9.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.
- package/CHANGELOG.md +16 -0
- package/README.md +2 -1
- package/dist/commands/index.cjs.js +13 -7
- package/dist/commands/index.cjs.js.map +1 -1
- package/dist/embedded-app/.config-schema.json +178 -46
- package/dist/embedded-app/index.html +1 -1
- package/dist/embedded-app/index.html.tmpl +1 -1
- package/dist/embedded-app/static/{124.f02a9318.chunk.js → 124.9c3315bf.chunk.js} +2 -2
- package/dist/embedded-app/static/{124.f02a9318.chunk.js.map → 124.9c3315bf.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{2401.4d69c234.chunk.js → 2401.480d3231.chunk.js} +2 -2
- package/dist/embedded-app/static/{2401.4d69c234.chunk.js.map → 2401.480d3231.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{2420.979e1d31.chunk.js → 2420.02740444.chunk.js} +2 -2
- package/dist/embedded-app/static/{2420.979e1d31.chunk.js.map → 2420.02740444.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{287.e0b65890.chunk.js → 287.0a1ae361.chunk.js} +2 -2
- package/dist/embedded-app/static/{287.e0b65890.chunk.js.map → 287.0a1ae361.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{3182.0ac241c5.chunk.js → 3182.8be35725.chunk.js} +2 -2
- package/dist/embedded-app/static/{3182.0ac241c5.chunk.js.map → 3182.8be35725.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{3632.f343436e.chunk.js → 3632.75f621ce.chunk.js} +2 -2
- package/dist/embedded-app/static/{3632.f343436e.chunk.js.map → 3632.75f621ce.chunk.js.map} +1 -1
- package/dist/embedded-app/static/5470.1a28734c.chunk.js +3 -0
- package/dist/embedded-app/static/5470.1a28734c.chunk.js.map +1 -0
- package/dist/embedded-app/static/{5788.b8d84f8c.chunk.js → 5788.cd9a99f1.chunk.js} +1 -1
- package/dist/embedded-app/static/5788.cd9a99f1.chunk.js.map +1 -0
- package/dist/embedded-app/static/{6271.020ea145.chunk.js → 6271.1007bfa8.chunk.js} +2 -2
- package/dist/embedded-app/static/{6271.020ea145.chunk.js.map → 6271.1007bfa8.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{6415.493349e2.chunk.js → 6415.8cce89fe.chunk.js} +2 -2
- package/dist/embedded-app/static/{6415.493349e2.chunk.js.map → 6415.8cce89fe.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{8307.b0a2a85f.chunk.js → 8307.cf92a830.chunk.js} +2 -2
- package/dist/embedded-app/static/{8307.b0a2a85f.chunk.js.map → 8307.cf92a830.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{8384.b9605cda.chunk.js → 8384.604de781.chunk.js} +2 -2
- package/dist/embedded-app/static/{8384.b9605cda.chunk.js.map → 8384.604de781.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{8803.20e0d00b.chunk.js → 8803.511872f8.chunk.js} +1 -1
- package/dist/embedded-app/static/{8803.20e0d00b.chunk.js.map → 8803.511872f8.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{9652.78fa0c73.chunk.js → 9652.be70f990.chunk.js} +2 -2
- package/dist/embedded-app/static/{9652.78fa0c73.chunk.js.map → 9652.be70f990.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{main.01d08696.js → main.a2e1e30a.js} +27 -27
- package/dist/embedded-app/static/main.a2e1e30a.js.map +1 -0
- package/dist/embedded-app/static/{module-material-table.84f30b2f.js → module-material-table.d6e8d890.js} +2 -2
- package/dist/embedded-app/static/{module-material-table.84f30b2f.js.map → module-material-table.d6e8d890.js.map} +1 -1
- package/dist/embedded-app/static/module-material-ui.b24ef3a3.js +24 -0
- package/dist/embedded-app/static/module-material-ui.b24ef3a3.js.map +1 -0
- package/dist/embedded-app/static/{react-syntax-highlighter_languages_highlight_lisp.4f6018a3.chunk.js → react-syntax-highlighter_languages_highlight_lisp.75c1c83e.chunk.js} +2 -2
- package/dist/embedded-app/static/{react-syntax-highlighter_languages_highlight_lisp.4f6018a3.chunk.js.map → react-syntax-highlighter_languages_highlight_lisp.75c1c83e.chunk.js.map} +1 -1
- package/dist/embedded-app/static/{runtime.01d08696.js → runtime.a2e1e30a.js} +2 -2
- package/dist/embedded-app/static/{runtime.01d08696.js.map → runtime.a2e1e30a.js.map} +1 -1
- package/dist/embedded-app/static/{vendor.01d08696.js → vendor.a2e1e30a.js} +43 -43
- package/dist/embedded-app/static/vendor.a2e1e30a.js.map +1 -0
- package/dist/lib/PublisherConfig.cjs.js +4 -1
- package/dist/lib/PublisherConfig.cjs.js.map +1 -1
- package/dist/package.json.cjs.js +1 -1
- package/package.json +7 -7
- package/dist/embedded-app/static/4487.f04b8beb.chunk.js +0 -3
- package/dist/embedded-app/static/4487.f04b8beb.chunk.js.map +0 -1
- package/dist/embedded-app/static/5788.b8d84f8c.chunk.js.map +0 -1
- package/dist/embedded-app/static/main.01d08696.js.map +0 -1
- package/dist/embedded-app/static/module-material-ui.909829ed.js +0 -24
- package/dist/embedded-app/static/module-material-ui.909829ed.js.map +0 -1
- package/dist/embedded-app/static/vendor.01d08696.js.map +0 -1
|
@@ -59,7 +59,10 @@ class PublisherConfig {
|
|
|
59
59
|
...opts.awsEndpoint && { endpoint: opts.awsEndpoint },
|
|
60
60
|
...opts.awsS3ForcePathStyle && { s3ForcePathStyle: true },
|
|
61
61
|
...opts.awsS3sse && { sse: opts.awsS3sse },
|
|
62
|
-
...opts.awsProxy && { httpsProxy: opts.awsProxy }
|
|
62
|
+
...opts.awsProxy && { httpsProxy: opts.awsProxy },
|
|
63
|
+
...opts.awsMaxAttempts && {
|
|
64
|
+
maxAttempts: Number(opts.awsMaxAttempts)
|
|
65
|
+
}
|
|
63
66
|
}
|
|
64
67
|
};
|
|
65
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublisherConfig.cjs.js","sources":["../../src/lib/PublisherConfig.ts"],"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 { ConfigReader } from '@backstage/config';\nimport { OptionValues } from 'commander';\n\ntype Publisher = keyof (typeof PublisherConfig)['configFactories'];\ntype PublisherConfiguration = {\n [p in Publisher]?: any;\n} & {\n type: Publisher;\n};\n\n/**\n * Helper when working with publisher-related configurations.\n */\nexport class PublisherConfig {\n /**\n * Maps publisher-specific config keys to config getters.\n */\n private static configFactories = {\n awsS3: PublisherConfig.getValidAwsS3Config,\n azureBlobStorage: PublisherConfig.getValidAzureConfig,\n googleGcs: PublisherConfig.getValidGoogleGcsConfig,\n openStackSwift: PublisherConfig.getValidOpenStackSwiftConfig,\n };\n\n /**\n * Returns Backstage config suitable for use when instantiating a Publisher. If\n * there are any missing or invalid options provided, an error is thrown.\n *\n * Note: This assumes that proper credentials are set in Environment\n * variables for the respective GCS/AWS clients to work.\n */\n static getValidConfig(opts: OptionValues): ConfigReader {\n const publisherType = opts.publisherType;\n\n if (!PublisherConfig.isKnownPublisher(publisherType)) {\n throw new Error(`Unknown publisher type ${opts.publisherType}`);\n }\n\n return new ConfigReader({\n // This backend config is not used at all. Just something needed a create a mock discovery instance.\n backend: {\n baseUrl: 'http://localhost:7007',\n listen: {\n port: 7007,\n },\n },\n techdocs: {\n publisher: PublisherConfig.configFactories[publisherType](opts),\n legacyUseCaseSensitiveTripletPaths:\n opts.legacyUseCaseSensitiveTripletPaths,\n },\n });\n }\n\n /**\n * Typeguard to ensure the publisher has a known config getter.\n */\n private static isKnownPublisher(\n type: string,\n ): type is keyof (typeof PublisherConfig)['configFactories'] {\n return PublisherConfig.configFactories.hasOwnProperty(type);\n }\n\n /**\n * Retrieve valid AWS S3 configuration based on the command.\n */\n private static getValidAwsS3Config(\n opts: OptionValues,\n ): PublisherConfiguration {\n return {\n type: 'awsS3',\n awsS3: {\n bucketName: opts.storageName,\n ...(opts.awsBucketRootPath && {\n bucketRootPath: opts.awsBucketRootPath,\n }),\n ...(opts.awsRoleArn && { credentials: { roleArn: opts.awsRoleArn } }),\n ...(opts.awsEndpoint && { endpoint: opts.awsEndpoint }),\n ...(opts.awsS3ForcePathStyle && { s3ForcePathStyle: true }),\n ...(opts.awsS3sse && { sse: opts.awsS3sse }),\n ...(opts.awsProxy && { httpsProxy: opts.awsProxy }),\n },\n };\n }\n\n /**\n * Retrieve valid Azure Blob Storage configuration based on the command.\n */\n private static getValidAzureConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n if (!opts.azureAccountName) {\n throw new Error(\n `azureBlobStorage requires --azureAccountName to be specified`,\n );\n }\n\n return {\n type: 'azureBlobStorage',\n azureBlobStorage: {\n containerName: opts.storageName,\n credentials: {\n accountName: opts.azureAccountName,\n accountKey: opts.azureAccountKey,\n },\n },\n };\n }\n\n /**\n * Retrieve valid GCS configuration based on the command.\n */\n private static getValidGoogleGcsConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n return {\n type: 'googleGcs',\n googleGcs: {\n bucketName: opts.storageName,\n ...(opts.gcsBucketRootPath && {\n bucketRootPath: opts.gcsBucketRootPath,\n }),\n },\n };\n }\n\n /**\n * Retrieves valid OpenStack Swift configuration based on the command.\n */\n private static getValidOpenStackSwiftConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n const missingParams = [\n 'osCredentialId',\n 'osSecret',\n 'osAuthUrl',\n 'osSwiftUrl',\n ].filter((param: string) => !opts[param]);\n\n if (missingParams.length) {\n throw new Error(\n `openStackSwift requires the following params to be specified: ${missingParams.join(\n ', ',\n )}`,\n );\n }\n\n return {\n type: 'openStackSwift',\n openStackSwift: {\n containerName: opts.storageName,\n credentials: {\n id: op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AAA,QACL,YAAY,IAAK,CAAA,WAAA;AAAA,QACjB,GAAI,KAAK,iBAAqB,IAAA;AAAA,UAC5B,gBAAgB,IAAK,CAAA;AAAA,SACvB;AAAA,QACA,GAAI,KAAK,UAAc,IAAA,EAAE,aAAa,EAAE,OAAA,EAAS,IAAK,CAAA,UAAA,EAAa,EAAA;AAAA,QACnE,GAAI,IAAK,CAAA,WAAA,IAAe,EAAE,QAAA,EAAU,KAAK,WAAY,EAAA;AAAA,QACrD,GAAI,IAAA,CAAK,mBAAuB,IAAA,EAAE,kBAAkB,IAAK,EAAA;AAAA,QACzD,GAAI,IAAK,CAAA,QAAA,IAAY,EAAE,GAAA,EAAK,KAAK,QAAS,EAAA;AAAA,QAC1C,GAAI,IAAK,CAAA,QAAA,IAAY,EAAE,UAAA,EAAY,KAAK,QAAS;AAAA;
|
|
1
|
+
{"version":3,"file":"PublisherConfig.cjs.js","sources":["../../src/lib/PublisherConfig.ts"],"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 { ConfigReader } from '@backstage/config';\nimport { OptionValues } from 'commander';\n\ntype Publisher = keyof (typeof PublisherConfig)['configFactories'];\ntype PublisherConfiguration = {\n [p in Publisher]?: any;\n} & {\n type: Publisher;\n};\n\n/**\n * Helper when working with publisher-related configurations.\n */\nexport class PublisherConfig {\n /**\n * Maps publisher-specific config keys to config getters.\n */\n private static configFactories = {\n awsS3: PublisherConfig.getValidAwsS3Config,\n azureBlobStorage: PublisherConfig.getValidAzureConfig,\n googleGcs: PublisherConfig.getValidGoogleGcsConfig,\n openStackSwift: PublisherConfig.getValidOpenStackSwiftConfig,\n };\n\n /**\n * Returns Backstage config suitable for use when instantiating a Publisher. If\n * there are any missing or invalid options provided, an error is thrown.\n *\n * Note: This assumes that proper credentials are set in Environment\n * variables for the respective GCS/AWS clients to work.\n */\n static getValidConfig(opts: OptionValues): ConfigReader {\n const publisherType = opts.publisherType;\n\n if (!PublisherConfig.isKnownPublisher(publisherType)) {\n throw new Error(`Unknown publisher type ${opts.publisherType}`);\n }\n\n return new ConfigReader({\n // This backend config is not used at all. Just something needed a create a mock discovery instance.\n backend: {\n baseUrl: 'http://localhost:7007',\n listen: {\n port: 7007,\n },\n },\n techdocs: {\n publisher: PublisherConfig.configFactories[publisherType](opts),\n legacyUseCaseSensitiveTripletPaths:\n opts.legacyUseCaseSensitiveTripletPaths,\n },\n });\n }\n\n /**\n * Typeguard to ensure the publisher has a known config getter.\n */\n private static isKnownPublisher(\n type: string,\n ): type is keyof (typeof PublisherConfig)['configFactories'] {\n return PublisherConfig.configFactories.hasOwnProperty(type);\n }\n\n /**\n * Retrieve valid AWS S3 configuration based on the command.\n */\n private static getValidAwsS3Config(\n opts: OptionValues,\n ): PublisherConfiguration {\n return {\n type: 'awsS3',\n awsS3: {\n bucketName: opts.storageName,\n ...(opts.awsBucketRootPath && {\n bucketRootPath: opts.awsBucketRootPath,\n }),\n ...(opts.awsRoleArn && { credentials: { roleArn: opts.awsRoleArn } }),\n ...(opts.awsEndpoint && { endpoint: opts.awsEndpoint }),\n ...(opts.awsS3ForcePathStyle && { s3ForcePathStyle: true }),\n ...(opts.awsS3sse && { sse: opts.awsS3sse }),\n ...(opts.awsProxy && { httpsProxy: opts.awsProxy }),\n ...(opts.awsMaxAttempts && {\n maxAttempts: Number(opts.awsMaxAttempts),\n }),\n },\n };\n }\n\n /**\n * Retrieve valid Azure Blob Storage configuration based on the command.\n */\n private static getValidAzureConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n if (!opts.azureAccountName) {\n throw new Error(\n `azureBlobStorage requires --azureAccountName to be specified`,\n );\n }\n\n return {\n type: 'azureBlobStorage',\n azureBlobStorage: {\n containerName: opts.storageName,\n credentials: {\n accountName: opts.azureAccountName,\n accountKey: opts.azureAccountKey,\n },\n },\n };\n }\n\n /**\n * Retrieve valid GCS configuration based on the command.\n */\n private static getValidGoogleGcsConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n return {\n type: 'googleGcs',\n googleGcs: {\n bucketName: opts.storageName,\n ...(opts.gcsBucketRootPath && {\n bucketRootPath: opts.gcsBucketRootPath,\n }),\n },\n };\n }\n\n /**\n * Retrieves valid OpenStack Swift configuration based on the command.\n */\n private static getValidOpenStackSwiftConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n const missingParams = [\n 'osCredentialId',\n 'osSecret',\n 'osAuthUrl',\n 'osSwiftUrl',\n ].filter((param: string) => !opts[param]);\n\n if (missingParams.length) {\n throw new Error(\n `openStackSwift requires the following params to be specified: ${missingParams.join(\n ', ',\n )}`,\n );\n }\n\n return {\n type: 'openStackSwift',\n openStackSwift: {\n containerName: opts.storageName,\n credentials: {\n id: opts.osCredentialId,\n secret: opts.osSecret,\n },\n authUrl: opts.osAuthUrl,\n swiftUrl: opts.osSwiftUrl,\n },\n };\n }\n}\n"],"names":["ConfigReader"],"mappings":";;;;AA6BO,MAAM,eAAgB,CAAA;AAAA;AAAA;AAAA;AAAA,EAI3B,OAAe,eAAkB,GAAA;AAAA,IAC/B,OAAO,eAAgB,CAAA,mBAAA;AAAA,IACvB,kBAAkB,eAAgB,CAAA,mBAAA;AAAA,IAClC,WAAW,eAAgB,CAAA,uBAAA;AAAA,IAC3B,gBAAgB,eAAgB,CAAA;AAAA,GAClC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,OAAO,eAAe,IAAkC,EAAA;AACtD,IAAA,MAAM,gBAAgB,IAAK,CAAA,aAAA;AAE3B,IAAA,IAAI,CAAC,eAAA,CAAgB,gBAAiB,CAAA,aAAa,CAAG,EAA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a,EAAA;AAAA,UACX,IAAI,IAAK,CAAA,cAAA;AAAA,UACT,QAAQ,IAAK,CAAA;AAAA,SACf;AAAA,QACA,SAAS,IAAK,CAAA,SAAA;AAAA,QACd,UAAU,IAAK,CAAA;AAAA;AACjB,KACF;AAAA;AAEJ;;;;"}
|
package/dist/package.json.cjs.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@techdocs/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0-next.0",
|
|
4
4
|
"description": "Utility CLI for managing TechDocs sites in Backstage.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "cli"
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"watch": "./src"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@backstage/backend-defaults": "
|
|
48
|
-
"@backstage/catalog-model": "
|
|
49
|
-
"@backstage/cli-common": "
|
|
50
|
-
"@backstage/config": "
|
|
51
|
-
"@backstage/plugin-techdocs-node": "
|
|
47
|
+
"@backstage/backend-defaults": "0.8.0-next.0",
|
|
48
|
+
"@backstage/catalog-model": "1.7.3",
|
|
49
|
+
"@backstage/cli-common": "0.1.15",
|
|
50
|
+
"@backstage/config": "1.3.2",
|
|
51
|
+
"@backstage/plugin-techdocs-node": "1.13.0-next.0",
|
|
52
52
|
"commander": "^12.0.0",
|
|
53
53
|
"fs-extra": "^11.0.0",
|
|
54
54
|
"global-agent": "^3.0.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"winston": "^3.2.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@backstage/cli": "
|
|
61
|
+
"@backstage/cli": "0.30.0-next.0",
|
|
62
62
|
"@types/commander": "^2.12.2",
|
|
63
63
|
"@types/fs-extra": "^11.0.0",
|
|
64
64
|
"@types/http-proxy": "^1.17.4",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[4487],{94487:(dt,y,t)=>{t.r(y),t.d(y,{TechDocsCustomHome:()=>rt});var a=t(31085),u=t(14041),j=t(73466),h=t(58837),P=t(51372),B=t(6820),p=t(72427),I=t(16009),R=t(67871);function H(){const e=(0,p.gf)(I.K),{loading:r,value:s}=(0,j.A)(async()=>{const{ownershipEntityRefs:o}=await e.getBackstageIdentity();return o},[]),n=(0,u.useMemo)(()=>{const o=new Set(s??[]);return l=>{const i=(0,R.t)(l,P.vv).map(B.U2);for(const c of i)if(o.has(c))return!0;return!1}},[s]);return{loading:r,isOwnedEntity:n}}var D=t(21405),E=t(7341),b=t(86519),O=t(27125),W=t(82779),f=t(95768),U=t(9222),G=t(65461),v=t(10394),A=t(12398);const N=e=>(0,A.A)({root:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(22em, 1fr))",gridAutoRows:"1fr",gridGap:e.spacing(2)}}),V=(0,h.A)(N,{name:"BackstageItemCardGrid"});function z(e){const{children:r,...s}=e,n=V(s);return(0,a.jsx)(v.A,{className:n.root,...s,children:r})}var S=t(72501);const L=e=>(0,A.A)({root:{color:e.palette.common.white,padding:e.spacing(2,2,3),backgroundImage:e.getPageTheme({themeId:"card"}).backgroundImage,backgroundPosition:0,backgroundSize:"inherit"}}),F=(0,h.A)(L,{name:"BackstageItemCardHeader"});function M(e){const{title:r,subtitle:s,children:n}=e,o=F(e);return(0,a.jsxs)(v.A,{className:o.root,children:[s&&(0,a.jsx)(S.A,{variant:"subtitle2",component:"h3",children:s}),r&&(0,a.jsx)(S.A,{variant:"h6",component:"h4",children:r}),n]})}var $=t(73896),K=t(40703),Y=t(59469),J=t(48653),Q=t(57369);const X=e=>{const{entities:r}=e,s=(0,U.S)(W.Oc),n=(0,p.gf)(G.U);return r?(0,a.jsx)(z,{"data-testid":"docs-explore",children:r?.length?r.map((o,l)=>(0,a.jsxs)(K.A,{children:[(0,a.jsx)(Q.A,{children:(0,a.jsx)(M,{title:o.metadata.title??o.metadata.name})}),(0,a.jsx)(J.A,{children:o.metadata.description}),(0,a.jsx)(Y.A,{children:(0,a.jsx)($.z,{to:s({namespace:(0,f.V)(o.metadata.namespace??"default",n),kind:(0,f.V)(o.kind,n),name:(0,f.V)(o.metadata.name,n)}),color:"primary","data-testid":"read_docs",children:"Read Docs"})})]},l)):null}):null};var x=t(81859),Z=t(59428),k=t(27586),C=t(26280),w=t(68146),q=t(88640),_=t(77310),tt=t(38605),et=t(31653);const at=(0,h.A)(e=>({tabsWrapper:{gridArea:"pageSubheader",backgroundColor:e.palette.background.paper,paddingLeft:e.spacing(3),minWidth:0},defaultTab:{...e.typography.caption,padding:e.spacing(3,3),textTransform:"uppercase",fontWeight:e.typography.fontWeightBold,color:e.palette.text.secondary},selected:{color:e.palette.text.primary},tabRoot:{"&:hover":{backgroundColor:e.palette.background.default,color:e.palette.text.primary}}}),{name:"BackstageHeaderTabs"});function st(e){const{tabs:r,onChange:s,selectedIndex:n}=e,[o,l]=(0,u.useState)(n??0),i=at(),c=(0,u.useCallback)((m,d)=>{n===void 0&&l(d),s&&s(d)},[n,s]);return(0,u.useEffect)(()=>{n!==void 0&&l(n)},[n]),(0,a.jsx)(v.A,{className:i.tabsWrapper,children:(0,a.jsx)(et.A,{indicatorColor:"primary",textColor:"inherit",variant:"scrollable",scrollButtons:"auto","aria-label":"tabs",onChange:c,value:o,children:r.map((m,d)=>(0,a.jsx)(tt.A,{"data-testid":`header-tab-${d}`,label:m.label,value:d,className:i.defaultTab,classes:{selected:i.selected,root:i.tabRoot},...m.tabProps},m.id))})})}var T=t(86202);const nt={DocsTable:O.o,DocsCardGrid:X},ot=({config:e,entities:r,index:s})=>{const o=(0,h.A)({panelContainer:{marginBottom:"2rem",...e.panelCSS?e.panelCSS:{}}})(),{loading:l,isOwnedEntity:i}=H(),c=nt[e.panelType],m=r.filter(d=>e.filterPredicate==="ownedByUser"?l?!1:i(d):typeof e.filterPredicate=="function"&&e.filterPredicate(d));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Z.d,{title:e.title,description:e.description,children:s===0?(0,a.jsx)(k.Y,{children:"Discover documentation in your ecosystem."}):null}),(0,a.jsx)("div",{className:o.panelContainer,children:(0,a.jsx)(D.B9,{children:(0,a.jsx)(c,{"data-testid":"techdocs-custom-panel",entities:m})})})]})},rt=e=>{const{tabsConfig:r}=e,[s,n]=(0,u.useState)(0),o=(0,p.gf)(E.v),{value:l,loading:i,error:c}=(0,j.A)(async()=>(await o.getEntities({filter:{[`metadata.annotations.${T.A}`]:b.c},fields:["apiVersion","kind","metadata","relations","spec.owner","spec.type"]})).items.filter(g=>!!g.metadata.annotations?.[T.A])),m=r[s];return i?(0,a.jsx)(x.S,{children:(0,a.jsx)(C.U,{children:(0,a.jsx)(w.k,{})})}):c?(0,a.jsx)(x.S,{children:(0,a.jsx)(C.U,{children:(0,a.jsx)(q.B,{severity:"error",title:"Could not load available documentation.",children:(0,a.jsx)(_.z,{language:"text",text:c.toString()})})})}):(0,a.jsxs)(x.S,{children:[(0,a.jsx)(st,{selectedIndex:s,onChange:d=>n(d),tabs:r.map(({label:d},g)=>({id:g.toString(),label:d}))}),(0,a.jsx)(C.U,{"data-testid":"techdocs-content",children:m.panels.map((d,g)=>(0,a.jsx)(ot,{config:d,entities:l||[],index:g},g))})]})}}}]);})();
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=4487.f04b8beb.chunk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static/4487.f04b8beb.chunk.js","mappings":"8RAoCO,SAASA,GAAAA,CAId,MAAMC,KAAcC,EAAAA,IAAOC,EAAAA,CAAcA,EAGnC,CAAEC,QAAAA,EAASC,MAAOC,CAAK,KAAIC,EAAAA,GAC/B,UACE,KAAM,CAAEC,oBAAAA,CAAoB,EAAI,MAAMP,EAAYQ,qBAAqB,EACvE,OAAOD,CACT,EAEA,CAAC,CAA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ACeC,MAAMf,OAAQnH,GACrB,CAAC,CAACA,EAAOuD,SAAS4E,cAAcJ,EAAAA,CAAmBA,CAC3D,CACF,EAEKK,EAAmBV,EAAWnC,CAAW,EAE/C,OAAIjG,KAEA,OAAC+I,EAAAA,EAAmBA,C,YAClB,OAACC,EAAAA,EAAOA,C,YACN,OAACC,EAAAA,EAAQA,CAAAA,CAAAA,C,KAMbV,KAEA,OAACQ,EAAAA,EAAmBA,C,YAClB,OAACC,EAAAA,EAAOA,C,YACN,OAACE,EAAAA,EAAYA,CACXC,SAAS,QACTnG,MAAM,0C,YAEN,OAACoG,EAAAA,EAAWA,CAACC,SAAS,OAAO9D,KAAMgD,EAAMe,SAAS,C,YAQ1D,QAACP,EAAAA,EAAmBA,C,aAClB,OAAClD,GAAUA,CACTG,cAAeC,EACfF,SAAUjC,GAASoC,EAAepC,CAAK,EACvCgC,KAAMsC,EAAWtH,IAAI,CAAC,CAAEkG,MAAAA,CAAM,EAAGlD,KAAW,CAC1CoD,GAAIpD,EAAMwF,SAAS,EACnBtC,MAAAA,CACF,EAAE,C,MAEJ,OAACgC,EAAAA,EAAOA,CAACpF,cAAY,mB,SAClBkF,EAAiB3B,OAAOrG,IAAI,CAAC4C,EAAQI,OACpC,OAACuD,GAAAA,CAEC3D,OAAQA,EACRJ,SAAYA,GAAsB,CAAC,EACnCQ,MAAOA,C,EAHFA,CAAK,CAALA,C,KASjB,C","sources":["webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/hooks/useEntityOwnership.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ItemCard/ItemCardGrid.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ItemCard/ItemCardHeader.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/Grids/DocsCardGrid.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/HeaderTabs/HeaderTabs.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/TechDocsCustomHome.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Entity,\n RELATION_OWNED_BY,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { getEntityRelations } from '../utils/getEntityRelations';\n\n/**\n * Returns a function that checks whether the currently signed-in user is an\n * owner of a given entity. When the hook is initially mounted, the loading\n * flag will be true and the results returned from the function will always be\n * false.\n *\n * @public\n *\n * @returns a function that checks if the signed in user owns an entity\n */\nexport function useEntityOwnership(): {\n loading: boolean;\n isOwnedEntity: (entity: Entity) => boolean;\n} {\n const identityApi = useApi(identityApiRef);\n\n // Trigger load only on mount\n const { loading, value: refs } = useAsync(\n async () => {\n const { ownershipEntityRefs } = await identityApi.getBackstageIdentity();\n return ownershipEntityRefs;\n },\n // load only on mount\n [],\n );\n\n const isOwnedEntity = useMemo(() => {\n const myOwnerRefs = new Set(refs ?? []);\n\n return (entity: Entity) => {\n const entityOwnerRefs = getEntityRelations(entity, RELATION_OWNED_BY).map(\n stringifyEntityRef,\n );\n for (const ref of entityOwnerRefs) {\n if (myOwnerRefs.has(ref)) {\n return true;\n }\n }\n return false;\n };\n }, [refs]);\n\n return { loading, isOwnedEntity };\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Box from '@material-ui/core/Box';\nimport {\n createStyles,\n makeStyles,\n Theme,\n WithStyles,\n} from '@material-ui/core/styles';\nimport React from 'react';\n\n/** @public */\nexport type ItemCardGridClassKey = 'root';\n\nconst styles = (theme: Theme) =>\n createStyles({\n root: {\n display: 'grid',\n gridTemplateColumns: 'repeat(auto-fill, minmax(22em, 1fr))',\n gridAutoRows: '1fr',\n gridGap: theme.spacing(2),\n },\n });\n\nconst useStyles = makeStyles(styles, { name: 'BackstageItemCardGrid' });\n\n/** @public */\nexport type ItemCardGridProps = Partial<WithStyles<typeof styles>> & {\n /**\n * The Card items of the grid.\n */\n children?: React.ReactNode;\n};\n\n/**\n * A default grid to use when arranging \"item cards\" - cards that let users\n * select among several options.\n *\n * @remarks\n * The immediate children are expected to be Material UI Card components.\n *\n * Styles for the grid can be overridden using the `classes` prop, e.g.:\n *\n * `<ItemCardGrid title=\"Hello\" classes={{ root: myClassName }} />`\n *\n * This can be useful for e.g. overriding gridTemplateColumns to adapt the\n * minimum size of the cells to fit the content better.\n *\n * @public\n */\nexport function ItemCardGrid(props: ItemCardGridProps) {\n const { children, ...otherProps } = props;\n const classes = useStyles(otherProps);\n return (\n <Box className={classes.root} {...otherProps}>\n {children}\n </Box>\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport {\n createStyles,\n makeStyles,\n Theme,\n WithStyles,\n} from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\n\n/** @public */\nexport type ItemCardHeaderClassKey = 'root';\n\nconst styles = (theme: Theme) =>\n createStyles({\n root: {\n color: theme.palette.common.white,\n padding: theme.spacing(2, 2, 3),\n backgroundImage: theme.getPageTheme({ themeId: 'card' }).backgroundImage,\n backgroundPosition: 0,\n backgroundSize: 'inherit',\n },\n });\n\nconst useStyles = makeStyles(styles, { name: 'BackstageItemCardHeader' });\n\n/** @public */\nexport type ItemCardHeaderProps = Partial<WithStyles<typeof styles>> & {\n /**\n * A large title to show in the header, providing the main heading.\n *\n * Use this if you want to have the default styling and placement of a title.\n */\n title?: React.ReactNode;\n /**\n * A slightly smaller title to show in the header, providing additional\n * details.\n *\n * Use this if you want to have the default styling and placement of a\n * subtitle.\n */\n subtitle?: React.ReactNode;\n /**\n * Custom children to draw in the header.\n *\n * If the title and/or subtitle were specified, the children are drawn below\n * those.\n */\n children?: React.ReactNode;\n};\n\n/**\n * A simple card header, rendering a default look for \"item cards\" - cards that\n * are arranged in a grid for users to select among several options.\n *\n * @remarks\n * This component expects to be placed within a Material UI `<CardMedia>`.\n *\n * Styles for the header can be overridden using the `classes` prop, e.g.:\n *\n * `<ItemCardHeader title=\"Hello\" classes={{ root: myClassName }} />`\n *\n * @public\n */\nexport function ItemCardHeader(props: ItemCardHeaderProps) {\n const { title, subtitle, children } = props;\n const classes = useStyles(props);\n return (\n <Box className={classes.root}>\n {subtitle && (\n <Typography variant=\"subtitle2\" component=\"h3\">\n {subtitle}\n </Typography>\n )}\n {title && (\n <Typography variant=\"h6\" component=\"h4\">\n {title}\n </Typography>\n )}\n {children}\n </Box>\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { rootDocsRouteRef } from '../../../routes';\nimport { toLowerMaybe } from '../../../helpers';\nimport { Entity } from '@backstage/catalog-model';\nimport { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';\nimport {\n LinkButton,\n ItemCardGrid,\n ItemCardHeader,\n} from '@backstage/core-components';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardMedia from '@material-ui/core/CardMedia';\nimport React from 'react';\n\n/**\n * Props for {@link DocsCardGrid}\n *\n * @public\n */\nexport type DocsCardGridProps = {\n entities: Entity[] | undefined;\n};\n\n/**\n * Component which accepts a list of entities and renders a item card for each entity\n *\n * @public\n */\nexport const DocsCardGrid = (props: DocsCardGridProps) => {\n const { entities } = props;\n const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);\n const config = useApi(configApiRef);\n if (!entities) return null;\n return (\n <ItemCardGrid data-testid=\"docs-explore\">\n {!entities?.length\n ? null\n : entities.map((entity, index: number) => (\n <Card key={index}>\n <CardMedia>\n <ItemCardHeader\n title={entity.metadata.title ?? entity.metadata.name}\n />\n </CardMedia>\n <CardContent>{entity.metadata.description}</CardContent>\n <CardActions>\n <LinkButton\n to={getRouteToReaderPageFor({\n namespace: toLowerMaybe(\n entity.metadata.namespace ?? 'default',\n config,\n ),\n kind: toLowerMaybe(entity.kind, config),\n name: toLowerMaybe(entity.metadata.name, config),\n })}\n color=\"primary\"\n data-testid=\"read_docs\"\n >\n Read Docs\n </LinkButton>\n </CardActions>\n </Card>\n ))}\n </ItemCardGrid>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Box from '@material-ui/core/Box';\nimport { makeStyles } from '@material-ui/core/styles';\nimport TabUI, { TabProps } from '@material-ui/core/Tab';\nimport Tabs from '@material-ui/core/Tabs';\nimport React, { useCallback, useEffect, useState } from 'react';\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 indicatorColor=\"primary\"\n textColor=\"inherit\"\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n aria-label=\"tabs\"\n onChange={handleChange}\n value={selectedTab}\n >\n {tabs.map((tab, index) => (\n <TabUI\n data-testid={`header-tab-${index}`}\n label={tab.label}\n key={tab.id}\n value={index}\n className={styles.defaultTab}\n classes={{ selected: styles.selected, root: styles.tabRoot }}\n {...tab.tabProps}\n />\n ))}\n </Tabs>\n </Box>\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CSSProperties } from '@material-ui/styles/withStyles';\nimport {\n CATALOG_FILTER_EXISTS,\n catalogApiRef,\n CatalogApi,\n useEntityOwnership,\n EntityListProvider,\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';\nimport { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common';\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 <EntityListProvider>\n <Panel data-testid=\"techdocs-custom-panel\" entities={shownEntities} />\n </EntityListProvider>\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.${TECHDOCS_ANNOTATION}`]: 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?.[TECHDOCS_ANNOTATION];\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","indicatorColor","textColor","scrollButtons","aria-label","tab","TabUI","label","tabProps","id","panels","DocsTable","CustomPanel","panelContainer","marginBottom","panelCSS","loadingOwnership","Panel","panelType","shownEntities","filter","filterPredicate","ContentHeader","SupportButton","div","EntityListProvider","TechDocsCustomHome","tabsConfig","catalogApi","catalogApiRef","error","getEntities","TECHDOCS_ANNOTATION","CATALOG_FILTER_EXISTS","fields","items","annotations","currentTabConfig","TechDocsPageWrapper","Content","Progress","WarningPanel","severity","CodeSnippet","language","toString"],"sourceRoot":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static/5788.b8d84f8c.chunk.js","mappings":"oOAwCO,MAAMA,EAAqBC,MACjBC,EAAAA,IAAU,MAER,OAACC,EAAAA,EAAmBA,CAAE,GAAGF,C","sources":["webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/TechDocsIndexPage.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 React from 'react';\nimport { useOutlet } from 'react-router-dom';\nimport { TableColumn, TableProps } from '@backstage/core-components';\nimport {\n EntityListPagination,\n EntityOwnerPickerProps,\n UserListFilterKind,\n} from '@backstage/plugin-catalog-react';\nimport { DefaultTechDocsHome } from './DefaultTechDocsHome';\nimport { DocsTableRow } from './Tables';\n\n/**\n * Props for {@link TechDocsIndexPage}\n *\n * @public\n */\nexport type TechDocsIndexPageProps = {\n initialFilter?: UserListFilterKind;\n columns?: TableColumn<DocsTableRow>[];\n actions?: TableProps<DocsTableRow>['actions'];\n ownerPickerMode?: EntityOwnerPickerProps['mode'];\n pagination?: EntityListPagination;\n};\n\nexport const TechDocsIndexPage = (props: TechDocsIndexPageProps) => {\n const outlet = useOutlet();\n\n return outlet || <DefaultTechDocsHome {...props} />;\n};\n"],"names":["TechDocsIndexPage","props","useOutlet","DefaultTechDocsHome"],"sourceRoot":""}
|