UNPKG

@techdocs/cli

Version:

Utility CLI for managing TechDocs sites in Backstage.

7 lines (6 loc) • 10.4 kB
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[3182],{52235:(B,l,e)=>{var t,d=e(4293),m=e(78920);t={value:!0},l.A=void 0;var c=m(e(14041)),p=d(e(74044)),h=(0,p.default)(c.createElement("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward");l.A=h},48045:(B,l,e)=>{e.d(l,{n:()=>V});var t=e(31085),d=e(40703),m=e(59469),c=e(48653),p=e(45685),h=e(37197),g=e(58837),S=e(87051),b=e(53373),f=e.n(b),a=e(10394),i=e(72501),u=e(52235),v=e(72072);const C=(0,g.A)(o=>({root:{maxWidth:"fit-content",padding:o.spacing(2,2,2,2.5)},boxTitle:{margin:0,color:o.palette.textSubtle},arrow:{color:o.palette.textSubtle}}),{name:"BackstageBottomLink"});function x(o){const{link:n,title:r,onClick:L}=o,j=C();return(0,t.jsxs)(a.A,{children:[(0,t.jsx)(h.A,{}),(0,t.jsx)(v.N_,{to:n,onClick:L,underline:"none",children:(0,t.jsxs)(a.A,{display:"flex",alignItems:"center",className:j.root,children:[(0,t.jsx)(a.A,{className:j.boxTitle,fontWeight:"fontWeightBold",m:1,children:(0,t.jsx)(i.A,{children:(0,t.jsx)("strong",{children:r})})}),(0,t.jsx)(u.A,{className:j.arrow})]})})]})}var s=e(14041),E=e(73896),N=e(22020),M=e(10315),D=e(87849);const P=o=>{const{slackChannel:n}=o,{t:r}=(0,D.i)(M.O);if(n){if(typeof n=="string")return(0,t.jsx)(i.A,{children:r("errorBoundary.title",{slackChannel:n})});if(!n.href)return(0,t.jsx)(i.A,{children:r("errorBoundary.title",{slackChannel:n.name})})}else return null;return(0,t.jsx)(E.z,{to:n.href,variant:"contained",children:n.name})},O=class extends s.Component{constructor(n){super(n),this.state={error:void 0,errorInfo:void 0}}componentDidCatch(n,r){console.error(`ErrorBoundary, error: ${n}`,{error:n,errorInfo:r}),this.setState({error:n,errorInfo:r})}render(){const{slackChannel:n,children:r}=this.props,{error:L}=this.state;return L?(0,t.jsx)(N.b,{title:"Something Went Wrong",error:L,children:(0,t.jsx)(P,{slackChannel:n})}):r}},T=(0,g.A)(o=>({noPadding:{padding:0,"&:last-child":{paddingBottom:0}},contentAlignBottom:{display:"flex",alignItems:"self-end"},header:{padding:o.spacing(2,2,2,2.5)},headerTitle:{fontWeight:o.typography.fontWeightBold},headerSubheader:{paddingTop:o.spacing(1)},headerAvatar:{},headerAction:{},headerContent:{},subheader:{display:"flex"}}),{name:"BackstageInfoCard"}),A=(0,S.A)(o=>({root:{display:"inline-block",padding:o.spacing(8,8,0,0),float:"right"}}),{name:"BackstageInfoCardCardActionsTopRight"})(m.A),W={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 V(o){const{title:n,subheader:r,divider:L=!0,deepLink:j,slackChannel:k,errorBoundaryProps:z,variant:w,alignContent:K="normal",children:G,headerStyle:X,headerProps:$,icon:F,action:J,actionsClassName:Q,actions:H,cardClassName:Z,actionsTopRight:U,className:q,noPadding:_,titleTypographyProps:ee,subheaderTypographyProps:te}=o,y=T();let R={},I={};w&&w.split(/[\s]+/g).forEach(Y=>{R={...R,...W.card[Y]},I={...I,...W.cardContent[Y]}});const ne=()=>!r&&!F?null:(0,t.jsxs)("div",{"data-testid":"info-card-subheader",children:[r&&(0,t.jsx)("div",{className:y.subheader,children:r}),F]}),ae=z||(k?{slackChannel:k}:{});return(0,t.jsx)(d.A,{style:R,className:q,children:(0,t.jsxs)(O,{...ae,children:[n&&(0,t.jsx)(p.A,{classes:{root:f()(y.header),title:y.headerTitle,subheader:y.headerSubheader,avatar:y.headerAvatar,action:y.headerAction,content:y.headerContent},title:n,subheader:ne(),action:J,style:{...X},titleTypographyProps:ee,subheaderTypographyProps:te,...$}),U&&(0,t.jsx)(A,{children:U}),L&&(0,t.jsx)(h.A,{}),(0,t.jsx)(c.A,{className:f()(Z,{[y.noPadding]:_,[y.contentAlignBottom]:K==="bottom"}),style:I,children:G}),H&&(0,t.jsx)(m.A,{className:Q,children:H}),j&&(0,t.jsx)(x,{...j})]})})}},99538:(B,l,e)=>{e.d(l,{T7:()=>g,TY:()=>f,tN:()=>b});var t=e(31085),d=e(6820),m=e(25862),c=e(43836),p=e(10602);const h=(0,c.tK)("entity-context"),g=a=>{const{children:i,entity:u,loading:v,error:C,refresh:x}=a,s={entity:u,loading:v,error:C,refresh:x};return(0,t.jsx)(h.Provider,{value:(0,p.B)({1:s}),children:(0,t.jsx)(m.Ig,{attributes:{...u?{entityRef:(0,d.U2)(u)}:void 0},children:i})})},S=a=>_jsx(g,{entity:a.entity,loading:!a.entity,error:void 0,refresh:void 0,children:a.children});function b(){const a=(0,c.qO)("entity-context");if(!a)throw new Error("Entity context is not available");const i=a.atVersion(1);if(!i)throw new Error("EntityContext v1 not available");if(!i.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:i.entity}}function f(){const a=(0,c.qO)("entity-context");if(!a)throw new Error("Entity context is not available");const i=a.atVersion(1);if(!i)throw new Error("EntityContext v1 not available");const{entity:u,loading:v,error:C,refresh:x}=i;return{entity:u,loading:v,error:C,refresh:x}}},90759:(B,l,e)=>{e.d(l,{W:()=>d});var t=e(93184);const d=(0,t.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"}}}})},63182:(B,l,e)=>{e.r(l),e.d(l,{EntityLabelsCard:()=>C,hasLabels:()=>x});var t=e(31085),d=e(99538),m=e(48045),c=e(14209),p=e(64947),h=e(72501),g=e(58837),S=e(77310),b=e(90759),f=e(87849);const a=`metadata: name: example labels: javaVersion: 1.2.3`,i=(0,g.A)(s=>({code:{borderRadius:6,margin:s.spacing(2,0),background:s.palette.type==="dark"?"#444":s.palette.common.white}}),{name:"PluginCatalogEntityLabelsEmptyState"});function u(){const s=i(),{t:E}=(0,f.i)(b.W);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.A,{variant:"body1",children:E("entityLabelsCard.emptyDescription")}),(0,t.jsx)("div",{className:s.code,children:(0,t.jsx)(S.z,{text:a,language:"yaml",showLineNumbers:!0,highlightedNumbers:[3,4,5,6],customStyle:{background:"inherit",fontSize:"115%"}})}),(0,t.jsx)(p.A,{variant:"contained",color:"primary",target:"_blank",href:"https://backstage.io/docs/features/software-catalog/descriptor-format#labels-optional",children:E("entityLabelsCard.readMoreButtonTitle")})]})}const v=(0,g.A)(s=>({key:{fontWeight:"bold"}})),C=s=>{const{variant:E,title:N}=s,{entity:M}=(0,d.tN)(),D=v(),{t:P}=(0,f.i)(b.W),O=[{render:A=>(0,t.jsx)(h.A,{className:D.key,variant:"body2",children:A.key})},{field:"value"}],T=M?.metadata?.labels;return(0,t.jsx)(m.n,{title:N||P("entityLabelsCard.title"),variant:E,children:!T||Object.keys(T).length===0?(0,t.jsx)(u,{}):(0,t.jsx)(c.X,{columns:O,data:Object.keys(T).map(A=>({key:A,value:T[A]})),options:{search:!1,showTitle:!0,loadingType:"linear",header:!1,padding:"dense",pageSize:5,toolbar:!1,paging:Object.keys(T).length>5}})})};function x(s){return s?.metadata?.labels?Object.keys(s?.metadata?.labels).some(Boolean):!1}}}]);})(); //# sourceMappingURL=3182.59a654d7.chunk.js.map