@techdocs/cli 0.0.0-nightly-20230926021154 → 0.0.0-nightly-20230928021117
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 +18 -4
- package/README.md +0 -35
- package/dist/embedded-app/.config-schema.json +48 -48
- package/dist/embedded-app/index.html +1 -1
- package/dist/embedded-app/static/1600.1ec85d5a.chunk.js +3 -0
- package/dist/embedded-app/static/1600.1ec85d5a.chunk.js.map +1 -0
- package/dist/embedded-app/static/7670.4e34a90d.chunk.js +3 -0
- package/dist/embedded-app/static/7670.4e34a90d.chunk.js.map +1 -0
- package/dist/embedded-app/static/967.9162e72e.chunk.js +11 -0
- package/dist/embedded-app/static/967.9162e72e.chunk.js.map +1 -0
- package/dist/embedded-app/static/main.f5e1dbac.js +487 -0
- package/dist/embedded-app/static/main.f5e1dbac.js.map +1 -0
- package/dist/embedded-app/static/{runtime.56fdb28b.js → runtime.f5e1dbac.js} +2 -2
- package/dist/embedded-app/static/{runtime.56fdb28b.js.map → runtime.f5e1dbac.js.map} +1 -1
- package/dist/embedded-app/static/{vendor.56fdb28b.js → vendor.f5e1dbac.js} +1 -1
- package/dist/embedded-app/static/{vendor.56fdb28b.js.map → vendor.f5e1dbac.js.map} +1 -1
- package/dist/index.cjs.js +1 -1
- package/package.json +7 -10
- package/dist/embedded-app/static/7670.92d46a70.chunk.js +0 -3
- package/dist/embedded-app/static/7670.92d46a70.chunk.js.map +0 -1
- package/dist/embedded-app/static/9598.8d7b672f.chunk.js +0 -3
- package/dist/embedded-app/static/9598.8d7b672f.chunk.js.map +0 -1
- package/dist/embedded-app/static/967.d4e6a27e.chunk.js +0 -15
- package/dist/embedded-app/static/967.d4e6a27e.chunk.js.map +0 -1
- package/dist/embedded-app/static/main.56fdb28b.js +0 -487
- package/dist/embedded-app/static/main.56fdb28b.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
# @techdocs/cli
|
|
2
2
|
|
|
3
|
-
## 0.0.0-nightly-
|
|
3
|
+
## 0.0.0-nightly-20230928021117
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- de42eebaafc5: Bumped dev dependencies `@types/node` and `mock-fs`.
|
|
8
|
+
- 2b6e5720515c: Restructured tests.
|
|
8
9
|
- Updated dependencies
|
|
9
|
-
- @backstage/cli-common@0.0.0-nightly-
|
|
10
|
-
- @backstage/backend-common@0.0.0-nightly-
|
|
11
|
-
- @backstage/plugin-techdocs-node@0.0.0-nightly-
|
|
10
|
+
- @backstage/cli-common@0.0.0-nightly-20230928021117
|
|
11
|
+
- @backstage/backend-common@0.0.0-nightly-20230928021117
|
|
12
|
+
- @backstage/plugin-techdocs-node@0.0.0-nightly-20230928021117
|
|
13
|
+
- @backstage/config@1.1.0
|
|
12
14
|
- @backstage/catalog-model@1.4.2
|
|
15
|
+
|
|
16
|
+
## 1.5.2-next.0
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- de42eebaaf: Bumped dev dependencies `@types/node` and `mock-fs`.
|
|
21
|
+
- 2b6e572051: Restructured tests.
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @backstage/cli-common@0.1.13-next.0
|
|
24
|
+
- @backstage/backend-common@0.19.7-next.0
|
|
25
|
+
- @backstage/plugin-techdocs-node@1.8.2-next.0
|
|
13
26
|
- @backstage/config@1.1.0
|
|
27
|
+
- @backstage/catalog-model@1.4.2
|
|
14
28
|
|
|
15
29
|
## 1.5.0
|
|
16
30
|
|
package/README.md
CHANGED
|
@@ -75,38 +75,3 @@ pip install mkdocs-techdocs-core
|
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
Then run `yarn test`.
|
|
78
|
-
|
|
79
|
-
#### Cypress (Integration and Visual regression) tests
|
|
80
|
-
|
|
81
|
-
Running cypress tests requires you to run the CLI locally against our example docs.
|
|
82
|
-
|
|
83
|
-
Run the local version of techdocs-cli against the example docs:
|
|
84
|
-
|
|
85
|
-
```sh
|
|
86
|
-
# From the root of this repository run
|
|
87
|
-
# NOTE: This will build the techdocs-cli-embedded-app and copy the output into the cli dist directory
|
|
88
|
-
yarn build --scope @techdocs/cli
|
|
89
|
-
|
|
90
|
-
# Navigate to the example project
|
|
91
|
-
cd packages/techdocs-cli/src/example-docs
|
|
92
|
-
|
|
93
|
-
# Now execute the techdocs-cli serve command
|
|
94
|
-
../../bin/techdocs-cli serve
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
In another shell, run the cypress tests:
|
|
98
|
-
|
|
99
|
-
```sh
|
|
100
|
-
# From the root of the project, navigate to the techdocs-cli package
|
|
101
|
-
cd packages/techdocs-cli
|
|
102
|
-
|
|
103
|
-
# Run tests
|
|
104
|
-
yarn test:cypress
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
This will launch a cypress app where you can run the two different tests:
|
|
108
|
-
|
|
109
|
-
- `backstage_serve` - will run against the backstage server
|
|
110
|
-
- `mkdocs_serve` - will run test against the mkdocs server
|
|
111
|
-
|
|
112
|
-
> If its the first time you run Cypress, it will run a "Verifying Cypress can run" step. This step can result in a "Cypress verification timed out" error. If that is the case, let the verification step run and then run the command again and it should succeed.
|
|
@@ -368,54 +368,6 @@
|
|
|
368
368
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
369
369
|
}
|
|
370
370
|
},
|
|
371
|
-
{
|
|
372
|
-
"path": "../../plugins/techdocs/config.d.ts",
|
|
373
|
-
"value": {
|
|
374
|
-
"type": "object",
|
|
375
|
-
"properties": {
|
|
376
|
-
"techdocs": {
|
|
377
|
-
"description": "Configuration options for the techdocs plugin",
|
|
378
|
-
"type": "object",
|
|
379
|
-
"properties": {
|
|
380
|
-
"builder": {
|
|
381
|
-
"description": "Documentation building process depends on the builder attr",
|
|
382
|
-
"visibility": "frontend",
|
|
383
|
-
"enum": [
|
|
384
|
-
"external",
|
|
385
|
-
"local"
|
|
386
|
-
],
|
|
387
|
-
"type": "string"
|
|
388
|
-
},
|
|
389
|
-
"legacyUseCaseSensitiveTripletPaths": {
|
|
390
|
-
"description": "Allows fallback to case-sensitive triplets in case of migration issues.",
|
|
391
|
-
"visibility": "frontend",
|
|
392
|
-
"type": "boolean"
|
|
393
|
-
},
|
|
394
|
-
"sanitizer": {
|
|
395
|
-
"type": "object",
|
|
396
|
-
"properties": {
|
|
397
|
-
"allowedIframeHosts": {
|
|
398
|
-
"description": "Allows iframe tag only for listed hosts\nExample:\n allowedIframeHosts: [\"example.com\"]\n this will allow all iframes with the host `example.com` in the src attribute",
|
|
399
|
-
"visibility": "frontend",
|
|
400
|
-
"type": "array",
|
|
401
|
-
"items": {
|
|
402
|
-
"type": "string"
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
},
|
|
408
|
-
"required": [
|
|
409
|
-
"builder"
|
|
410
|
-
]
|
|
411
|
-
}
|
|
412
|
-
},
|
|
413
|
-
"required": [
|
|
414
|
-
"techdocs"
|
|
415
|
-
],
|
|
416
|
-
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
371
|
{
|
|
420
372
|
"path": "../integration/config.d.ts",
|
|
421
373
|
"value": {
|
|
@@ -828,6 +780,54 @@
|
|
|
828
780
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
829
781
|
}
|
|
830
782
|
},
|
|
783
|
+
{
|
|
784
|
+
"path": "../../plugins/techdocs/config.d.ts",
|
|
785
|
+
"value": {
|
|
786
|
+
"type": "object",
|
|
787
|
+
"properties": {
|
|
788
|
+
"techdocs": {
|
|
789
|
+
"description": "Configuration options for the techdocs plugin",
|
|
790
|
+
"type": "object",
|
|
791
|
+
"properties": {
|
|
792
|
+
"builder": {
|
|
793
|
+
"description": "Documentation building process depends on the builder attr",
|
|
794
|
+
"visibility": "frontend",
|
|
795
|
+
"enum": [
|
|
796
|
+
"external",
|
|
797
|
+
"local"
|
|
798
|
+
],
|
|
799
|
+
"type": "string"
|
|
800
|
+
},
|
|
801
|
+
"legacyUseCaseSensitiveTripletPaths": {
|
|
802
|
+
"description": "Allows fallback to case-sensitive triplets in case of migration issues.",
|
|
803
|
+
"visibility": "frontend",
|
|
804
|
+
"type": "boolean"
|
|
805
|
+
},
|
|
806
|
+
"sanitizer": {
|
|
807
|
+
"type": "object",
|
|
808
|
+
"properties": {
|
|
809
|
+
"allowedIframeHosts": {
|
|
810
|
+
"description": "Allows iframe tag only for listed hosts\nExample:\n allowedIframeHosts: [\"example.com\"]\n this will allow all iframes with the host `example.com` in the src attribute",
|
|
811
|
+
"visibility": "frontend",
|
|
812
|
+
"type": "array",
|
|
813
|
+
"items": {
|
|
814
|
+
"type": "string"
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
},
|
|
820
|
+
"required": [
|
|
821
|
+
"builder"
|
|
822
|
+
]
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
"required": [
|
|
826
|
+
"techdocs"
|
|
827
|
+
],
|
|
828
|
+
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
831
|
{
|
|
832
832
|
"path": "../backend-common/config.d.ts",
|
|
833
833
|
"value": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Backstage is an open platform for building developer portals"/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.ico"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/><title>Techdocs Preview App</title><script defer="defer" src="/static/runtime.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Backstage is an open platform for building developer portals"/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.ico"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/><title>Techdocs Preview App</title><script defer="defer" src="/static/runtime.f5e1dbac.js"></script><script defer="defer" src="/static/module-material-ui.1b712255.js"></script><script defer="defer" src="/static/module-lodash.8166f005.js"></script><script defer="defer" src="/static/module-date-fns.b8b6c380.js"></script><script defer="defer" src="/static/module-material-table.0f5635dd.js"></script><script defer="defer" src="/static/module-react-dom.07625e59.js"></script><script defer="defer" src="/static/module-react-router.8e9755f1.js"></script><script defer="defer" src="/static/module-react-router-dom.a0f835fd.js"></script><script defer="defer" src="/static/module-zod.c74c6842.js"></script><script defer="defer" src="/static/module-i18next.db8a27ed.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.62627182.js"></script><script defer="defer" src="/static/vendor.f5e1dbac.js"></script><script defer="defer" src="/static/main.f5e1dbac.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[1600],{59119:function(vt,B,t){t.d(B,{O:function(){return H}});var n=t(52322),v=t(79692),I=t(80030),z=t(2784),U=t(15277),N=t.n(U),$=t(29862);const W=(0,v.Z)({container:{overflow:"visible !important"}},{name:"BackstageOverflowTooltip"});function H(T){const[V,b]=(0,z.useState)(!1),Q=(0,$.t)(),E=W(),G=O=>{Q()&&b(O)};var M;return(0,n.jsx)(I.ZP,{title:(M=T.title)!==null&&M!==void 0?M:T.text||"",placement:T.placement,disableHoverListener:!V,children:(0,n.jsx)(N(),{text:T.text,line:T.line,onToggled:G,containerClassName:E.container})})}},51600:function(vt,B,t){t.r(B),t.d(B,{CatalogPage:function(){return re},DefaultCatalogPage:function(){return dt}});var n=t(52322),v=t(2784),I=t(73557),z=t(32166),U=t(42398),N=t(30706),$=t(77277),W=t(61837),H=t(41156),T=t(71597),V=t(88188);function b(e){const{title:l,to:a}=e,s=(0,H.Z)(d=>d.breakpoints.down("xs"));return a?s?(0,n.jsx)(W.Z,{component:T.rU,color:"primary",title:l,size:"small",to:a,children:(0,n.jsx)(V.Z,{})}):(0,n.jsx)($.Z,{component:T.rU,variant:"contained",color:"primary",to:a,children:l}):null}var Q=t(13788),E=t(44394),G=t(6542),M=t(37321),O=t(25942),X=t(30389),k=t(35879),w=t(78847),Y=t(62774),F=t(4967),q=t(64279),_=t(88624);function mt(){const e=(0,E.h_)(_.A),{error:l,loading:a,value:s}=(0,q.default)(async()=>await e.getEntityFacets({facets:["kind"]}).then(i=>{var c;return((c=i.facets.kind)===null||c===void 0?void 0:c.map(o=>o.value).sort())||[]}),[e]);return{loading:a,error:l,allKinds:s!=null?s:[]}}function ft(e,l,a){let s=e;return l&&(s=s.filter(i=>l.some(c=>c.toLocaleLowerCase("en-US")===i.toLocaleLowerCase("en-US")))),a&&!e.some(i=>i.toLocaleLowerCase("en-US")===a.toLocaleLowerCase("en-US"))&&(s=s.concat([a])),s.sort().reduce((i,c)=>(i[c.toLocaleLowerCase("en-US")]=c,i),{})}function pt(e){var l;const{filters:a,queryParameters:{kind:s},updateFilters:d}=(0,O.wp)(),i=(0,v.useMemo)(()=>[s].flat()[0],[s]);var c;const[o,r]=(0,v.useState)((c=i!=null?i:(l=a.kind)===null||l===void 0?void 0:l.value)!==null&&c!==void 0?c:e.initialFilter);(0,v.useEffect)(()=>{i&&r(i)},[i]),(0,v.useEffect)(()=>{var P;if(!((P=a.kind)===null||P===void 0)&&P.value){var S;r((S=a.kind)===null||S===void 0?void 0:S.value)}},[a.kind]),(0,v.useEffect)(()=>{d({kind:o?new F.zo(o):void 0})},[o,d]);const{allKinds:u,loading:m,error:p}=mt();return{loading:m,error:p,allKinds:u!=null?u:[],selectedKind:o,setSelectedKind:r}}const yt=e=>{const{allowedKinds:l,hidden:a,initialFilter:s="component"}=e,d=(0,E.h_)(w.$),{error:i,allKinds:c,selectedKind:o,setSelectedKind:r}=pt({initialFilter:s});if((0,v.useEffect)(()=>{i&&d.post({message:"Failed to load entity kinds",severity:"error"})},[i,d]),i)return null;const u=ft(c,l,o),m=Object.keys(u).map(p=>({value:p,label:u[p]}));return a?null:(0,n.jsx)(Y.Z,{pb:1,pt:1,children:(0,n.jsx)(k.H,{label:"Kind",items:m,selected:o.toLocaleLowerCase("en-US"),onChange:p=>r(String(p))})})};var gt=t(18149),ht=t.n(gt),Ct=t(829),xt=t.n(Ct);function St(){const e=(0,E.h_)(_.A),{filters:{kind:l,type:a},queryParameters:{type:s},updateFilters:d}=(0,O.wp)(),i=(0,v.useMemo)(()=>[s].flat().filter(Boolean),[s]);var c;const[o,r]=(0,v.useState)(i.length?i:(c=a==null?void 0:a.getTypes())!==null&&c!==void 0?c:[]);(0,v.useEffect)(()=>{i.length&&r(i)},[i]);const[u,m]=(0,v.useState)([]),p=(0,v.useMemo)(()=>l==null?void 0:l.value,[l]),{error:P,loading:S,value:x}=(0,q.default)(async()=>p?await e.getEntityFacets({filter:{kind:p},facets:["spec.type"]}).then(A=>A.facets["spec.type"]||[]):[],[p,e]),j=(0,v.useRef)(x);return(0,v.useEffect)(()=>{const R=j.current;if(j.current=x,S||!p||R===x||!x)return;const A=[...new Set(xt()(x,L=>-L.count).map(L=>L.value.toLocaleLowerCase("en-US")))];m(A);const K=o.filter(L=>A.includes(L));ht()(o,K)||r(K)},[S,p,o,r,x]),(0,v.useEffect)(()=>{d({type:o.length?new F.Bf(o):void 0})},[o,d]),{loading:S,error:P,availableTypes:u,selectedTypes:o,setSelectedTypes:r}}const jt=e=>{const{hidden:l,initialFilter:a}=e,s=(0,E.h_)(w.$),{error:d,availableTypes:i,selectedTypes:c,setSelectedTypes:o}=St();if((0,v.useEffect)(()=>{d&&s.post({message:"Failed to load entity types",severity:"error"}),a&&o([a])},[d,s,a,o]),i.length===0||d)return null;const r=[{value:"all",label:"all"},...i.map(m=>({value:m,label:m}))];var u;return l?null:(0,n.jsx)(Y.Z,{pb:1,pt:1,children:(0,n.jsx)(k.H,{label:"Type",items:r,selected:(u=r.length>1?c[0]:void 0)!==null&&u!==void 0?u:"all",onChange:m=>o(m==="all"?[]:[String(m)])})})};var Et=t(23433),Tt=t(63833),J=t(79692),tt=t(77605);const Pt=(0,J.Z)({input:{}},{name:"CatalogReactEntityLifecyclePicker"}),Ot=e=>{const{initialFilter:l=[]}=e,a=Pt();return(0,n.jsx)(tt.K,{label:"Lifecycle",name:"lifecycles",path:"spec.lifecycle",Filter:F.zH,InputProps:{className:a.input},initialSelectedOptions:l})};var Lt=t(97894),D=t(90436),Ft=t(5806),At=t(21324),Kt=t(86619),Mt=t(19996),Zt=t(25505),Rt=t(38016),Bt=t(88013);const Dt=(0,J.Z)({input:{}},{name:"CatalogReactEntityProcessingStatusPickerPicker"}),It=(0,n.jsx)(Zt.Z,{fontSize:"small"}),zt=(0,n.jsx)(Mt.Z,{fontSize:"small"}),Ut=()=>{const e=Dt(),{updateFilters:l}=(0,O.wp)(),[a,s]=(0,v.useState)([]);function d(o){l({orphan:o?new F.mM(o):void 0})}function i(o){l({error:o?new F.A5(o):void 0})}const c=["Is Orphan","Has Error"];return(0,n.jsx)(Y.Z,{pb:1,pt:1,children:(0,n.jsxs)(D.Z,{variant:"button",component:"label",children:["Processing Status",(0,n.jsx)(Bt.ZP,{multiple:!0,disableCloseOnSelect:!0,options:c,value:a,onChange:(o,r)=>{s(r),d(r.includes("Is Orphan")),i(r.includes("Has Error"))},renderOption:(o,{selected:r})=>(0,n.jsx)(Ft.Z,{control:(0,n.jsx)(At.Z,{icon:It,checkedIcon:zt,checked:r}),onClick:u=>u.preventDefault(),label:o}),size:"small",popupIcon:(0,n.jsx)(Rt.Z,{"data-testid":"processing-status-picker-expand"}),renderInput:o=>(0,n.jsx)(Kt.Z,{...o,className:e.input,variant:"outlined"})})]})})},Nt=(0,J.Z)({input:{}},{name:"CatalogReactEntityNamespacePicker"}),$t=()=>{const e=Nt();return(0,n.jsx)(tt.K,{label:"Namespace",name:"namespace",path:"metadata.namespace",Filter:F.Qe,InputProps:{className:e.input}})};var Wt=t(65524),et=t(34106),nt=t(8709),Ht=t(538),Vt=t(9791),bt=t(84462),Z=t(86540),Qt=t(42870),at=t(75435),Gt=t(15459),Xt=t(27604),Yt=t(2997),Jt=t(11640),kt=t(28347),wt=t(76635),qt=t(41748),lt=t(68138),st=t(7089),it=t(59119);const h=Object.freeze({createNameColumn(e){function l(a){var s;return((s=a.metadata)===null||s===void 0?void 0:s.title)||(0,Z.$)(a,{defaultKind:e==null?void 0:e.defaultKind})}return{title:"Name",field:"resolved.name",highlight:!0,customSort({entity:a},{entity:s}){return l(a).localeCompare(l(s))},render:({entity:a})=>{var s;return(0,n.jsx)(qt.d,{entityRef:a,defaultKind:(e==null?void 0:e.defaultKind)||"Component",title:(s=a.metadata)===null||s===void 0?void 0:s.title})}}},createSystemColumn(){return{title:"System",field:"resolved.partOfSystemRelationTitle",render:({resolved:e})=>(0,n.jsx)(lt.r,{entityRefs:e.partOfSystemRelations,defaultKind:"system"})}},createOwnerColumn(){return{title:"Owner",field:"resolved.ownedByRelationsTitle",render:({resolved:e})=>(0,n.jsx)(lt.r,{entityRefs:e.ownedByRelations,defaultKind:"group"})}},createSpecTargetsColumn(){return{title:"Targets",field:"entity.spec.targets",render:({entity:e})=>{var l,a;return(0,n.jsx)(n.Fragment,{children:((e==null||(l=e.spec)===null||l===void 0?void 0:l.targets)||(e==null||(a=e.spec)===null||a===void 0?void 0:a.target))&&(0,n.jsx)(it.O,{text:(e.spec.targets||[e.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:e})=>(0,n.jsx)(it.O,{text:e.metadata.description,placement:"bottom-start"}),width:"auto"}},createTagsColumn(){return{title:"Tags",field:"entity.metadata.tags",cellStyle:{padding:"0px 16px 0px 20px"},render:({entity:e})=>(0,n.jsx)(n.Fragment,{children:e.metadata.tags&&e.metadata.tags.map(l=>(0,n.jsx)(st.Z,{label:l,size:"small",variant:"outlined",style:{marginBottom:"0px"}},l))}),width:"auto"}},createTitleColumn(e){return{title:"Title",field:"entity.metadata.title",hidden:e==null?void 0:e.hidden,searchable:!0}},createLabelColumn(e,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,i=d&&d[e]||(l==null?void 0:l.defaultValue);return(0,n.jsx)(n.Fragment,{children:i&&(0,n.jsx)(st.Z,{label:i,size:"small",variant:"outlined"},i)})},width:"auto"}},createNamespaceColumn(){return{title:"Namespace",field:"entity.metadata.namespace",width:"auto"}}});var _t=t(19928),te=t.n(_t);const ee=(0,Gt.Z)({root:{color:"#f3ba37"}})(Jt.Z),ne=(e,l)=>{const a=s=>s.metadata.title||(0,Z.$)(s,{defaultKind:"Component"});return a(e).localeCompare(a(l))},ot=e=>{var l,a,s,d;const{columns:i,actions:c,tableOptions:o,subtitle:r,emptyContent:u}=e,{isStarredEntity:m,toggleStarredEntity:p}=(0,Qt.C)(),{loading:P,error:S,entities:x,filters:j}=(0,O.wp)(),R=(0,v.useMemo)(()=>{var f;return[h.createTitleColumn({hidden:!0}),h.createNameColumn({defaultKind:(f=j.kind)===null||f===void 0?void 0:f.value}),...g(),h.createMetadataDescriptionColumn(),h.createTagsColumn()];function g(){var y;const C=[h.createSystemColumn(),h.createOwnerColumn(),h.createSpecTypeColumn(),h.createSpecLifecycleColumn()];switch((y=j.kind)===null||y===void 0?void 0:y.value){case"user":return[];case"domain":case"system":return[h.createOwnerColumn()];case"group":case"template":return[h.createSpecTypeColumn()];case"location":return[h.createSpecTypeColumn(),h.createSpecTargetsColumn()];default:return x.every(fe=>fe.metadata.namespace==="default")?C:[...C,h.createNamespaceColumn()]}}},[(l=j.kind)===null||l===void 0?void 0:l.value,x]),A=j.type===void 0;var K;const L=(0,wt.capitalize)((K=(a=j.user)===null||a===void 0?void 0:a.value)!==null&&K!==void 0?K:"all");if(S)return(0,n.jsx)("div",{children:(0,n.jsx)(Ht.G,{severity:"error",title:"Could not fetch catalog entities.",children:(0,n.jsx)(Vt.O,{language:"text",text:S.toString()})})});const de=[({entity:f})=>{var g;const y=(g=f.metadata.annotations)===null||g===void 0?void 0:g[et.l2],C="View";return{icon:()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(D.Z,{variant:"srOnly",children:C}),(0,n.jsx)(Yt.Z,{fontSize:"small"})]}),tooltip:C,disabled:!y,onClick:()=>{y&&window.open(y,"_blank")}}},({entity:f})=>{var g;const y=(g=f.metadata.annotations)===null||g===void 0?void 0:g[et.Tf],C="Edit";return{icon:()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(D.Z,{variant:"srOnly",children:C}),(0,n.jsx)(Xt.Z,{fontSize:"small"})]}),tooltip:C,disabled:!y,onClick:()=>{y&&window.open(y,"_blank")}}},({entity:f})=>{const g=m(f),y=g?"Remove from favorites":"Add to favorites";return{cellStyle:{paddingLeft:"1em"},icon:()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(D.Z,{variant:"srOnly",children:y}),g?(0,n.jsx)(ee,{}):(0,n.jsx)(kt.Z,{})]}),tooltip:y,onClick:()=>p(f)}}],ct=x.sort(ne).map(f=>{const g=(0,at.h)(f,nt.cz,{kind:"system"}),y=(0,at.h)(f,nt.S4);return{entity:f,resolved:{name:(0,Z.$)(f,{defaultKind:"Component"}),ownedByRelationsTitle:y.map(C=>(0,Z.$)(C,{defaultKind:"group"})).join(", "),ownedByRelations:y,partOfSystemRelationTitle:g.map(C=>(0,Z.$)(C,{defaultKind:"system"})).join(", "),partOfSystemRelations:g}}}),ut=(i||R).find(f=>f.title==="Type");ut&&(ut.hidden=!A);const ce=ct.length>20,ue=((s=j.kind)===null||s===void 0?void 0:s.value)||"",ve=((d=j.type)===null||d===void 0?void 0:d.value)||"",me=[L,ve,te()(ue)].filter(f=>f).join(" ");return(0,n.jsx)(bt.i,{isLoading:P,columns:i||R,options:{paging:ce,pageSize:20,actionsColumnIndex:-1,loadingType:"linear",showEmptyDataSourceMessage:!P,padding:"dense",pageSizeOptions:[20,50,100],...o},title:`${me} (${x.length})`,data:ct,actions:c||de,subtitle:r,emptyContent:u})};ot.columns=h;var ae=t(35304);const le=(0,ae.F)({id:"catalog",messages:{catalog_page_title:"{{orgName}} Catalog",catalog_page_create_button_title:"Create"}});var se=t(58513),ie=t(96253);const rt=new WeakSet,oe=e=>{const l=(0,E.h_)(se.V),a=(0,E.h_)(ie.o),[s,d]=(0,v.useState)(()=>a.getTranslation(e)),i=(0,v.useMemo)(()=>a.translation$(e),[a,e]),c=(0,v.useCallback)(r=>{if(!rt.has(e)){const u=`Failed to load translation resource '${e.id}'; caused by ${r}`;console.error(u),l.post(new Error(u)),rt.add(e)}},[l,e]);(0,v.useEffect)(()=>{const r=i.subscribe({next(u){u.ready&&d(u)},error(u){c(u)}});return()=>{r.unsubscribe()}},[i,c]);const o=(0,v.useRef)(!0);if((0,v.useEffect)(()=>{o.current?o.current=!1:d(a.getTranslation(e))},[a,e]),!s.ready)throw new Promise(r=>{const u=i.subscribe({next(m){m.ready&&(u.unsubscribe(),r())},error(m){u.unsubscribe(),c(m),r()}})});return{t:s.t}};function dt(e){const{columns:l,actions:a,initiallySelectedFilter:s="owned",initialKind:d="component",tableOptions:i={},emptyContent:c,ownerPickerMode:o}=e;var r;const u=(r=(0,E.h_)(G.D).getOptionalString("organization.name"))!==null&&r!==void 0?r:"Backstage",m=(0,M.t)(Wt.yw),{t:p}=oe(le);return(0,n.jsx)(z.g,{title:p("catalog_page_title",{orgName:u}),themeId:"home",children:(0,n.jsxs)(U.V,{children:[(0,n.jsxs)(N.y,{title:"",children:[(0,n.jsx)(b,{title:p("catalog_page_create_button_title"),to:m&&m()}),(0,n.jsx)(Q.q,{children:"All your software catalog entities"})]}),(0,n.jsx)(O.UO,{children:(0,n.jsxs)(X._i,{children:[(0,n.jsxs)(X._i.Filters,{children:[(0,n.jsx)(yt,{initialFilter:d}),(0,n.jsx)(jt,{}),(0,n.jsx)(Et.E,{initialFilter:s}),(0,n.jsx)(Tt.d,{mode:o}),(0,n.jsx)(Ot,{}),(0,n.jsx)(Lt.x,{}),(0,n.jsx)(Ut,{}),(0,n.jsx)($t,{})]}),(0,n.jsx)(X._i.Content,{children:(0,n.jsx)(ot,{columns:l,actions:a,tableOptions:i,emptyContent:c})})]})})]})})}function re(e){return(0,I.pC)()||(0,n.jsx)(dt,{...e})}}}]);})();
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=1600.1ec85d5a.chunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static/1600.1ec85d5a.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,EA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AAC2K,EAAAA,GAAoBJ,QAAO,C,YAC1B,OAAC7G,GAAYA,CACXC,QAASA,EACTC,QAASA,EACTC,aAAcA,EACdE,aAAcA,C,cAQ9B,CCxFO,SAASkH,GAAYxV,EAAgC,CAG1D,SAFeyV,EAAAA,IAAU,MAER,OAACvB,GAAkBA,CAAE,GAAGlU,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.name',\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 title={entity.metadata?.title}\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} 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';\nimport { withStyles } from '@material-ui/core/styles';\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 React, { ReactNode, useMemo } from 'react';\nimport { columnFactories } from './columns';\nimport { CatalogTableRow } from './types';\nimport pluralize from 'pluralize';\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 variant=\"srOnly\">{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 variant=\"srOnly\">{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 variant=\"srOnly\">{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 name: humanizeEntityRef(entity, {\n defaultKind: 'Component',\n }),\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/**\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 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>\n <EntityKindPicker initialFilter={initialKind} />\n <EntityTypePicker />\n <UserListPicker initialFilter={initiallySelectedFilter} />\n <EntityOwnerPicker mode={ownerPickerMode} />\n <EntityLifecyclePicker />\n <EntityTagPicker />\n <EntityProcessingStatusPicker />\n <EntityNamespacePicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <CatalogTable\n columns={columns}\n actions={actions}\n tableOptions={tableOptions}\n emptyContent={emptyContent}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </EntityListProvider>\n </Content>\n </PageWithHeader>\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { useOutlet } from 'react-router-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","OpenInNew","tooltip","disabled","window","open","ANNOTATION_EDIT_URL","Edit","isStarred","paddingLeft","StarBorder","rows","getEntityRelations","RELATION_PART_OF","RELATION_OWNED_BY","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","DefaultCatalogPage","initiallySelectedFilter","initialKind","ownerPickerMode","orgName","configApiRef","getOptionalString","createComponentLink","useRouteRef","createComponentRouteRef","PageWithHeader","themeId","Content","ContentHeader","SupportButton","EntityListProvider","CatalogFilterLayout","Filters","UserListPicker","EntityOwnerPicker","mode","EntityTagPicker","CatalogPage","useOutlet"],"sourceRoot":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[7670],{27670:function(u,o,e){e.r(o),e.d(o,{CatalogSearchResultListItem:function(){return g}});var l=e(52322),v=e(2784),d=e(79692),r=e(86136),h=e(49378),m=e(62774),a=e(7089),x=e(98864),c=e(76079);const f=(0,d.Z)({item:{display:"flex"},flexContainer:{flexWrap:"wrap"},itemText:{width:"100%",wordBreak:"break-all",marginBottom:"1rem"}},{name:"CatalogSearchResultListItem"});function g(i){const s=i.result,t=i.highlight,n=f();return s?(0,l.jsxs)("div",{className:n.item,children:[i.icon&&(0,l.jsx)(r.Z,{children:typeof i.icon=="function"?i.icon(s):i.icon}),(0,l.jsxs)("div",{className:n.flexContainer,children:[(0,l.jsx)(h.Z,{className:n.itemText,primaryTypographyProps:{variant:"h6"},primary:(0,l.jsx)(x.rU,{noTrack:!0,to:s.location,children:t!=null&&t.fields.title?(0,l.jsx)(c.F,{text:t.fields.title,preTag:t.preTag,postTag:t.postTag}):s.title}),secondary:t!=null&&t.fields.text?(0,l.jsx)(c.F,{text:t.fields.text,preTag:t.preTag,postTag:t.postTag}):s.text}),(0,l.jsxs)(m.Z,{children:[s.kind&&(0,l.jsx)(a.Z,{label:`Kind: ${s.kind}`,size:"small"}),s.lifecycle&&(0,l.jsx)(a.Z,{label:`Lifecycle: ${s.lifecycle}`,size:"small"}),s.owner&&(0,l.jsx)(a.Z,{label:`Owner: ${s.owner}`,size:"small"})]})]})]}):null}}}]);})();
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=7670.4e34a90d.chunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static/7670.4e34a90d.chunk.js","mappings":"yTA+BA,MAAMA,KAAYC,EAAAA,GAChB,CACEC,KAAM,CACJC,QAAS,MACX,EACAC,cAAe,CACbC,SAAU,MACZ,EACAC,SAAU,CACRC,MAAO,OACPC,UAAW,YACXC,aAAc,MAChB,CACF,EACA,CAAEC,KAAM,6BAA8B,CAAC,EAgBlC,SAASC,EACdC,EAAuC,CAEvC,MAAMC,EAASD,EAAMC,OACfC,EAAYF,EAAME,UAElBC,EAAUf,EAAU,EAE1B,OAAKa,KAGH,QAACG,MAAAA,CAAIC,UAAWF,EAAQb,K,UACrBU,EAAMM,SACL,OAACC,EAAAA,EAAYA,C,SACV,OAAOP,EAAMM,MAAS,WAAaN,EAAMM,KAAKL,CAAM,EAAID,EAAMM,I,MAGnE,QAACF,MAAAA,CAAIC,UAAWF,EAAQX,c,aACtB,OAACgB,EAAAA,EAAYA,CACXH,UAAWF,EAAQT,SACnBe,uBAAwB,CAAEC,QAAS,IAAK,EACxCC,WACE,OAACC,EAAAA,GAAIA,CAACC,QAAO,GAACC,GAAIb,EAAOc,S,SACtBb,GAAAA,MAAAA,EAAWc,OAAOC,SACjB,OAACC,EAAAA,EAA2BA,CAC1BC,KAAMjB,EAAUc,OAAOC,MACvBG,OAAQlB,EAAUkB,OAClBC,QAASnB,EAAUmB,O,GAGrBpB,EAAOgB,K,GAIbK,UACEpB,GAAAA,MAAAA,EAAWc,OAAOG,QAChB,OAACD,EAAAA,EAA2BA,CAC1BC,KAAMjB,EAAUc,OAAOG,KACvBC,OAAQlB,EAAUkB,OAClBC,QAASnB,EAAUmB,O,GAGrBpB,EAAOkB,I,MAIb,QAACI,EAAAA,EAAGA,C,UACDtB,EAAOuB,SAAQ,OAACC,EAAAA,EAAIA,CAACC,MAAO,SAASzB,EAAOuB,OAAQG,KAAK,O,GACzD1B,EAAO2B,cACN,OAACH,EAAAA,EAAIA,CAACC,MAAO,cAAczB,EAAO2B,YAAaD,KAAK,O,GAErD1B,EAAO4B,UACN,OAACJ,EAAAA,EAAIA,CAACC,MAAO,UAAUzB,EAAO4B,QAASF,KAAK,O,YA5ClC,IAkDtB,C","sources":["webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogSearchResultListItem/CatalogSearchResultListItem.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, { ReactNode } from 'react';\nimport {\n Box,\n Chip,\n ListItemIcon,\n ListItemText,\n makeStyles,\n} from '@material-ui/core';\nimport { Link } from '@backstage/core-components';\nimport {\n IndexableDocument,\n ResultHighlight,\n} from '@backstage/plugin-search-common';\nimport { HighlightedSearchResultText } from '@backstage/plugin-search-react';\n\nconst useStyles = makeStyles(\n {\n item: {\n display: 'flex',\n },\n flexContainer: {\n flexWrap: 'wrap',\n },\n itemText: {\n width: '100%',\n wordBreak: 'break-all',\n marginBottom: '1rem',\n },\n },\n { name: 'CatalogSearchResultListItem' },\n);\n\n/**\n * Props for {@link CatalogSearchResultListItem}.\n *\n * @public\n */\nexport interface CatalogSearchResultListItemProps {\n icon?: ReactNode | ((result: IndexableDocument) => ReactNode);\n result?: IndexableDocument;\n highlight?: ResultHighlight;\n rank?: number;\n}\n\n/** @public */\nexport function CatalogSearchResultListItem(\n props: CatalogSearchResultListItemProps,\n) {\n const result = props.result as any;\n const highlight = props.highlight as ResultHighlight;\n\n const classes = useStyles();\n\n if (!result) return null;\n\n return (\n <div className={classes.item}>\n {props.icon && (\n <ListItemIcon>\n {typeof props.icon === 'function' ? props.icon(result) : props.icon}\n </ListItemIcon>\n )}\n <div className={classes.flexContainer}>\n <ListItemText\n className={classes.itemText}\n primaryTypographyProps={{ variant: 'h6' }}\n primary={\n <Link noTrack to={result.location}>\n {highlight?.fields.title ? (\n <HighlightedSearchResultText\n text={highlight.fields.title}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.title\n )}\n </Link>\n }\n secondary={\n highlight?.fields.text ? (\n <HighlightedSearchResultText\n text={highlight.fields.text}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.text\n )\n }\n />\n <Box>\n {result.kind && <Chip label={`Kind: ${result.kind}`} size=\"small\" />}\n {result.lifecycle && (\n <Chip label={`Lifecycle: ${result.lifecycle}`} size=\"small\" />\n )}\n {result.owner && (\n <Chip label={`Owner: ${result.owner}`} size=\"small\" />\n )}\n </Box>\n </div>\n </div>\n );\n}\n"],"names":["useStyles","makeStyles","item","display","flexContainer","flexWrap","itemText","width","wordBreak","marginBottom","name","CatalogSearchResultListItem","props","result","highlight","classes","div","className","icon","ListItemIcon","ListItemText","primaryTypographyProps","variant","primary","Link","noTrack","to","location","fields","title","HighlightedSearchResultText","text","preTag","postTag","secondary","Box","kind","Chip","label","size","lifecycle","owner"],"sourceRoot":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[967,8662],{61811:function(p,c,t){t.d(c,{O:function(){return _}});var n=t(73557);function _(l){return(0,n.UO)()}},96641:function(p,c,t){t.d(c,{X2:function(){return x},h$:function(){return M}});var n=t(52322),_=t(74314),l=t(72388),v=t(29651),D=t(68993),O=t(2784);const f=(0,v.CT)("entity-context"),M=s=>{const{children:r,entity:m,loading:u,error:g,refresh:E}=s,y={entity:m,loading:u,error:g,refresh:E};return(0,n.jsx)(f.Provider,{value:(0,D.E)({1:y}),children:(0,n.jsx)(l.fC,{attributes:{...m?{entityRef:(0,_.eE)(m)}:void 0},children:r})})},I=s=>_jsx(M,{entity:s.entity,loading:!Boolean(s.entity),error:void 0,refresh:void 0,children:s.children});function x(){const s=(0,v.Vt)("entity-context");if(!s)throw new Error("Entity context is not available");const r=s.atVersion(1);if(!r)throw new Error("EntityContext v1 not available");if(!r.entity)throw new Error("useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.");return{entity:r.entity}}function j(){const s=useVersionedContext("entity-context");if(!s)throw new Error("Entity context is not available");const r=s.atVersion(1);if(!r)throw new Error("EntityContext v1 not available");const{entity:m,loading:u,error:g,refresh:E}=r;return{entity:m,loading:u,error:g,refresh:E}}},80967:function(p,c,t){t.r(c),t.d(c,{EmbeddedDocsRouter:function(){return $},Router:function(){return U},isTechDocsAvailable:function(){return R}});var n=t(52322),_=t(2784),l=t(73557),v=t(74314),D=t(4577),O=t(45902),f=t(24992);const M="backstage.io/techdocs-entity",I=({entity:o})=>{var e;let a=(0,v.iB)(o);if(!((e=o.metadata.annotations)===null||e===void 0)&&e[M])try{var i;a=(0,v.of)((i=o.metadata.annotations)===null||i===void 0?void 0:i[M])}catch{}return(0,n.jsxs)(D.I6,{entityRef:a,children:[(0,n.jsx)(f.b,{}),(0,n.jsx)(O.F,{withSearch:!1})]})};var x=t(62774),j=t(77277),s=t(79692),r=t(90436),m=t(9791),u=t(98864),g=t(70249),E=t(96641);const y=(0,s.Z)(o=>({code:{borderRadius:6,margin:o.spacing(2,0),background:o.palette.type==="dark"?"#444":o.palette.common.white}}),{name:"BackstageMissingAnnotationEmptyState"});function C(o,e){var a,i;const d=(e==null?void 0:e.kind)||"Component",W=(e==null?void 0:e.metadata.name)||"example",K=(e==null||(a=e.spec)===null||a===void 0?void 0:a.type)||"website",S=(e==null||(i=e.spec)===null||i===void 0?void 0:i.owner)||"user:default/guest",H=`apiVersion: backstage.io/v1alpha1
|
|
2
|
+
kind: ${d}
|
|
3
|
+
metadata:
|
|
4
|
+
name: ${W}
|
|
5
|
+
annotations:${o.map(b=>`
|
|
6
|
+
${b}: value`).join("")}
|
|
7
|
+
spec:
|
|
8
|
+
type: ${K}
|
|
9
|
+
owner: ${S}`;let N=6;const Z=[];return o.forEach(()=>{Z.push(N),N++}),{yamlText:H,lineNumbers:Z}}function T(o,e="Component"){const a=o.length<=1;return(0,n.jsxs)(n.Fragment,{children:["The ",a?"annotation":"annotations"," ",o.map(i=>(0,n.jsx)("code",{children:i})).reduce((i,d)=>(0,n.jsxs)(n.Fragment,{children:[i,", ",d]}))," ",a?"is":"are"," missing. You need to add the"," ",a?"annotation":"annotations"," to your ",e," if you want to enable this tool."]})}function L(o){let e;try{e=(0,E.X2)().entity}catch{}const{annotation:a,readMoreUrl:i}=o,d=Array.isArray(a)?a:[a],W=i||"https://backstage.io/docs/features/software-catalog/well-known-annotations",K=y(),S=(e==null?void 0:e.kind)||"Component",{yamlText:H,lineNumbers:N}=C(d,e);return(0,n.jsx)(g.u,{missing:"field",title:"Missing Annotation",description:T(d,S),action:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(r.Z,{variant:"body1",children:["Add the annotation to your ",S," YAML as shown in the highlighted example below:"]}),(0,n.jsx)(x.Z,{className:K.code,children:(0,n.jsx)(m.O,{text:H,language:"yaml",showLineNumbers:!0,highlightedNumbers:N,customStyle:{background:"inherit",fontSize:"115%"}})}),(0,n.jsx)(j.Z,{color:"primary",component:u.rU,to:W,children:"Read more"})]})})}var B=t(18662),A=t(31685);const P="backstage.io/techdocs-ref",h="backstage.io/techdocs-entity",R=o=>{var e,a,i,d;return Boolean(o==null||(a=o.metadata)===null||a===void 0||(e=a.annotations)===null||e===void 0?void 0:e[P])||Boolean(o==null||(d=o.metadata)===null||d===void 0||(i=d.annotations)===null||i===void 0?void 0:i[h])},U=()=>(0,n.jsxs)(l.Z5,{children:[(0,n.jsx)(l.AW,{path:"/",element:(0,n.jsx)(B.TechDocsIndexPage,{})}),(0,n.jsx)(l.AW,{path:"/:namespace/:kind/:name/*",element:(0,n.jsx)(A.I,{})})]}),$=o=>{var e,a;const{children:i}=o,{entity:d}=(0,E.X2)(),W=(0,l.V$)([{path:"/*",element:(0,n.jsx)(I,{entity:d}),children:[{path:"*",element:i}]}]);return((e=d.metadata.annotations)===null||e===void 0?void 0:e[P])||((a=d.metadata.annotations)===null||a===void 0?void 0:a[h])?W:(0,n.jsx)(L,{annotation:[P]})}},18662:function(p,c,t){t.r(c),t.d(c,{TechDocsIndexPage:function(){return D}});var n=t(52322),_=t(2784),l=t(73557),v=t(29895);const D=O=>(0,l.pC)()||(0,n.jsx)(v.u,{...O})},31685:function(p,c,t){t.d(c,{I:function(){return m},r:function(){return r}});var n=t(52322),_=t(2784),l=t(73557),v=t(67880),D=t(2296),O=t(68979),f=t(45902),M=t(65386),I=t(24992),x=t(95573),j=t(61811),s=t(62584);const r=u=>{const{withSearch:g,withHeader:E=!0}=u;return(0,n.jsxs)(v.T,{themeId:"documentation",children:[E&&(0,n.jsx)(M.S,{}),(0,n.jsx)(I.b,{}),(0,n.jsx)(f.F,{withSearch:g})]})},m=u=>{const{kind:g,name:E,namespace:y}=(0,j.O)(x.Fw),{children:C,entityRef:T={kind:g,name:E,namespace:y}}=u,L=(0,l.pC)();if(!C){const P=(L?_.Children.toArray(L.props.children):[]).flatMap(h=>{var R,U;return(U=h==null||(R=h.props)===null||R===void 0?void 0:R.children)!==null&&U!==void 0?U:[]}).find(h=>!(0,s.I)(h,D.Zz)&&!(0,s.I)(h,D.jM));return(0,n.jsx)(O.Z,{entityRef:T,children:P||(0,n.jsx)(r,{})})}return(0,n.jsx)(O.Z,{entityRef:T,children:({metadata:B,entityMetadata:A,onReady:P})=>(0,n.jsx)("div",{className:"techdocs-reader-page",children:(0,n.jsx)(v.T,{themeId:"documentation",children:C instanceof Function?C({entityRef:T,techdocsMetadataValue:B.value,entityMetadataValue:A.value,onReady:P}):C})})})}},24992:function(p,c,t){t.d(c,{b:function(){return m}});var n=t(52322),_=t(2784),l=t(79692),v=t(15223),D=t(62774),O=t(80030),f=t(61837),M=t(48348),I=t(47603),x=t(68979),j=t(2296),s=t(57058);const r=(0,l.Z)(u=>({root:{gridArea:"pageSubheader",flexDirection:"column",minHeight:"auto",padding:u.spacing(3,3,0),"@media print":{display:"none"}}})),m=u=>{const g=r(),[E,y]=(0,_.useState)(null),C=(0,_.useCallback)(R=>{y(R.currentTarget)},[]),T=(0,_.useCallback)(()=>{y(null)},[]),{entityMetadata:{value:L,loading:B}}=(0,x.x)(),A=(0,j.$L)(),P=A.renderComponentsByLocation(s.o.Subheader),h=A.renderComponentsByLocation(s.o.Settings);return!P&&!h||B===!1&&!L?null:(0,n.jsx)(v.Z,{classes:g,...u.toolbarProps,children:(0,n.jsxs)(D.Z,{display:"flex",justifyContent:"flex-end",width:"100%",flexWrap:"wrap",children:[P,h?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(O.ZP,{title:"Settings",children:(0,n.jsx)(f.Z,{"aria-controls":"tech-docs-reader-page-settings","aria-haspopup":"true",onClick:C,children:(0,n.jsx)(I.Z,{})})}),(0,n.jsx)(M.Z,{id:"tech-docs-reader-page-settings",getContentAnchorEl:null,anchorEl:E,anchorOrigin:{vertical:"bottom",horizontal:"right"},open:Boolean(E),onClose:T,keepMounted:!0,children:(0,n.jsx)("div",{children:h})})]}):null]})})}}}]);})();
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=967.9162e72e.chunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static/967.9162e72e.chunk.js","mappings":"sMAwBO,SAASA,EACdC,EAAiD,CAEjD,SAAOC,EAAAA,IAAU,CACnB,C,sJCOA,MAAMC,KAAmBC,EAAAA,IACvB,gBAAgB,EAqBLC,EAAuBC,GAAAA,CAClC,KAAM,CAAEC,SAAAA,EAAUC,OAAAA,EAAQC,QAAAA,EAASC,MAAAA,EAAOC,QAAAA,CAAQ,EAAIL,EAChDM,EAAQ,CAAEJ,OAAAA,EAAQC,QAAAA,EAASC,MAAAA,EAAOC,QAAAA,CAAQ,EAGhD,SACE,OAACR,EAAiBU,SAAQ,CAACD,SAAOE,EAAAA,GAAwB,CAAE,EAAGF,CAAM,CAAC,E,YACpE,OAACG,EAAAA,GAAgBA,CACfC,WAAY,CACV,GAAIR,EAAS,CAAES,aAAWC,EAAAA,IAAmBV,CAAM,CAAE,EAAIW,MAC3D,E,SAECZ,C,IAIT,EAiBaa,EAAkBd,GAC7B,KAACD,EAAAA,CACCG,OAAQF,EAAME,OACdC,QAAS,CAACY,QAAQf,EAAME,MAAM,EAC9BE,MAAOS,OACPR,QAASQ,OACTZ,SAAUD,EAAMC,Q,GAUb,SAASe,GAAAA,CAGd,MAAMC,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uG,EAAUC,CAAW,KAAIC,EAAAA,UAA6B,IAAI,EAE3DC,KAAcC,EAAAA,aAAaC,GAAAA,CAC/BJ,EAAYI,EAAMC,aAAa,CACjC,EAAG,CAAC,CAAC,EAECC,KAAcH,EAAAA,aAAY,KAC9BH,EAAY,IAAI,CAClB,EAAG,CAAC,CAAC,EAEC,CACJb,eAAgB,CAAErH,MAAOqH,EAAgBxH,QAAS4I,CAAsB,CAAC,KACvEC,EAAAA,GAAsB,EAEpBC,KAASC,EAAAA,IAAkB,EAE3BC,EAAkBF,EAAOG,2BAC7BC,EAAAA,EAAUC,SAAS,EAGfC,EAAiBN,EAAOG,2BAA2BC,EAAAA,EAAUG,QAAQ,EAK3E,MAHI,CAACL,GAAmB,CAACI,GAGrBR,IAA0B,IAAS,CAACpB,EAAuB,QAG7D,OAAC8B,EAAAA,EAAOA,CAACnF,QAASA,EAAU,GAAGtE,EAAM0J,a,YACnC,QAAC5E,EAAAA,EAAGA,CACFwD,QAAQ,OACRqB,eAAe,WACfC,MAAM,OACNC,SAAS,O,UAERV,EACAI,KACC,oB,aACE,OAACO,EAAAA,GAAOA,CAACrF,MAAM,W,YACb,OAACsF,EAAAA,EAAUA,CACTC,gBAAc,iCACdC,gBAAc,OACdC,QAASxB,E,YAET,OAACyB,EAAAA,EAAYA,CAAAA,CAAAA,C,QAGjB,OAACC,EAAAA,EAAIA,CACHC,GAAG,iCACHC,mBAAoB,KACpB/B,SAAUA,EACVgC,aAAc,CAAEC,SAAU,SAAUC,WAAY,OAAQ,EACxDC,KAAM3J,QAAQwH,CAAQ,EACtBoC,QAAS7B,EACT8B,YAAW,G,YAEX,OAAC/C,MAAAA,C,SAAK0B,C,QAGR,I,KAIZ,C","sources":["webpack://techdocs-cli-embedded-app/../core-plugin-api/src/routing/useRouteRefParams.ts","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/hooks/useEntity.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/EntityPageDocs.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/EmptyState/MissingAnnotationEmptyState.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/Router.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/TechDocsIndexPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useParams } from 'react-router-dom';\nimport { RouteRef, AnyParams, SubRouteRef } from './types';\n\n/**\n * React hook for retrieving dynamic params from the current URL.\n * @param _routeRef - Ref of the current route.\n * @public\n */\nexport function useRouteRefParams<Params extends AnyParams>(\n _routeRef: RouteRef<Params> | SubRouteRef<Params>,\n): Params {\n return useParams() as Params;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { AnalyticsContext } from '@backstage/core-plugin-api';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n useVersionedContext,\n} from '@backstage/version-bridge';\nimport React, { ReactNode } from 'react';\n\n/** @public */\nexport type EntityLoadingStatus<TEntity extends Entity = Entity> = {\n entity?: TEntity;\n loading: boolean;\n error?: Error;\n refresh?: VoidFunction;\n};\n\n// This context has support for multiple concurrent versions of this package.\n// It is currently used in parallel with the old context in order to provide\n// a smooth transition, but will eventually be the only context we use.\nconst NewEntityContext = createVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n);\n\n/**\n * Properties for the AsyncEntityProvider component.\n *\n * @public\n */\nexport interface AsyncEntityProviderProps {\n children: ReactNode;\n entity?: Entity;\n loading: boolean;\n error?: Error;\n refresh?: VoidFunction;\n}\n\n/**\n * Provides a loaded entity to be picked up by the `useEntity` hook.\n *\n * @public\n */\nexport const AsyncEntityProvider = (props: AsyncEntityProviderProps) => {\n const { children, entity, loading, error, refresh } = props;\n const value = { entity, loading, error, refresh };\n // We provide both the old and the new context, since\n // consumers might be doing things like `useContext(EntityContext)`\n return (\n <NewEntityContext.Provider value={createVersionedValueMap({ 1: value })}>\n <AnalyticsContext\n attributes={{\n ...(entity ? { entityRef: stringifyEntityRef(entity) } : undefined),\n }}\n >\n {children}\n </AnalyticsContext>\n </NewEntityContext.Provider>\n );\n};\n\n/**\n * Properties for the EntityProvider component.\n *\n * @public\n */\nexport interface EntityProviderProps {\n children: ReactNode;\n entity?: Entity;\n}\n\n/**\n * Provides an entity to be picked up by the `useEntity` hook.\n *\n * @public\n */\nexport const EntityProvider = (props: EntityProviderProps) => (\n <AsyncEntityProvider\n entity={props.entity}\n loading={!Boolean(props.entity)}\n error={undefined}\n refresh={undefined}\n children={props.children}\n />\n);\n\n/**\n * Grab the current entity from the context, throws if the entity has not yet been loaded\n * or is not available.\n *\n * @public\n */\nexport function useEntity<TEntity extends Entity = Entity>(): {\n entity: TEntity;\n} {\n const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n );\n\n if (!versionedHolder) {\n throw new Error('Entity context is not available');\n }\n\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('EntityContext v1 not available');\n }\n\n if (!value.entity) {\n throw new Error(\n 'useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.',\n );\n }\n\n return { entity: value.entity as TEntity };\n}\n\n/**\n * Grab the current entity from the context, provides loading state and errors, and the ability to refresh.\n *\n * @public\n */\nexport function useAsyncEntity<\n TEntity extends Entity = Entity,\n>(): EntityLoadingStatus<TEntity> {\n const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n );\n\n if (!versionedHolder) {\n throw new Error('Entity context is not available');\n }\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('EntityContext v1 not available');\n }\n\n const { entity, loading, error, refresh } = value;\n return { entity: entity as TEntity, loading, error, refresh };\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Entity,\n getCompoundEntityRef,\n parseEntityRef,\n} from '@backstage/catalog-model';\n\nimport React from 'react';\nimport { TechDocsReaderPage } from './plugin';\nimport { TechDocsReaderPageContent } from './reader/components/TechDocsReaderPageContent';\nimport { TechDocsReaderPageSubheader } from './reader/components/TechDocsReaderPageSubheader';\n\nconst TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity';\n\ntype EntityPageDocsProps = { entity: Entity };\n\nexport const EntityPageDocs = ({ entity }: EntityPageDocsProps) => {\n let entityRef = getCompoundEntityRef(entity);\n\n if (entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) {\n try {\n entityRef = parseEntityRef(\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION],\n );\n } catch {\n // not a fan of this but we don't care if the parseEntityRef fails\n }\n }\n\n return (\n <TechDocsReaderPage entityRef={entityRef}>\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={false} />\n </TechDocsReaderPage>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BackstageTheme } from '@backstage/theme';\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\n\nimport { CodeSnippet } from '../CodeSnippet';\nimport { Link } from '../Link';\nimport { EmptyState } from './EmptyState';\n\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { Entity } from '@backstage/catalog-model';\n\ntype Props = {\n annotation: string | string[];\n readMoreUrl?: string;\n};\n\nexport type MissingAnnotationEmptyStateClassKey = 'code';\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: 'BackstageMissingAnnotationEmptyState' },\n);\n\nfunction generateYamlExample(\n annotations: string[],\n entity?: Entity,\n): { yamlText: string; lineNumbers: number[] } {\n const kind = entity?.kind || 'Component';\n const name = entity?.metadata.name || 'example';\n const type = entity?.spec?.type || 'website';\n const owner = entity?.spec?.owner || 'user:default/guest';\n\n const yamlText = `apiVersion: backstage.io/v1alpha1\nkind: ${kind}\nmetadata:\n name: ${name}\n annotations:${annotations.map(ann => `\\n ${ann}: value`).join('')}\nspec:\n type: ${type}\n owner: ${owner}`;\n\n let line = 6; // Line 6 is the line number that annotations are added to.\n const lineNumbers: number[] = [];\n annotations.forEach(() => {\n lineNumbers.push(line);\n line++;\n });\n\n return {\n yamlText,\n lineNumbers,\n };\n}\n\nfunction generateDescription(annotations: string[], entityKind = 'Component') {\n const isSingular = annotations.length <= 1;\n return (\n <>\n The {isSingular ? 'annotation' : 'annotations'}{' '}\n {annotations\n .map(ann => <code>{ann}</code>)\n .reduce((prev, curr) => (\n <>\n {prev}, {curr}\n </>\n ))}{' '}\n {isSingular ? 'is' : 'are'} missing. You need to add the{' '}\n {isSingular ? 'annotation' : 'annotations'} to your {entityKind} if you\n want to enable this tool.\n </>\n );\n}\n\nexport function MissingAnnotationEmptyState(props: Props) {\n let entity: Entity | undefined;\n try {\n const entityContext = useEntity();\n entity = entityContext.entity;\n } catch (err) {\n // ignore when entity context doesnt exist\n }\n\n const { annotation, readMoreUrl } = props;\n const annotations = Array.isArray(annotation) ? annotation : [annotation];\n const url =\n readMoreUrl ||\n 'https://backstage.io/docs/features/software-catalog/well-known-annotations';\n const classes = useStyles();\n\n const entityKind = entity?.kind || 'Component';\n const { yamlText, lineNumbers } = generateYamlExample(annotations, entity);\n return (\n <EmptyState\n missing=\"field\"\n title=\"Missing Annotation\"\n description={generateDescription(annotations, entityKind)}\n action={\n <>\n <Typography variant=\"body1\">\n Add the annotation to your {entityKind} YAML as shown in the\n highlighted example below:\n </Typography>\n <Box className={classes.code}>\n <CodeSnippet\n text={yamlText}\n language=\"yaml\"\n showLineNumbers\n highlightedNumbers={lineNumbers}\n customStyle={{ background: 'inherit', fontSize: '115%' }}\n />\n </Box>\n <Button color=\"primary\" component={Link} to={url}>\n Read more\n </Button>\n </>\n }\n />\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { PropsWithChildren } from 'react';\nimport { Route, Routes, useRoutes } from 'react-router-dom';\n\nimport { Entity } from '@backstage/catalog-model';\nimport { EntityPageDocs } from './EntityPageDocs';\nimport { MissingAnnotationEmptyState } from '@backstage/core-components';\nimport { TechDocsIndexPage } from './home/components/TechDocsIndexPage';\nimport { TechDocsReaderPage } from './reader/components/TechDocsReaderPage';\nimport { useEntity } from '@backstage/plugin-catalog-react';\n\nconst TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref';\n\nconst TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity';\n\n/**\n * Helper that takes in entity and returns true/false if TechDocs is available for the entity\n *\n * @public\n */\nexport const isTechDocsAvailable = (entity: Entity) =>\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_ANNOTATION]) ||\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]);\n\n/**\n * Responsible for registering routes for TechDocs, TechDocs Homepage and separate TechDocs page\n *\n * @public\n */\nexport const Router = () => {\n return (\n <Routes>\n <Route path=\"/\" element={<TechDocsIndexPage />} />\n <Route\n path=\"/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n />\n </Routes>\n );\n};\n\n/**\n * Responsible for registering route to view docs on Entity page\n *\n * @public\n */\nexport const EmbeddedDocsRouter = (props: PropsWithChildren<{}>) => {\n const { children } = props;\n const { entity } = useEntity();\n\n // Using objects instead of <Route> elements, otherwise \"outlet\" will be null on sub-pages and add-ons won't render\n const element = useRoutes([\n {\n path: '/*',\n element: <EntityPageDocs entity={entity} />,\n children: [\n {\n path: '*',\n element: children,\n },\n ],\n },\n ]);\n\n const projectId =\n entity.metadata.annotations?.[TECHDOCS_ANNOTATION] ||\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION];\n\n if (!projectId) {\n return <MissingAnnotationEmptyState annotation={[TECHDOCS_ANNOTATION]} />;\n }\n\n return element;\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { useOutlet } from 'react-router-dom';\nimport { TableColumn, TableProps } from '@backstage/core-components';\nimport { UserListFilterKind } from '@backstage/plugin-catalog-react';\nimport { DefaultTechDocsHome } from './DefaultTechDocsHome';\nimport { DocsTableRow } from './Tables';\n\n/**\n * Props for {@link TechDocsIndexPage}\n *\n * @public\n */\nexport type TechDocsIndexPageProps = {\n initialFilter?: UserListFilterKind;\n columns?: TableColumn<DocsTableRow>[];\n actions?: TableProps<DocsTableRow>['actions'];\n};\n\nexport const TechDocsIndexPage = (props: TechDocsIndexPageProps) => {\n const outlet = useOutlet();\n\n return outlet || <DefaultTechDocsHome {...props} />;\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode, Children, ReactElement } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nimport { Page } from '@backstage/core-components';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport {\n TECHDOCS_ADDONS_WRAPPER_KEY,\n TECHDOCS_ADDONS_KEY,\n TechDocsReaderPageProvider,\n} from '@backstage/plugin-techdocs-react';\n\nimport { TechDocsReaderPageRenderFunction } from '../../../types';\n\nimport { TechDocsReaderPageContent } from '../TechDocsReaderPageContent';\nimport { TechDocsReaderPageHeader } from '../TechDocsReaderPageHeader';\nimport { TechDocsReaderPageSubheader } from '../TechDocsReaderPageSubheader';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n getComponentData,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\n\n/* An explanation for the multiple ways of customizing the TechDocs reader page\n\nPlease refer to this page on the microsite for the latest recommended approach:\nhttps://backstage.io/docs/features/techdocs/how-to-guides#how-to-customize-the-techdocs-reader-page\n\nThe <TechDocsReaderPage> component is responsible for rendering the <TechDocsReaderPageProvider> and\nits contained version of a <Page>, which in turn renders the <TechDocsReaderPageContent>.\n\nHistorically, there have been different approaches on how this <Page> can be customized, and how the\n<TechDocsReaderPageContent> inside could be exchanged for a custom implementation (which was not\npossible before). Also, the current implementation supports every scenario to avoid breaking default\nconfigurations of TechDocs.\n\nIn particular, there are 4 different TechDocs page configurations:\n\nCONFIGURATION 1: <TechDocsReaderPage> only, no children\n\n<Route path=\"/docs/:namespace/:kind/:name/*\" element={<TechDocsReaderPage />} >\n\nThis is the simplest way to use TechDocs. Only a full page is passed, assuming that it comes with\nits content inside. Since we allowed customizing it, we started providing <TechDocsReaderLayout> as\na default implementation (which contains <TechDocsReaderPageContent>).\n\nCONFIGURATION 2 (not advised): <TechDocsReaderPage> with element children\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {techdocsPage}\n </TechDocsReaderPage>\n }\n/>\n\nPreviously, there were two ways of passing children to <TechDocsReaderPage>: either as elements (as\nshown above), or as a render function (described below in CONFIGURATION 3). The \"techdocsPage\" is\nlocated in packages/app/src/components/techdocs and is the default implementation of the content\ninside.\n\nCONFIGURATION 3 (not advised): <TechDocsReaderPage> with render function as child\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {({ metadata, entityMetadata, onReady }) => (\n techdocsPage\n )}\n </TechDocsReaderPage>\n }\n/>\n\nSimilar to CONFIGURATION 2, the direct children will be passed to the <TechDocsReaderPage> but in\nthis case interpreted as render prop.\n\nCONFIGURATION 4: <TechDocsReaderPage> and provided content in <Route>\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n>\n {techDocsPage}\n <TechDocsAddons>\n <ExpandableNavigation />\n <ReportIssue />\n <TextSize />\n <LightBox />\n </TechDocsAddons>\n</Route>\n\nThis is the current state in packages/app/src/App.tsx and moved the location of children from inside\nthe element prop in the <Route> to the children of the <Route>. Then, in <TechDocsReaderPage> they\nare retrieved using the useOutlet hook from React Router.\n\nNOTE: Render functions are no longer supported in this approach.\n*/\n\n/**\n * Props for {@link TechDocsReaderLayout}\n * @public\n */\nexport type TechDocsReaderLayoutProps = {\n /**\n * Show or hide the header, defaults to true.\n */\n withHeader?: boolean;\n /**\n * Show or hide the content search bar, defaults to true.\n */\n withSearch?: boolean;\n};\n\n/**\n * Default TechDocs reader page structure composed with a header and content\n * @public\n */\nexport const TechDocsReaderLayout = (props: TechDocsReaderLayoutProps) => {\n const { withSearch, withHeader = true } = props;\n return (\n <Page themeId=\"documentation\">\n {withHeader && <TechDocsReaderPageHeader />}\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={withSearch} />\n </Page>\n );\n};\n\n/**\n * @public\n */\nexport type TechDocsReaderPageProps = {\n entityRef?: CompoundEntityRef;\n children?: TechDocsReaderPageRenderFunction | ReactNode;\n};\n\n/**\n * An addon-aware implementation of the TechDocsReaderPage.\n *\n * @public\n */\nexport const TechDocsReaderPage = (props: TechDocsReaderPageProps) => {\n const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);\n const { children, entityRef = { kind, name, namespace } } = props;\n\n const outlet = useOutlet();\n\n if (!children) {\n const childrenList = outlet ? Children.toArray(outlet.props.children) : [];\n\n const grandChildren = childrenList.flatMap<ReactElement>(\n child => (child as ReactElement)?.props?.children ?? [],\n );\n\n const page: React.ReactNode = grandChildren.find(\n grandChild =>\n !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) &&\n !getComponentData(grandChild, TECHDOCS_ADDONS_KEY),\n );\n\n // As explained above, \"page\" is configuration 4 and <TechDocsReaderLayout> is 1\n return (\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {(page as JSX.Element) || <TechDocsReaderLayout />}\n </TechDocsReaderPageProvider>\n );\n }\n\n // As explained above, a render function is configuration 3 and React element is 2\n return (\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {({ metadata, entityMetadata, onReady }) => (\n <div className=\"techdocs-reader-page\">\n <Page themeId=\"documentation\">\n {children instanceof Function\n ? children({\n entityRef,\n techdocsMetadataValue: metadata.value,\n entityMetadataValue: entityMetadata.value,\n onReady,\n })\n : children}\n </Page>\n </div>\n )}\n </TechDocsReaderPageProvider>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { MouseEvent, useState, useCallback } from 'react';\n\nimport {\n Box,\n makeStyles,\n Toolbar,\n ToolbarProps,\n Menu,\n Tooltip,\n IconButton,\n} from '@material-ui/core';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport {\n TechDocsAddonLocations as locations,\n useTechDocsAddons,\n useTechDocsReaderPage,\n} from '@backstage/plugin-techdocs-react';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageSubheader',\n flexDirection: 'column',\n minHeight: 'auto',\n padding: theme.spacing(3, 3, 0),\n '@media print': {\n display: 'none',\n },\n },\n}));\n\n/**\n * Renders the reader page subheader.\n * Please use the Tech Docs add-ons to customize it\n * @public\n */\nexport const TechDocsReaderPageSubheader = (props: {\n toolbarProps?: ToolbarProps;\n}) => {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const handleClose = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n const {\n entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },\n } = useTechDocsReaderPage();\n\n const addons = useTechDocsAddons();\n\n const subheaderAddons = addons.renderComponentsByLocation(\n locations.Subheader,\n );\n\n const settingsAddons = addons.renderComponentsByLocation(locations.Settings);\n\n if (!subheaderAddons && !settingsAddons) return null;\n\n // No entity metadata = 404. Don't render subheader on 404.\n if (entityMetadataLoading === false && !entityMetadata) return null;\n\n return (\n <Toolbar classes={classes} {...props.toolbarProps}>\n <Box\n display=\"flex\"\n justifyContent=\"flex-end\"\n width=\"100%\"\n flexWrap=\"wrap\"\n >\n {subheaderAddons}\n {settingsAddons ? (\n <>\n <Tooltip title=\"Settings\">\n <IconButton\n aria-controls=\"tech-docs-reader-page-settings\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n >\n <SettingsIcon />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"tech-docs-reader-page-settings\"\n getContentAnchorEl={null}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n open={Boolean(anchorEl)}\n onClose={handleClose}\n keepMounted\n >\n <div>{settingsAddons}</div>\n </Menu>\n </>\n ) : null}\n </Box>\n </Toolbar>\n );\n};\n"],"names":["useRouteRefParams","_routeRef","useParams","NewEntityContext","createVersionedContext","AsyncEntityProvider","props","children","entity","loading","error","refresh","value","Provider","createVersionedValueMap","AnalyticsContext","attributes","entityRef","stringifyEntityRef","undefined","EntityProvider","Boolean","useEntity","versionedHolder","useVersionedContext","Error","atVersion","useAsyncEntity","TECHDOCS_EXTERNAL_ANNOTATION","EntityPageDocs","getCompoundEntityRef","metadata","annotations","parseEntityRef","TechDocsReaderPage","TechDocsReaderPageSubheader","TechDocsReaderPageContent","withSearch","useStyles","makeStyles","theme","code","borderRadius","margin","spacing","background","palette","type","common","white","name","generateYamlExample","kind","spec","owner","yamlText","map","ann","join","line","lineNumbers","forEach","push","generateDescription","entityKind","isSingular","length","reduce","prev","curr","MissingAnnotationEmptyState","annotation","readMoreUrl","Array","isArray","url","classes","EmptyState","missing","title","description","action","Typography","variant","Box","className","CodeSnippet","text","language","showLineNumbers","highlightedNumbers","customStyle","fontSize","Button","color","component","Link","to","TECHDOCS_ANNOTATION","isTechDocsAvailable","Router","Routes","Route","path","element","TechDocsIndexPage","EmbeddedDocsRouter","useRoutes","useOutlet","DefaultTechDocsHome","TechDocsReaderLayout","withHeader","Page","themeId","TechDocsReaderPageHeader","namespace","rootDocsRouteRef","outlet","page","Children","toArray","flatMap","child","find","grandChild","getComponentData","TECHDOCS_ADDONS_WRAPPER_KEY","TECHDOCS_ADDONS_KEY","TechDocsReaderPageProvider","entityMetadata","onReady","div","Function","techdocsMetadataValue","entityMetadataValue","root","gridArea","flexDirection","minHeight","padding","display","anchorEl","setAnchorEl","useState","handleClick","useCallback","event","currentTarget","handleClose","entityMetadataLoading","useTechDocsReaderPage","addons","useTechDocsAddons","subheaderAddons","renderComponentsByLocation","locations","Subheader","settingsAddons","Settings","Toolbar","toolbarProps","justifyContent","width","flexWrap","Tooltip","IconButton","aria-controls","aria-haspopup","onClick","SettingsIcon","Menu","id","getContentAnchorEl","anchorOrigin","vertical","horizontal","open","onClose","keepMounted"],"sourceRoot":""}
|