UNPKG

@techdocs/cli

Version:

Utility CLI for managing TechDocs sites in Backstage.

6 lines (5 loc) • 16.2 kB
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[6271],{52235:(I,y,t)=>{var e,p=t(4293),d=t(78920);e={value:!0},y.A=void 0;var f=d(t(14041)),v=p(t(74044)),g=(0,v.default)(f.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),d=t(71677),f=t(72501);const v=(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 j=v(r);return(0,e.jsx)(d.Ay,{title:r.title??(r.text||""),placement:r.placement,children:(0,e.jsx)(f.A,{className:j.typo,variant:"inherit",children:r.text})})}},48045:(I,y,t)=>{t.d(y,{n:()=>B});var e=t(31085),p=t(40703),d=t(59469),f=t(48653),v=t(45685),g=t(37197),r=t(58837),j=t(87051),i=t(53373),S=t.n(i),a=t(10394),m=t(72501),C=t(52235),l=t(72072);const h=(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:s,title:c,onClick:L}=n,T=h();return(0,e.jsxs)(a.A,{children:[(0,e.jsx)(g.A,{}),(0,e.jsx)(l.N_,{to:s,onClick:L,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:c})})}),(0,e.jsx)(C.A,{className:T.arrow})]})})]})}var R=t(14041),u=t(73896),M=t(22020),K=t(10315),N=t(87849);const o=n=>{const{slackChannel:s}=n,{t:c}=(0,N.i)(K.O);if(s){if(typeof s=="string")return(0,e.jsx)(m.A,{children:c("errorBoundary.title",{slackChannel:s})});if(!s.href)return(0,e.jsx)(m.A,{children:c("errorBoundary.title",{slackChannel:s.name})})}else return null;return(0,e.jsx)(u.z,{to:s.href,variant:"contained",children:s.name})},O=class extends R.Component{constructor(s){super(s),this.state={error:void 0,errorInfo:void 0}}componentDidCatch(s,c){console.error(`ErrorBoundary, error: ${s}`,{error:s,errorInfo:c}),this.setState({error:s,errorInfo:c})}render(){const{slackChannel:s,children:c}=this.props,{error:L}=this.state;return L?(0,e.jsx)(M.b,{title:"Something Went Wrong",error:L,children:(0,e.jsx)(o,{slackChannel:s})}):c}},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,j.A)(n=>({root:{display:"inline-block",padding:n.spacing(8,8,0,0),float:"right"}}),{name:"BackstageInfoCardCardActionsTopRight"})(d.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:s,subheader:c,divider:L=!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=()=>!c&&!w?null:(0,e.jsxs)("div",{"data-testid":"info-card-subheader",children:[c&&(0,e.jsx)("div",{className:b.subheader,children:c}),w]}),st=W||(P?{slackChannel:P}:{});return(0,e.jsx)(p.A,{style:V,className:q,children:(0,e.jsxs)(O,{...st,children:[s&&(0,e.jsx)(v.A,{classes:{root:S()(b.header),title:b.headerTitle,subheader:b.headerSubheader,avatar:b.headerAvatar,action:b.headerAction,content:b.headerContent},title:s,subheader:nt(),action:Q,style:{...F},titleTypographyProps:tt,subheaderTypographyProps:et,...k}),J&&(0,e.jsx)(E,{children:J}),L&&(0,e.jsx)(g.A,{}),(0,e.jsx)(f.A,{className:S()(Z,{[b.noPadding]:_,[b.contentAlignBottom]:A==="bottom"}),style:Y,children:U}),$&&(0,e.jsx)(d.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),d=t(51372),f=t(48514),v=t(67871),g=t(90184),r=t(8859),j=t(34428);const i=Object.freeze({createEntityRefColumn(h){const{defaultKind:x}=h;function R(u){return u.metadata?.title||(0,g.S)(u,{defaultKind:x})}return{title:"Name",highlight:!0,customFilterAndSearch(u,M){return R(M).includes(u)},customSort(u,M){return R(u).localeCompare(R(M))},render:u=>(0,e.jsx)(r.z,{entityRef:u,defaultKind:x,title:u.metadata?.title})}},createEntityRelationColumn(h){const{title:x,relation:R,defaultKind:u,filter:M}=h;function K(o){return(0,v.t)(o,R,M)}function N(o){return K(o).map(O=>(0,g.S)(O,{defaultKind:u})).join(", ")}return{title:x,customFilterAndSearch(o,O){return N(O).includes(o)},customSort(o,O){return N(o).localeCompare(N(O))},render:o=>(0,e.jsx)(j.i,{entityRefs:K(o),defaultKind:u})}},createOwnerColumn(){return this.createEntityRelationColumn({title:"Owner",relation:d.vv,defaultKind:"group"})},createDomainColumn(){return this.createEntityRelationColumn({title:"Domain",relation:d.jn,defaultKind:"domain",filter:{kind:"domain"}})},createSystemColumn(){return this.createEntityRelationColumn({title:"System",relation:d.jn,defaultKind:"system",filter:{kind:"system"}})},createMetadataDescriptionColumn(){return{title:"Description",field:"metadata.description",render:h=>(0,e.jsx)(f.M,{text:h.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 C=(0,p.A)(h=>({empty:{padding:h.spacing(2),display:"flex",justifyContent:"center"}})),l=h=>{const{entities:x,title:R,emptyContent:u,variant:M="gridItem",columns:K,tableOptions:N={}}=h,o=C(),O={minWidth:"0",width:"100%"};return M==="gridItem"&&(O.height="calc(100% - 10px)"),(0,e.jsx)(m.X,{columns:K,title:R,style:O,emptyContent:u&&(0,e.jsx)("div",{className:o.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),d=t(25862),f=t(43836),v=t(10602);const g=(0,f.tK)("entity-context"),r=a=>{const{children:m,entity:C,loading:l,error:h,refresh:x}=a,R={entity:C,loading:l,error:h,refresh:x};return(0,e.jsx)(g.Provider,{value:(0,v.B)({1:R}),children:(0,e.jsx)(d.Ig,{attributes:{...C?{entityRef:(0,p.U2)(C)}:void 0},children:m})})},j=a=>_jsx(r,{entity:a.entity,loading:!a.entity,error:void 0,refresh:void 0,children:a.children});function i(){const a=(0,f.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,f.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:C,loading:l,error:h,refresh:x}=m;return{entity:C,loading:l,error:h,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"}}}})},56271:(I,y,t)=>{t.r(y),t.d(y,{HasResourcesCard:()=>r});var e=t(31085),p=t(51372),d=t(48105),f=t(59251),v=t(90759),g=t(87849);function r(j){const{t:i}=(0,g.i)(v.W),{variant:S="gridItem",title:a=i("hasResourcesCard.title"),columns:m=d.v9,tableOptions:C={}}=j;return(0,e.jsx)(f.p,{variant:S,title:a,entityKind:"Resource",relationType:p.sA,columns:m,asRenderableEntities:d.eB,emptyMessage:i("hasResourcesCard.emptyMessage"),emptyHelpLink:d.nz,tableOptions:C})}},59251:(I,y,t)=>{t.d(y,{p:()=>E});var e=t(31085),p=t(72501),d=t(99538),f=t(6820),v=t(72427),g=t(73466),r=t(7341);function j(D,B){const n=B?.type?.toLocaleLowerCase("en-US"),s=B?.kind?.toLocaleLowerCase("en-US"),c=(0,v.gf)(r.v),{loading:L,value:T,error:P}=(0,g.A)(async()=>{const W=D.relations?.filter(A=>(!n||A.type.toLocaleLowerCase("en-US")===n)&&(!s||(0,f.KU)(A.targetRef).kind===s));if(!W?.length)return[];const{items:H}=await c.getEntitiesByRefs({entityRefs:W.map(A=>A.targetRef)});return H.filter(A=>!!A)},[D,n,s]);return{entities:T,loading:L,error:P}}var i=t(89648),S=t(48045),a=t(68146),m=t(58837),C=t(37197),l=t(8109),h=t(5951),x=t(77310),R=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:s}=D,c=M();if(n.name!=="ResponseError")return(0,e.jsx)(u.b,{title:B??n.message,defaultExpanded:s,error:n});const{body:L,cause:T}=n,{request:P,response:W}=L,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(L,void 0,2);return(0,e.jsxs)(u.b,{title:B??n.message,defaultExpanded:s,error:{name:H,message:U,stack:F},children:[A&&(0,e.jsxs)(l.A,{alignItems:"flex-start",children:[(0,e.jsx)(h.A,{classes:{secondary:c.text},primary:"Request",secondary:P?`${A}`:void 0}),(0,e.jsx)(R.l,{text:A})]}),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(C.A,{component:"li",className:c.divider}),(0,e.jsx)(l.A,{alignItems:"flex-start",children:(0,e.jsx)(h.A,{classes:{secondary:c.text},primary:"Full Error as JSON"})}),(0,e.jsx)(x.z,{language:"json",text:k,showCopyCodeButton:!0})]})]})}var N=t(72072),o=t(48105),O=t(90759),z=t(87849);const E=D=>{const{variant:B="gridItem",title:n,columns:s,entityKind:c,relationType:L,emptyMessage:T,emptyHelpLink:P,asRenderableEntities:W,tableOptions:H={}}=D,{t:A}=(0,z.i)(O.W),{entity:U}=(0,d.tN)(),{entities:F,loading:k,error:w}=j(U,{type:L,kind:c});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:s,entities:W(F||[]),tableOptions:H})};E.componentEntityColumns=o.mz,E.componentEntityHelpLink=o.e2,E.asComponentEntities=o.xJ,E.resourceEntityColumns=o.v9,E.resourceEntityHelpLink=o.nz,E.asResourceEntities=o.eB,E.systemEntityColumns=o.MW,E.systemEntityHelpLink=o.iU,E.asSystemEntities=o.vy,E.domainEntityColums=o.xO,E.domainEntityHelpLink=o.Xr,E.asDomainEntities=o.QS},48105:(I,y,t)=>{t.d(y,{MW:()=>j,QS:()=>C,Xr:()=>m,e2:()=>d,eB:()=>r,iU:()=>i,mz:()=>p,nz:()=>g,v9:()=>v,vy:()=>S,xJ:()=>f,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()],d="https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component",f=l=>l,v=[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,j=[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",C=l=>l}}]);})(); //# sourceMappingURL=6271.a87d7ae1.chunk.js.map