@techdocs/cli
Version:
Utility CLI for managing TechDocs sites in Backstage.
6 lines (5 loc) • 16.2 kB
JavaScript
;(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[124],{52235:(I,y,t)=>{var e,p=t(4293),c=t(78920);e={value:!0},y.A=void 0;var h=c(t(14041)),C=p(t(74044)),g=(0,C.default)(h.createElement("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward");y.A=g},48514:(I,y,t)=>{t.d(y,{M:()=>g});var e=t(31085),p=t(58837),c=t(71677),h=t(72501);const C=(0,p.A)({container:{overflow:"visible !important"},typo:{fontSize:"inherit",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box","-webkit-line-clamp":({line:r})=>r||1,"-webkit-box-orient":"vertical"}},{name:"BackstageOverflowTooltip"});function g(r){const R=C(r);return(0,e.jsx)(c.Ay,{title:r.title??(r.text||""),placement:r.placement,children:(0,e.jsx)(h.A,{className:R.typo,variant:"inherit",children:r.text})})}},48045:(I,y,t)=>{t.d(y,{n:()=>B});var e=t(31085),p=t(40703),c=t(59469),h=t(48653),C=t(45685),g=t(37197),r=t(58837),R=t(87051),i=t(53373),S=t.n(i),a=t(10394),m=t(72501),v=t(52235),l=t(72072);const f=(0,r.A)(n=>({root:{maxWidth:"fit-content",padding:n.spacing(2,2,2,2.5)},boxTitle:{margin:0,color:n.palette.textSubtle},arrow:{color:n.palette.textSubtle}}),{name:"BackstageBottomLink"});function x(n){const{link:o,title:d,onClick:j}=n,T=f();return(0,e.jsxs)(a.A,{children:[(0,e.jsx)(g.A,{}),(0,e.jsx)(l.N_,{to:o,onClick:j,underline:"none",children:(0,e.jsxs)(a.A,{display:"flex",alignItems:"center",className:T.root,children:[(0,e.jsx)(a.A,{className:T.boxTitle,fontWeight:"fontWeightBold",m:1,children:(0,e.jsx)(m.A,{children:(0,e.jsx)("strong",{children:d})})}),(0,e.jsx)(v.A,{className:T.arrow})]})})]})}var L=t(14041),u=t(73896),M=t(22020),K=t(10315),N=t(87849);const s=n=>{const{slackChannel:o}=n,{t:d}=(0,N.i)(K.O);if(o){if(typeof o=="string")return(0,e.jsx)(m.A,{children:d("errorBoundary.title",{slackChannel:o})});if(!o.href)return(0,e.jsx)(m.A,{children:d("errorBoundary.title",{slackChannel:o.name})})}else return null;return(0,e.jsx)(u.z,{to:o.href,variant:"contained",children:o.name})},O=class extends L.Component{constructor(o){super(o),this.state={error:void 0,errorInfo:void 0}}componentDidCatch(o,d){console.error(`ErrorBoundary, error: ${o}`,{error:o,errorInfo:d}),this.setState({error:o,errorInfo:d})}render(){const{slackChannel:o,children:d}=this.props,{error:j}=this.state;return j?(0,e.jsx)(M.b,{title:"Something Went Wrong",error:j,children:(0,e.jsx)(s,{slackChannel:o})}):d}},z=(0,r.A)(n=>({noPadding:{padding:0,"&:last-child":{paddingBottom:0}},contentAlignBottom:{display:"flex",alignItems:"self-end"},header:{padding:n.spacing(2,2,2,2.5)},headerTitle:{fontWeight:n.typography.fontWeightBold},headerSubheader:{paddingTop:n.spacing(1)},headerAvatar:{},headerAction:{},headerContent:{},subheader:{display:"flex"}}),{name:"BackstageInfoCard"}),E=(0,R.A)(n=>({root:{display:"inline-block",padding:n.spacing(8,8,0,0),float:"right"}}),{name:"BackstageInfoCardCardActionsTopRight"})(c.A),D={card:{flex:{display:"flex",flexDirection:"column"},fullHeight:{display:"flex",flexDirection:"column",height:"100%"},gridItem:{display:"flex",flexDirection:"column",height:"calc(100% - 10px)",marginBottom:"10px",breakInside:"avoid-page","@media print":{height:"auto"}}},cardContent:{fullHeight:{flex:1},gridItem:{flex:1}}};function B(n){const{title:o,subheader:d,divider:j=!0,deepLink:T,slackChannel:P,errorBoundaryProps:W,variant:H,alignContent:A="normal",children:U,headerStyle:F,headerProps:k,icon:w,action:Q,actionsClassName:G,actions:$,cardClassName:Z,actionsTopRight:J,className:q,noPadding:_,titleTypographyProps:tt,subheaderTypographyProps:et}=n,b=z();let V={},Y={};H&&H.split(/[\s]+/g).forEach(X=>{V={...V,...D.card[X]},Y={...Y,...D.cardContent[X]}});const nt=()=>!d&&!w?null:(0,e.jsxs)("div",{"data-testid":"info-card-subheader",children:[d&&(0,e.jsx)("div",{className:b.subheader,children:d}),w]}),ot=W||(P?{slackChannel:P}:{});return(0,e.jsx)(p.A,{style:V,className:q,children:(0,e.jsxs)(O,{...ot,children:[o&&(0,e.jsx)(C.A,{classes:{root:S()(b.header),title:b.headerTitle,subheader:b.headerSubheader,avatar:b.headerAvatar,action:b.headerAction,content:b.headerContent},title:o,subheader:nt(),action:Q,style:{...F},titleTypographyProps:tt,subheaderTypographyProps:et,...k}),J&&(0,e.jsx)(E,{children:J}),j&&(0,e.jsx)(g.A,{}),(0,e.jsx)(h.A,{className:S()(Z,{[b.noPadding]:_,[b.contentAlignBottom]:A==="bottom"}),style:Y,children:U}),$&&(0,e.jsx)(c.A,{className:G,children:$}),T&&(0,e.jsx)(x,{...T})]})})}},89648:(I,y,t)=>{t.d(y,{s:()=>l});var e=t(31085),p=t(58837),c=t(51372),h=t(48514),C=t(67871),g=t(90184),r=t(8859),R=t(34428);const i=Object.freeze({createEntityRefColumn(f){const{defaultKind:x}=f;function L(u){return u.metadata?.title||(0,g.S)(u,{defaultKind:x})}return{title:"Name",highlight:!0,customFilterAndSearch(u,M){return L(M).includes(u)},customSort(u,M){return L(u).localeCompare(L(M))},render:u=>(0,e.jsx)(r.z,{entityRef:u,defaultKind:x,title:u.metadata?.title})}},createEntityRelationColumn(f){const{title:x,relation:L,defaultKind:u,filter:M}=f;function K(s){return(0,C.t)(s,L,M)}function N(s){return K(s).map(O=>(0,g.S)(O,{defaultKind:u})).join(", ")}return{title:x,customFilterAndSearch(s,O){return N(O).includes(s)},customSort(s,O){return N(s).localeCompare(N(O))},render:s=>(0,e.jsx)(R.i,{entityRefs:K(s),defaultKind:u})}},createOwnerColumn(){return this.createEntityRelationColumn({title:"Owner",relation:c.vv,defaultKind:"group"})},createDomainColumn(){return this.createEntityRelationColumn({title:"Domain",relation:c.jn,defaultKind:"domain",filter:{kind:"domain"}})},createSystemColumn(){return this.createEntityRelationColumn({title:"System",relation:c.jn,defaultKind:"system",filter:{kind:"system"}})},createMetadataDescriptionColumn(){return{title:"Description",field:"metadata.description",render:f=>(0,e.jsx)(h.M,{text:f.metadata.description,placement:"bottom-start",line:2})}},createSpecLifecycleColumn(){return{title:"Lifecycle",field:"spec.lifecycle"}},createSpecTypeColumn(){return{title:"Type",field:"spec.type"}}}),S=[i.createEntityRefColumn({defaultKind:"system"}),i.createDomainColumn(),i.createOwnerColumn(),i.createMetadataDescriptionColumn()],a=[i.createEntityRefColumn({defaultKind:"component"}),i.createSystemColumn(),i.createOwnerColumn(),i.createSpecTypeColumn(),i.createSpecLifecycleColumn(),i.createMetadataDescriptionColumn()];var m=t(14209);const v=(0,p.A)(f=>({empty:{padding:f.spacing(2),display:"flex",justifyContent:"center"}})),l=f=>{const{entities:x,title:L,emptyContent:u,variant:M="gridItem",columns:K,tableOptions:N={}}=f,s=v(),O={minWidth:"0",width:"100%"};return M==="gridItem"&&(O.height="calc(100% - 10px)"),(0,e.jsx)(m.X,{columns:K,title:L,style:O,emptyContent:u&&(0,e.jsx)("div",{className:s.empty,children:u}),options:{search:!1,paging:!1,actionsColumnIndex:-1,padding:"dense",draggable:!1,...N},data:x})};l.columns=i,l.systemEntityColumns=S,l.componentEntityColumns=a},99538:(I,y,t)=>{t.d(y,{T7:()=>r,TY:()=>S,tN:()=>i});var e=t(31085),p=t(6820),c=t(25862),h=t(43836),C=t(10602);const g=(0,h.tK)("entity-context"),r=a=>{const{children:m,entity:v,loading:l,error:f,refresh:x}=a,L={entity:v,loading:l,error:f,refresh:x};return(0,e.jsx)(g.Provider,{value:(0,C.B)({1:L}),children:(0,e.jsx)(c.Ig,{attributes:{...v?{entityRef:(0,p.U2)(v)}:void 0},children:m})})},R=a=>_jsx(r,{entity:a.entity,loading:!a.entity,error:void 0,refresh:void 0,children:a.children});function i(){const a=(0,h.qO)("entity-context");if(!a)throw new Error("Entity context is not available");const m=a.atVersion(1);if(!m)throw new Error("EntityContext v1 not available");if(!m.entity)throw new Error("useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.");return{entity:m.entity}}function S(){const a=(0,h.qO)("entity-context");if(!a)throw new Error("Entity context is not available");const m=a.atVersion(1);if(!m)throw new Error("EntityContext v1 not available");const{entity:v,loading:l,error:f,refresh:x}=m;return{entity:v,loading:l,error:f,refresh:x}}},90759:(I,y,t)=>{t.d(y,{W:()=>p});var e=t(93184);const p=(0,e.h)({id:"catalog",messages:{indexPage:{title:"{{orgName}} Catalog",createButtonTitle:"Create",supportButtonContent:"All your software catalog entities"},aboutCard:{title:"About",refreshButtonTitle:"Schedule entity refresh",editButtonTitle:"Edit Metadata",createSimilarButtonTitle:"Create something similar",refreshScheduledMessage:"Refresh scheduled",launchTemplate:"Launch Template",viewTechdocs:"View TechDocs",viewSource:"View Source",descriptionField:{label:"Description",value:"No description"},ownerField:{label:"Owner",value:"No Owner"},domainField:{label:"Domain",value:"No Domain"},systemField:{label:"System",value:"No System"},parentComponentField:{label:"Parent Component",value:"No Parent Component"},typeField:{label:"Type"},lifecycleField:{label:"Lifecycle"},tagsField:{label:"Tags",value:"No Tags"},targetsField:{label:"Targets"}},searchResultItem:{lifecycle:"Lifecycle",Owner:"Owner"},catalogTable:{warningPanelTitle:"Could not fetch catalog entities.",viewActionTitle:"View",editActionTitle:"Edit",starActionTitle:"Add to favorites",unStarActionTitle:"Remove from favorites"},dependencyOfComponentsCard:{title:"Dependency of components",emptyMessage:"No component depends on this component"},dependsOnComponentsCard:{title:"Depends on components",emptyMessage:"No component is a dependency of this component"},dependsOnResourcesCard:{title:"Depends on resources",emptyMessage:"No resource is a dependency of this component"},entityContextMenu:{copiedMessage:"Copied!",moreButtonTitle:"More",inspectMenuTitle:"Inspect entity",copyURLMenuTitle:"Copy entity URL",unregisterMenuTitle:"Unregister entity"},entityLabelsCard:{title:"Labels",emptyDescription:"No labels defined for this entity. You can add labels to your entity YAML as shown in the highlighted example below:",readMoreButtonTitle:"Read more"},entityLabels:{warningPanelTitle:"Entity not found",ownerLabel:"Owner",lifecycleLabel:"Lifecycle"},entityLinksCard:{title:"Links",emptyDescription:"No links defined for this entity. You can add links to your entity YAML as shown in the highlighted example below:",readMoreButtonTitle:"Read more"},entityNotFound:{title:"Entity was not found",description:"Want to help us build this? Check out our Getting Started documentation.",docButtonTitle:"DOCS"},deleteEntity:{dialogTitle:"Are you sure you want to delete this entity?",deleteButtonTitle:"Delete",cancelButtonTitle:"Cancel",description:"This entity is not referenced by any location and is therefore not receiving updates. Click here to delete."},entityProcessingErrorsDescription:"The error below originates from",entityRelationWarningDescription:`This entity has relations to other entities, which can't be found in the catalog.
Entities not found are: `,hasComponentsCard:{title:"Has components",emptyMessage:"No component is part of this system"},hasResourcesCard:{title:"Has resources",emptyMessage:"No resource is part of this system"},hasSubcomponentsCard:{title:"Has subcomponents",emptyMessage:"No subcomponent is part of this component"},hasSubdomainsCard:{title:"Has subdomains",emptyMessage:"No subdomain is part of this domain"},hasSystemsCard:{title:"Has systems",emptyMessage:"No system is part of this domain"},relatedEntitiesCard:{emptyHelpLinkTitle:"Learn how to change this"},systemDiagramCard:{title:"System Diagram",description:"Use pinch & zoom to move around the diagram.",edgeLabels:{partOf:"part of",provides:"provides",dependsOn:"depends on"}}}})},124:(I,y,t)=>{t.r(y),t.d(y,{DependencyOfComponentsCard:()=>r});var e=t(31085),p=t(51372),c=t(48105),h=t(59251),C=t(90759),g=t(87849);function r(R){const{t:i}=(0,g.i)(C.W),{variant:S="gridItem",title:a=i("dependencyOfComponentsCard.title"),columns:m=c.mz,tableOptions:v={}}=R;return(0,e.jsx)(h.p,{variant:S,title:a,entityKind:"Component",relationType:p.fT,columns:m,emptyMessage:i("dependencyOfComponentsCard.emptyMessage"),emptyHelpLink:c.e2,asRenderableEntities:c.xJ,tableOptions:v})}},59251:(I,y,t)=>{t.d(y,{p:()=>E});var e=t(31085),p=t(72501),c=t(99538),h=t(6820),C=t(72427),g=t(73466),r=t(7341);function R(D,B){const n=B?.type?.toLocaleLowerCase("en-US"),o=B?.kind?.toLocaleLowerCase("en-US"),d=(0,C.gf)(r.v),{loading:j,value:T,error:P}=(0,g.A)(async()=>{const W=D.relations?.filter(A=>(!n||A.type.toLocaleLowerCase("en-US")===n)&&(!o||(0,h.KU)(A.targetRef).kind===o));if(!W?.length)return[];const{items:H}=await d.getEntitiesByRefs({entityRefs:W.map(A=>A.targetRef)});return H.filter(A=>!!A)},[D,n,o]);return{entities:T,loading:j,error:P}}var i=t(89648),S=t(48045),a=t(68146),m=t(58837),v=t(37197),l=t(8109),f=t(5951),x=t(77310),L=t(37916),u=t(22020);const M=(0,m.A)(D=>({text:{fontFamily:"monospace",whiteSpace:"pre",overflowX:"auto",marginRight:D.spacing(2)},divider:{margin:D.spacing(2)}}),{name:"BackstageResponseErrorPanel"});function K(D){const{title:B,error:n,defaultExpanded:o}=D,d=M();if(n.name!=="ResponseError")return(0,e.jsx)(u.b,{title:B??n.message,defaultExpanded:o,error:n});const{body:j,cause:T}=n,{request:P,response:W}=j,H=`${W.statusCode}: ${T.name}`,A=P&&`${P.method} ${P.url}`,U=T.message.replace(/\\n/g,`
`),F=T.stack?.replace(/\\n/g,`
`),k=JSON.stringify(j,void 0,2);return(0,e.jsxs)(u.b,{title:B??n.message,defaultExpanded:o,error:{name:H,message:U,stack:F},children:[A&&(0,e.jsxs)(l.A,{alignItems:"flex-start",children:[(0,e.jsx)(f.A,{classes:{secondary:d.text},primary:"Request",secondary:P?`${A}`:void 0}),(0,e.jsx)(L.l,{text:A})]}),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(v.A,{component:"li",className:d.divider}),(0,e.jsx)(l.A,{alignItems:"flex-start",children:(0,e.jsx)(f.A,{classes:{secondary:d.text},primary:"Full Error as JSON"})}),(0,e.jsx)(x.z,{language:"json",text:k,showCopyCodeButton:!0})]})]})}var N=t(72072),s=t(48105),O=t(90759),z=t(87849);const E=D=>{const{variant:B="gridItem",title:n,columns:o,entityKind:d,relationType:j,emptyMessage:T,emptyHelpLink:P,asRenderableEntities:W,tableOptions:H={}}=D,{t:A}=(0,z.i)(O.W),{entity:U}=(0,c.tN)(),{entities:F,loading:k,error:w}=R(U,{type:j,kind:d});return k?(0,e.jsx)(S.n,{variant:B,title:n,children:(0,e.jsx)(a.k,{})}):w?(0,e.jsx)(S.n,{variant:B,title:n,children:(0,e.jsx)(K,{error:w})}):(0,e.jsx)(i.s,{title:n,variant:B,emptyContent:(0,e.jsxs)("div",{style:{textAlign:"center"},children:[(0,e.jsx)(p.A,{variant:"body1",children:T}),(0,e.jsx)(p.A,{variant:"body2",children:(0,e.jsx)(N.N_,{to:P,externalLinkIcon:!0,children:A("relatedEntitiesCard.emptyHelpLinkTitle")})})]}),columns:o,entities:W(F||[]),tableOptions:H})};E.componentEntityColumns=s.mz,E.componentEntityHelpLink=s.e2,E.asComponentEntities=s.xJ,E.resourceEntityColumns=s.v9,E.resourceEntityHelpLink=s.nz,E.asResourceEntities=s.eB,E.systemEntityColumns=s.MW,E.systemEntityHelpLink=s.iU,E.asSystemEntities=s.vy,E.domainEntityColums=s.xO,E.domainEntityHelpLink=s.Xr,E.asDomainEntities=s.QS},48105:(I,y,t)=>{t.d(y,{MW:()=>R,QS:()=>v,Xr:()=>m,e2:()=>c,eB:()=>r,iU:()=>i,mz:()=>p,nz:()=>g,v9:()=>C,vy:()=>S,xJ:()=>h,xO:()=>a});var e=t(89648);const p=[e.s.columns.createEntityRefColumn({defaultKind:"component"}),e.s.columns.createOwnerColumn(),e.s.columns.createSpecTypeColumn(),e.s.columns.createSpecLifecycleColumn(),e.s.columns.createMetadataDescriptionColumn()],c="https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component",h=l=>l,C=[e.s.columns.createEntityRefColumn({defaultKind:"resource"}),e.s.columns.createOwnerColumn(),e.s.columns.createSpecTypeColumn(),e.s.columns.createSpecLifecycleColumn(),e.s.columns.createMetadataDescriptionColumn()],g="https://backstage.io/docs/features/software-catalog/descriptor-format#kind-resource",r=l=>l,R=[e.s.columns.createEntityRefColumn({defaultKind:"system"}),e.s.columns.createOwnerColumn(),e.s.columns.createMetadataDescriptionColumn()],i="https://backstage.io/docs/features/software-catalog/descriptor-format#kind-system",S=l=>l,a=[e.s.columns.createEntityRefColumn({defaultKind:"domain"}),e.s.columns.createOwnerColumn(),e.s.columns.createMetadataDescriptionColumn()],m="https://backstage.io/docs/features/software-catalog/descriptor-format#kind-domain",v=l=>l}}]);})();
//# sourceMappingURL=124.c8975198.chunk.js.map