@spotify/backstage-plugin-soundcheck 0.12.2 → 0.12.3
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 +29 -0
- package/README.md +2 -510
- package/alpha/package.json +1 -1
- package/dist/alpha.esm.js +1 -1
- package/dist/esm/Card-e2275abd.esm.js +2 -0
- package/dist/esm/CertificationSidebar-bfe066d3.esm.js +2 -0
- package/dist/esm/EmptyState-a3a6154f.esm.js +2 -0
- package/dist/esm/EntitySoundcheckContent-fae7d534.esm.js +2 -0
- package/dist/esm/OverviewPageContent-9845035d.esm.js +2 -0
- package/dist/esm/{RefetchingIndicator-b4961e02.esm.js → RefetchingIndicator-8312818a.esm.js} +2 -2
- package/dist/esm/index-8da96e46.esm.js +2 -0
- package/dist/esm/index-a862b329.esm.js +2 -0
- package/dist/esm/{index-f4bdaf5c.esm.js → index-e2ac1874.esm.js} +2 -2
- package/dist/esm/routes-06f9616b.esm.js +611 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/package.json +20 -18
- package/dist/esm/Card-2862fdca.esm.js +0 -2
- package/dist/esm/CertificationSidebar-5e4230a7.esm.js +0 -2
- package/dist/esm/EmptyState-6a402254.esm.js +0 -2
- package/dist/esm/EntitySoundcheckContent-bc7bdbe2.esm.js +0 -2
- package/dist/esm/OverviewPageContent-d5467d2c.esm.js +0 -2
- package/dist/esm/index-5610fc82.esm.js +0 -2
- package/dist/esm/index-99d39b7d.esm.js +0 -2
- package/dist/esm/routes-93cd1496.esm.js +0 -599
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{useState as te,useEffect as ae,useRef as re,createContext as ne,useContext as ie,useMemo as le}from"react";import{useApi as W,useRouteRef as y,useRouteRefParams as S}from"@backstage/core-plugin-api";import{useEntity as f}from"@backstage/plugin-catalog-react";import{Link as z,useParams as M,Routes as oe,Route as v,Navigate as R}from"react-router-dom";import{R as ce,c as C,d as se,u as L,a as N,e as de,b as me,f as pe,g as ue}from"./CertificationSidebar-bfe066d3.esm.js";import{useQuery as U}from"@tanstack/react-query";import{s as Q,R as u,b as x,a as w,d as O,f as B,c as j}from"./routes-06f9616b.esm.js";import{Q as ge,A as I,F as G,B as fe,L as Ee,a as he,N as ye,S as ve}from"./EmptyState-a3a6154f.esm.js";import{stringifyEntityRef as H}from"@backstage/catalog-model";import{makeStyles as g,Typography as k,Box as K,Tab as $,Tabs as V,styled as A,Accordion as ke,AccordionSummary as be,AccordionDetails as Ce,useTheme as Ie,Paper as Re,Divider as Ne}from"@material-ui/core";import{SpotifyLicenseBanner as xe}from"@spotify/backstage-plugin-core";import{s as we,i as Te}from"./license-e9e73904.esm.js";import{Skeleton as E}from"@material-ui/lab";import{i as Pe}from"./chartUtils-080232d7.esm.js";import{MarkdownContent as T,LinearGauge as Se,Link as Le}from"@backstage/core-components";import Be from"react-confetti";import $e from"react-use/lib/useMeasure";import Y from"react-use/lib/usePrevious";import{R as Ae}from"./RefetchingIndicator-8312818a.esm.js";import Fe from"classnames";import De from"@material-ui/icons/ExpandMore";import P from"lodash";import"@material-ui/icons/Schedule";import"luxon";import"graphql-request";import"graphql-tag";import"@backstage/core-compat-api";import"@material-ui/icons/Check";import"@material-ui/icons/Close";import"@material-ui/icons/HelpOutline";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/ReportProblemOutlined";import"../images/empty-state.svg";import"react-use/lib/useDebounce";import"react-use/lib/useUnmount";function We(t){const a=W(Q);return U([ge.CertificationDetails,t],async()=>a.getCertificationDetails(t))}function ze(t,a,r){const i=W(Q),n=H(t);return U(["soundcheck/check-details",n,a,r],async()=>i.getCheckResultDetails(n,a,r),{enabled:!!a&&!!r})}const Me=g({markdownContent:{"& :last-child":{marginBottom:0}}}),Ue=({state:t,notes:a})=>{const r=Me(),i={[u.Passed]:"success",[u.Failed]:"error",[u.Warning]:"warning",[u.NotReported]:"info",[u.NotApplicable]:"info"}[t],n={[u.Passed]:"Check passed",[u.Failed]:"Check did not pass",[u.Warning]:"Check produced warning(s)",[u.NotReported]:"Check not reported",[u.NotApplicable]:"Check not applicable"}[t];return e.createElement(I,{severity:i,title:n},a?e.createElement(T,{className:r.markdownContent,content:a}):null)},Qe=()=>{const t=q();return e.createElement(G,null,e.createElement("div",{className:t.root,"data-testid":"check-details-view"},e.createElement("div",{className:t.topBar},e.createElement(k,{variant:"h2",className:t.title},e.createElement(E,{width:300,height:32})),e.createElement(E,{width:100,height:32})),e.createElement(E,{variant:"rect",height:120}),e.createElement("div",{"data-testid":"soundcheck-check-details-description"},e.createElement(k,{variant:"h3"},e.createElement(E,null)),e.createElement(E,null),e.createElement(E,null),e.createElement(E,null))))},q=g(t=>({root:{padding:`${t.spacing(3)}px ${t.spacing(5)}px`},title:{fontWeight:"normal",fontSize:t.typography.h5.fontSize},description:{padding:`${t.spacing(3)}px 0`},subtitle:{fontWeight:"normal",fontSize:t.typography.h6.fontSize},topBar:{display:"flex",justifyContent:"space-between",marginBottom:t.spacing(2)}})),J=({programId:t,checkId:a})=>{const r=q(),{entity:i}=f(),{data:n,isLoading:l,isError:o}=ze(i,t,a);if(o)return e.createElement(K,{padding:2},e.createElement(I,{severity:"error",title:"Error loading check details"}));if(l||!t||!a)return e.createElement(Qe,null);if(!n)return null;const{name:c,description:m,result:d,timestamp:s,notes:p}=n;return e.createElement("div",{className:r.root,"data-testid":"check-details-view"},e.createElement("div",{className:r.topBar},e.createElement(k,{variant:"h2",className:r.title},c),s?e.createElement(ce,{timestamp:s,description:"Last updated"}):null),e.createElement(Ue,{state:d,notes:p}),e.createElement("div",{className:r.description,"data-testid":"soundcheck-check-details-description"},e.createElement(k,{variant:"h3",className:r.subtitle},"Description"),e.createElement(T,{content:m})))},Oe=g(()=>({root:{position:"absolute",width:"100%",height:"100%"}})),je=({programId:t})=>{var a,r;const i=Oe(),{entity:n}=f(),{data:l,isLoading:o}=C(n,t),[c,{width:m,height:d}]=$e(),s=o?void 0:(r=(a=l==null?void 0:l.highestLevel)==null?void 0:a.ordinal)!=null?r:-1,p=Y(s),h=Y(t),[ee,D]=te(!1);return ae(()=>{typeof p!="undefined"&&typeof s!="undefined"&&t===h&&s>p&&D(!0)},[s,p,t,h]),ee?e.createElement("div",{ref:c,className:i.root},e.createElement(Be,{width:m,height:d,numberOfPieces:1e3,gravity:1,initialVelocityY:20,recycle:!1,onConfettiComplete:()=>D(!1)})):null},X=g(t=>({root:{maxWidth:"80ch",textTransform:"uppercase",paddingTop:t.spacing(2),paddingBottom:t.spacing(2)},wrapper:{display:"inline-block",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},badge:{marginRight:t.spacing(1)}})),Ge=({id:t,name:a,badge:r,href:i,selected:n=!1})=>{const l=X(),{entity:o}=f(),{data:c}=C(o,t);return e.createElement($,{className:l.root,classes:{wrapper:l.wrapper},value:t,label:e.createElement(e.Fragment,null,e.createElement(se,{badge:r,trackType:c==null?void 0:c.program.type,className:l.badge}),a),component:z,to:i,selected:n})},He=g({root:{borderColor:"currentColor",borderStyle:"solid"}}),Ke=({className:t,size:a="small"})=>{const r=He();return e.createElement(fe,{className:Fe(t,r.root),size:a,label:"\u25BA"})},Ve=g(t=>({root:{maxWidth:"80ch",textTransform:"uppercase",paddingTop:t.spacing(2),paddingBottom:t.spacing(2)},wrapper:{display:"inline-block",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},badge:{marginRight:t.spacing(1)}})),Ye=({id:t,name:a,href:r,selected:i=!1})=>{const n=Ve();return e.createElement($,{className:n.root,classes:{wrapper:n.wrapper},value:t,label:e.createElement(e.Fragment,null,e.createElement(Ke,{className:n.badge}),a),component:z,to:r,selected:i})},F=()=>{const t=X();return e.createElement($,{className:t.root,classes:{wrapper:t.wrapper},label:e.createElement(E,{width:180})})},qe=()=>e.createElement(G,null,e.createElement(V,{value:!1,indicatorColor:"primary"},e.createElement(F,null),e.createElement(F,null),e.createElement(F,null)));function Je(t=[],a=[],r,i){if(r){const l=t.findIndex(o=>o.id===r);return l<0?!1:l}const n=a.findIndex(l=>l.program.id===i);return n<0?!1:n+t.length}const Xe=({playlistId:t,trackId:a})=>{const{entity:r}=f(),{isLoading:i,data:n}=L(r),{isLoading:l,data:o}=N(r),c=y(x),m=y(w);if(l||i||!a)return e.createElement(qe,null);const d=Je(o,n,t,a);return e.createElement(V,{value:d,indicatorColor:"primary","aria-label":"Certifications",variant:"scrollable"},(o==null?void 0:o.length)&&o.map(({id:s,name:p})=>e.createElement(Ye,{key:s,id:s,name:p,selected:s===a,href:c({playlistId:s})})),n&&n.filter(({program:{type:s}})=>s!=="playlist").map(({program:{id:s,name:p},highestLevel:h})=>e.createElement(Ge,{key:s,id:s,name:p,badge:h==null?void 0:h.badge,selected:s===a,href:m({trackId:s})})))},Ze=A(ke)(({theme:t})=>({margin:"0",border:`1px solid ${t.palette.divider}`,borderRadius:0,"&.Mui-expanded":{borderRadius:0},"&:first-child":{borderTopLeftRadius:0,borderTopRightRadius:0},"&:last-child":{borderBottomLeftRadius:0,borderBottomRightRadius:0},"&:not(:first-child)":{borderTop:`1px solid ${t.palette.divider}`},"&:not(:last-child)":{marginBottom:t.spacing(1)}})),_e=A(({...t})=>e.createElement(be,{classes:{content:"content",expanded:"expanded"},...t}))(({theme:t})=>({borderRadius:0,paddingTop:0,paddingLeft:0,paddingRight:t.spacing(1),"& > .content":{margin:"0 !important",padding:"0 !important"},"& > .content.expanded":{margin:"0 !important",padding:"0 !important"}})),et=A(Ce)(()=>({margin:"0 !important",borderRadius:0,padding:0})),tt=g(()=>({sidebar:{width:"100%"}})),at=({playlistId:t,trackId:a,checkId:r})=>{var i;const n=tt(),{entity:l}=f(),o=re(null),{data:c,isLoading:m,isError:d}=C(l,a);if(d)return e.createElement("div",null,e.createElement(K,{padding:2},e.createElement(I,{severity:"error",title:"Error loading certification"})));if(m||!a)return e.createElement(de,null);if(!c)return null;const s=c.program.type==="campaign";return e.createElement(Ze,{ref:o,defaultExpanded:!0,elevation:0},e.createElement(_e,{expandIcon:e.createElement(De,null),"aria-controls":"certification-content",id:"certification-summary"},e.createElement(me,{name:c.program.name,badge:(i=c.highestLevel)==null?void 0:i.badge,description:c.program.description,documentationUrl:c.program.documentationURL,trackType:c.program.type})),e.createElement(et,null,e.createElement("div",{className:n.sidebar},c==null?void 0:c.levels.map(p=>e.createElement(pe,{key:p.ordinal,level:p,checkId:r,trackId:a,playlistId:t,isCampaign:s})))))},Z=ne(void 0),rt=()=>{const t=ie(Z);if(!t)throw new Error("useAPlaylistCertificationContext must be used within an PlaylistCertificationProvider");return t},nt=t=>{const{children:a,entityRef:r}=t,i=We(r);return e.createElement(Z.Provider,{value:i},a)},it=(t,a)=>{if(a)return a.filter(r=>t.trackIds.includes(r.program.id)).map(r=>{const i=P.sumBy(r.levels,o=>P.filter(o.checks,{result:u.Passed}).length),n=P.sumBy(r.levels,o=>P.reject(o.checks,{result:u.NotApplicable}).length),l=n===0?0:i/n;return{id:r.program.id,name:r.program.name,checkPassRate:l}})},lt=g(()=>({root:{margin:0,width:"250px"},trackItem:{display:"flex",flexDirection:"column",alignItems:"flex-start"},badgeAndName:{display:"flex",flexDirection:"row",alignItems:"center"},trackName:{marginLeft:"8px"}})),ot=({playlist:t})=>{const a=lt(),{data:r}=rt(),i=Ie(),n=le(()=>it(t,r),[r,t]);return e.createElement("div",{className:a.root},n&&n.map(l=>{var o,c;const m=(c=(o=r==null?void 0:r.find(d=>d.program.id===l.id))==null?void 0:o.highestLevel)==null?void 0:c.badge;return e.createElement("div",{className:a.trackItem,key:l.id},e.createElement("div",{className:a.badgeAndName},m?e.createElement(Ee,{badge:m}):e.createElement(he,null),e.createElement(k,{variant:"caption",color:"textSecondary",className:a.trackName},l.name)),e.createElement("div",{style:{width:"100%",marginBottom:"8px"}},e.createElement(Se,{value:l.checkPassRate,getColor:()=>i.palette.status.ok})))}))},_=g(t=>({description:{padding:0,margin:0,display:"block","& p":{margin:0}},root:{padding:t.spacing(2),margin:0,display:"grid",gridTemplateColumns:"min-content auto",gridGap:t.spacing(2)},title:{fontSize:t.typography.pxToRem(18),fontWeight:700,lineHeight:1.235,marginBottom:"6px"},level:{textTransform:"uppercase",color:t.palette.text.secondary,fontWeight:700,letterSpacing:"1px"}}));function ct({description:t,documentationUrl:a}){const r=_();return a?e.createElement("div",{className:r.description},e.createElement(T,{content:t}),e.createElement(Le,{to:a},"Learn more")):e.createElement("div",{className:r.description},e.createElement(T,{content:t}))}const st=({playlist:t})=>{const a=_(),{name:r,description:i}=t;return e.createElement("div",{className:a.root},e.createElement(ot,{playlist:t}),e.createElement("div",null,e.createElement(k,{className:a.title},r),i&&e.createElement(ct,{description:i,documentationUrl:void 0})))},dt=g(t=>({root:{margin:0,display:"grid",gridTemplateColumns:"1fr",backgroundColor:t.palette.background.default},header:{backgroundColor:t.palette.background.paper,borderBottom:`1px solid ${t.palette.divider}`},section:{backgroundColor:t.palette.background.paper,border:`1px solid ${t.palette.divider}`,padding:0,marginTop:t.spacing(1),marginBottom:t.spacing(1),marginLeft:0,marginRight:t.spacing(1)},twoColumns:{display:"grid",gridTemplateColumns:"1fr 2fr"},sidebar:{display:"grid",gridTemplateColumns:"1fr",margin:t.spacing(1)}})),mt=({playlist:t,entityRef:a})=>{const r=dt(),{trackId:i,checkId:n}=M();return e.createElement("div",{className:r.root},e.createElement(nt,{entityRef:a},e.createElement("div",{className:r.header},e.createElement(st,{playlist:t,entityRef:a})),e.createElement("div",{className:r.twoColumns},e.createElement("div",{className:r.sidebar},t.trackIds.map(l=>e.createElement(at,{key:l,playlistId:t.id,trackId:l,checkId:n}))),e.createElement("div",{className:r.section},e.createElement(J,{programId:i,checkId:n})))))},pt=g(t=>({paper:{overflow:"hidden",position:"relative",border:Pe(t)?`1px solid ${t.palette.divider}`:void 0},view:{display:"grid",gridTemplateColumns:"1fr 2fr"},sidebar:{borderRight:`1px solid ${t.palette.divider}`}})),ut=()=>{const{playlistId:t,trackId:a,checkId:r}=M(),i=pt(),{entity:n}=f(),{isError:l,isFetched:o,data:c}=L(n),{isError:m,data:d}=N(n);if(l||m)return e.createElement(I,{severity:"error",title:"Error loading certifications"});const s=t&&(d==null?void 0:d.find(h=>h.id===t));if(t&&!s)return e.createElement(I,{severity:"error",title:"Playlist ${playlistId} not found."});if(o&&!(c!=null&&c.length))return e.createElement(ye,null);const p=n?H(n):void 0;return e.createElement(Re,{className:i.paper},e.createElement(Ae,null),e.createElement(Xe,{playlistId:t,trackId:a}),e.createElement(Ne,null),s&&e.createElement(mt,{playlist:s,entityRef:p}),!s&&a&&e.createElement("div",{"data-testid":"soundcheck-certification-view",className:i.view},e.createElement("div",{className:i.sidebar},e.createElement(ue,{trackId:a,checkId:r})),e.createElement(J,{programId:a,checkId:r}),e.createElement(je,{programId:a})))},gt=g(t=>({root:{"&:not(:first-child)":{marginTop:t.spacing(2)}}})),b=()=>{const t=gt();return e.createElement(e.Fragment,null,e.createElement(xe,{backend:we,invalidLicenseMessage:Te,inline:!0}),e.createElement("div",{className:t.root},e.createElement(ut,null)))},ft=()=>{var t,a;const{entity:r}=f(),i=y(x),n=y(w),{isLoading:l,data:o}=N(r),{isLoading:c,data:m}=L(r);if(l||c)return null;const d=(t=o==null?void 0:o[0])==null?void 0:t.id,s=(a=m==null?void 0:m[0])==null?void 0:a.program.id;return!d&&!s?null:e.createElement(R,{to:d?i({playlistId:d}):n({trackId:s}),replace:!0})},Et=()=>{var t;const{entity:a}=f(),{playlistId:r}=S(x),i=y(B),{data:n}=N(a),l=(t=n==null?void 0:n.find(o=>o.id===r))==null?void 0:t.trackIds[0];return l?e.createElement(R,{to:i({playlistId:r,trackId:l}),replace:!0}):null},ht=()=>{var t,a;const{entity:r}=f(),{playlistId:i,trackId:n}=S(B),{data:l}=C(r,n),o=y(O),c=(a=(t=l==null?void 0:l.levels[0])==null?void 0:t.checks[0])==null?void 0:a.id;return c?e.createElement(R,{to:o({playlistId:i,trackId:n,checkId:c}),replace:!0}):null},yt=()=>{var t,a;const{entity:r}=f(),{trackId:i}=S(w),n=y(j),{data:l}=C(r,i),o=(a=(t=l==null?void 0:l.levels[0])==null?void 0:t.checks[0])==null?void 0:a.id;return o?e.createElement(R,{to:n({trackId:i,checkId:o}),replace:!0}):null},vt=()=>e.createElement(oe,null,e.createElement(v,{path:O.path,element:e.createElement(b,null)}),e.createElement(v,{path:B.path,element:e.createElement(e.Fragment,null,e.createElement(b,null),e.createElement(ht,null))}),e.createElement(v,{path:x.path,element:e.createElement(e.Fragment,null,e.createElement(b,null),e.createElement(Et,null))}),e.createElement(v,{path:w.path,element:e.createElement(e.Fragment,null,e.createElement(b,null),e.createElement(yt,null))}),e.createElement(v,{path:j.path,element:e.createElement(b,null)}),e.createElement(v,{path:"/",element:e.createElement(e.Fragment,null,e.createElement(b,null),e.createElement(ft,null))})),kt=()=>e.createElement(ve,null,e.createElement(vt,null));export{kt as EntitySoundcheckContent};
|
|
2
|
+
//# sourceMappingURL=EntitySoundcheckContent-fae7d534.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{stringifyEntityRef as V,parseEntityRef as W}from"@backstage/catalog-model";import{useApi as R,identityApiRef as oe,configApiRef as ie,useRouteRef as F}from"@backstage/core-plugin-api";import{catalogApiRef as M,EntityRefLink as se,humanizeEntityRef as G,entityRouteRef as U}from"@backstage/plugin-catalog-react";import t,{createContext as Ye,useState as S,useEffect as I,useContext as Ze,useMemo as D,useCallback as O,memo as z,Fragment as et,useRef as tt,useLayoutEffect as at}from"react";import nt from"react-use/lib/useAsync";import{makeStyles as k,alpha as ce,TextField as rt,CircularProgress as de,Grid as x,Typography as f,Button as lt,Menu as ot,MenuItem as me,TablePagination as pe,withStyles as it,Tooltip as ue,LinearProgress as st,Accordion as ct,AccordionSummary as dt,AccordionDetails as mt}from"@material-ui/core";import pt from"@material-ui/lab/Autocomplete";import{useSearchParams as Z,useNavigate as ut}from"react-router-dom";import gt from"react-use/lib/useLocalStorage";import{useQuery as L}from"@tanstack/react-query";import{s as _,h as ft,i as ht,R as A,B as yt,j as vt}from"./routes-06f9616b.esm.js";import{Q as K,C as Et,L as ge,a as fe,b as he,A as kt,N as bt,d as Ct}from"./EmptyState-a3a6154f.esm.js";import{HeaderTabs as ye,MarkdownContent as wt,Link as j,EmptyState as Rt}from"@backstage/core-components";import Nt from"@material-ui/icons/ExpandMore";import xt from"@material-ui/icons/ArrowDropDown";import Pt from"@material-ui/icons/ArrowDropUp";import{makeStyles as ve}from"@material-ui/core/styles";import{motion as Ee}from"framer-motion";import{R as $t}from"./RefetchingIndicator-8312818a.esm.js";import Tt,{countBy as ke}from"lodash";import{Skeleton as Q}from"@material-ui/lab";import{VariableSizeGrid as St}from"react-window";function be(e,a,n,r){const l=R(_);return L(["soundcheck/track-overview-for-owner",e,a,n,r],async()=>l.getProgramOverviewForOwner(e,a,n,r),{enabled:!!e&&!!(a!=null&&a.kind),staleTime:5*60*1e3,refetchInterval:!1,refetchOnWindowFocus:!1})}function Ce(){const e=R(M);return L(["soundcheck/all-groups"],async()=>{const{items:a}=await e.getEntities({filter:{kind:"Group"},fields:["spec.profile.displayName","metadata.title","metadata.name","metadata.namespace","kind"]});return a.filter(n=>(n==null?void 0:n.kind)==="Group").map(n=>{var r,l,i,o;return{name:(o=(i=(l=(r=n.spec)==null?void 0:r.profile)==null?void 0:l.displayName)!=null?i:n.metadata.title)!=null?o:n.metadata.name,ref:V(n)}})},{staleTime:5*60*1e3,refetchInterval:!1,refetchOnWindowFocus:!1})}function It(){const e=R(oe),a=R(M);return L(["soundcheck/user-groups-claims"],async()=>{const{ownershipEntityRefs:n}=await e.getBackstageIdentity();return(await a.getEntitiesByRefs({entityRefs:n})).items.filter(r=>(r==null?void 0:r.kind)==="Group").map(r=>{var l,i,o,d,s;return{name:(d=(o=(i=(l=r.spec)==null?void 0:l.profile)==null?void 0:i.displayName)!=null?o:r.metadata.title)!=null?d:r.metadata.name,ref:V(r),type:(s=r.spec)==null?void 0:s.type}})})}function we(e){const a=R(_);return L([K.GetCampaigns,JSON.stringify(e)],async()=>a.getCampaigns(e),{staleTime:5*60*1e3,refetchInterval:!1,refetchOnWindowFocus:!1})}function Lt(e){const a=R(_);return L(["soundcheck/facets-for-owner",e],async()=>a.getFacetsForOwner(e),{enabled:!!e,staleTime:5*60*1e3,refetchInterval:!1,refetchOnWindowFocus:!1})}const Re=e=>{const a=R(_);return L([K.GetIndividualEntityPassRateSnapshots,{...e,numberOfDays:0}],async()=>a.getIndividualEntityPassRates({...e,numberOfDays:0}),{staleTime:5*60*1e3,refetchInterval:!1,refetchOnWindowFocus:!1})},Ne={loading:!0},xe=Ye(Ne),Ft=()=>Ze(xe),Ot=({children:e})=>{const[a,n]=S(Ne),r=R(M),l=R(oe),{value:i,loading:o,error:d}=nt(async()=>{const[{token:s},c]=await Promise.all([l.getCredentials(),l.getBackstageIdentity()]);return s?await r.getEntityByRef(c.userEntityRef):null},[r,l]);return I(()=>{if(i){const s=V(i);n({user:i,userEntityRef:s,loading:o,error:d})}else n({loading:o,error:d})},[i,o,d]),t.createElement(xe.Provider,{value:a},e)},Pe=()=>{const{data:e,isLoading:a,isError:n}=It(),{data:r,isLoading:l,isError:i}=Ce();return{options:D(()=>{const o=new Map;return e&&e.forEach(({name:d,ref:s,type:c})=>{o.set(`${s}`,{name:d,ref:s,type:c,key:"My Groups"})}),r&&r.forEach(({name:d,ref:s})=>{o.has(`${s}`)||o.set(`${s}`,{name:d,ref:s,key:"All Groups"})}),[...o.values()]},[e,r]),isLoading:a||l,isError:n||i}},zt=k(e=>({root:{width:"100%",minWidth:250},textField:{"& $notchedOutline":{borderColor:ce(e.page.fontColor,.25)},"&:hover $notchedOutline":{borderColor:e.page.fontColor}},input:{backgroundColor:"transparent",color:e.page.fontColor},clearIndicator:{color:e.page.fontColor},popupIndicator:{color:e.page.fontColor},notchedOutline:{}}),{name:"SoundcheckGroupSelector"}),At=({setError:e})=>{const{options:a,isLoading:n,isError:r}=Pe(),l=zt(),[i,o]=Z(),[d,s]=gt("soundcheck.overview.groupRef",null),c=i.get("group"),p=R(ie).getOptionalString("soundcheck.overview.defaultSelectedGroupType"),h=D(()=>{var u,y;if(!n&&a.length){if(c||d){const v=c!=null?c:d;return(u=a.find(E=>E.ref===v))!=null?u:a[0]}else if(p)return(y=a.find(v=>v.type===p))!=null?y:a[0];return a[0]}return null},[p,n,a,c,d]),m=O((u,y)=>{u&&i.get("group")!==u&&(i.set("group",u),o(i,{replace:y}),s(u))},[i,s,o]),g=O((u,y)=>{m==null||m(y==null?void 0:y.ref)},[m]);return I(()=>{d&&!c&&m(d,!0)},[d,c,m]),I(()=>{m(h==null?void 0:h.ref,!0)},[m,h]),I(()=>{e==null||e(r?new Error("Error loading groups"):void 0)},[r,e]),r?null:t.createElement(pt,{"aria-label":"Current group",className:l.root,classes:{clearIndicator:l.clearIndicator,popupIndicator:l.popupIndicator},disableClearable:!0,options:a!=null?a:[],loading:n,groupBy:u=>u.key,value:h,freeSolo:!1,onChange:g,getOptionLabel:u=>u.name,renderInput:u=>t.createElement(rt,{...u,variant:"outlined",placeholder:n?"Loading":"Select a group",className:l.textField,InputProps:{...u.InputProps,className:l.input,classes:{notchedOutline:l.notchedOutline},endAdornment:t.createElement(t.Fragment,null,n?t.createElement(de,{color:"inherit",size:20}):null,u.InputProps.endAdornment)}})})},Bt=k(e=>({loadingContainer:{marginTop:e.spacing(1),display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}})),$e=({size:e})=>{const a=Bt();return t.createElement(x,{container:!0,className:a.loadingContainer},t.createElement(de,{size:e}))},Wt=ve(e=>({detailRow:{marginBottom:e.spacing(1)},label:{fontWeight:"bold",color:e.palette.text.primary},value:{marginLeft:e.spacing(1)}})),B=({label:e,value:a})=>{const n=Wt();return t.createElement(x,{item:!0,xs:12,container:!0,className:n.detailRow,alignItems:"center"},t.createElement(f,{variant:"subtitle1",className:n.label},e,":"),t.createElement(f,{variant:"body1",display:"inline",className:n.value},a))},Dt=ve(e=>({innerContainer:{padding:e.spacing(0,1)},sectionLabel:{fontWeight:700,margin:e.spacing(2,0),color:e.palette.primary.main}})),J=e=>new Date(e).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),Mt=({campaign:e})=>{const a=Dt(),{name:n,description:r,ownerEntityRef:l,startDate:i,targetCompletionDate:o,supportChannel:d}=e;return t.createElement(t.Fragment,null,t.createElement(f,{variant:"h6",className:a.sectionLabel},"Campaign details"),t.createElement(x,{container:!0,className:a.innerContainer,spacing:2},t.createElement(x,{item:!0,container:!0,xs:12,spacing:0},t.createElement(B,{label:"Name",value:n}),t.createElement(B,{label:"Description",value:r}),t.createElement(B,{label:"Owner",value:t.createElement(se,{entityRef:l})}),d&&t.createElement(B,{label:"Support channel",value:d}),t.createElement(B,{label:"Start date",value:J(i)}),t.createElement(B,{label:"Target completion date",value:J(o)}))))};function Gt({angle:e,arc:a,direction:n,dist:r,emoji:l,delay:i,fontSize:o,speed:d}){return t.createElement(Ee.div,{style:{position:"absolute",fontSize:o},initial:{top:0,left:"50%",x:"-50%",y:"-100%",rotate:0,originX:`${a*n}px`,originY:`${a}px`},animate:{opacity:[0,1,0,0,0,0],y:`${-r}px`,rotate:e*n},transition:{delay:i,duration:d,ease:[.2,.83,.46,.63],repeat:1/0}},l)}const jt=["\u{1F4C8}","\u{1F4CA}","\u{1F4C9}","\u{1F680}","\u2B50\uFE0F"],Ht=k(()=>({container:{position:"relative"}}));function Vt({angle:e=125,density:a=20,emojis:n=jt,fontSizeMin:r=6,fontSizeMax:l=24,size:i=300,speed:o=4}){const d=Ht(),s=D(()=>Array.from({length:a*n.length}).map((c,p)=>({emoji:n[Math.floor(Math.random()*n.length)],arc:Math.random()*i*.5,delay:Math.random()*o,dist:Math.random()*i,direction:p%2?1:-1,fontSize:Math.random()*(l-r)+r,angle:e,speed:o})),[a,n,o,i,e,l,r]);return t.createElement("div",{className:d.container},t.createElement(f,{variant:"h1"},"\u{1F469}\u200D\u{1F4BB}"),s.map((c,p)=>t.createElement(Gt,{key:`${c.emoji}-${p}`,...c})))}const Ut=k(()=>({container:{position:"relative",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flex:1,height:"100%"},textContainer:{position:"relative",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}}));function Te({title:e,subtitle:a}){const n=Ut();return t.createElement("div",{className:n.container},t.createElement("div",{className:n.textContainer},t.createElement(Vt,null),t.createElement(Ee.div,{animate:{y:0,opacity:1},initial:{y:100,opacity:0}},e&&t.createElement(f,{align:"center",variant:"h6"},e),a&&t.createElement(f,{align:"center",variant:"subtitle2"},a))))}const _t=k(e=>({campaignCards:{display:"flex",flexDirection:"column"},campaignCard:{display:"flex",flexDirection:"column",border:`1px solid ${e.palette.border}`,padding:e.spacing(2),gap:e.spacing(5),borderRadius:e.shape.borderRadius},actions:{display:"flex",alignItems:"center",gap:e.spacing(1)},actionsText:{textTransform:"lowercase","&:first-letter":{textTransform:"uppercase"}},flexRow:{display:"flex",gap:e.spacing(1)},campaignDescription:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},progress:{display:"flex",alignItems:"center",gap:e.spacing(1),width:"90%"},flexColumn:{width:"100%",display:"flex",flexDirection:"column",gap:e.spacing(1)},detailSection:{display:"flex",flexDirection:"row",justifyContent:"space-between",gap:e.spacing(.5)},label:{fontWeight:"bold",color:e.palette.text.primary},value:{marginTop:"2px"},description:{maxWidth:"90%"}})),Kt=e=>{var a;let n=0;return e==null||e.forEach(({snapshotPassRate:r})=>{n+=r}),Math.round(n/((a=e==null?void 0:e.length)!=null?a:1))},Qt=e=>e==null?void 0:e.filter(({snapshotPassRate:a})=>a===100).length,Jt=e=>{if(e!=null&&e.length){const a=Qt(e);return t.createElement(f,{variant:"body2"},a,"/",e.length)}return t.createElement(f,{variant:"body2"},"No progress found.")},Xt=({campaign:e})=>{var a;const n=_t(),r=F(ft),l=F(ht),i=ut(),[o,d]=S(null),s=150,c=e.track.levels.flatMap(({checks:Y})=>Y.map(({id:qe})=>qe)),{data:p,isLoading:h,isError:m}=Re({tracks:[{trackId:e.track.id}],checkIds:{included:c}}),g=(a=p==null?void 0:p.individualEntityPassRates)!=null?a:[],u=Y=>{d(Y.currentTarget)},y=()=>{d(null)},v=()=>{i(l({campaignId:e.id}))},E=()=>{i(r({campaignId:e.id}))};if(h)return t.createElement("div",{"data-testid":"loading-indicator"},t.createElement(Te,null));if(m)return t.createElement(f,{color:"error"},"Failed to load campaigns progress.");const w=g.length?Kt(g):0,N=Jt(g),{name:T,description:b,ownerEntityRef:C,targetCompletionDate:P,startDate:q,supportChannel:le}=e;return t.createElement("div",{className:n.campaignCards},t.createElement("div",{className:n.campaignCard},t.createElement("div",{className:n.flexRow,style:{justifyContent:"space-between"}},t.createElement("div",{className:n.flexColumn},t.createElement(f,{variant:"h5"},T),t.createElement(f,{variant:"body1",className:n.description},b.length>s?`${b.substring(0,s)}...`:b)),t.createElement("div",null,t.createElement(lt,{variant:"text","aria-controls":"menu","aria-haspopup":"true",onClick:u},t.createElement("div",{className:n.actions},t.createElement("div",{className:n.actionsText},"Actions"),t.createElement("div",{className:n.flexRow},o?t.createElement(Pt,{fontSize:"small"}):t.createElement(xt,{fontSize:"small"})))),t.createElement(ot,{id:"campaign-menu",anchorEl:o,keepMounted:!0,open:!!o,onClose:y},t.createElement(me,{onClick:E},"View"),t.createElement(me,{onClick:v},"Edit")))),t.createElement("div",{className:n.detailSection},t.createElement("div",{className:n.flexColumn},t.createElement("div",{className:n.flexRow},t.createElement(f,{variant:"subtitle1",className:n.label},"Owner:"),t.createElement(f,{variant:"body1",display:"inline",className:n.value},t.createElement(se,{entityRef:C}))),le&&t.createElement("div",{className:n.flexRow},t.createElement(f,{variant:"subtitle1",className:n.label},"Support Channel:"),t.createElement(f,{variant:"body1",display:"inline",className:n.value},le))),t.createElement("div",{className:n.flexColumn},t.createElement("div",{className:n.flexRow},t.createElement(f,{variant:"subtitle1",className:n.label},"Start Date:"),t.createElement(f,{variant:"body1",display:"inline",className:n.value},J(q))),t.createElement("div",{className:n.flexRow},t.createElement(f,{variant:"subtitle1",className:n.label},"Target Completion Date:"),t.createElement(f,{variant:"body1",display:"inline",className:n.value},J(P)))),t.createElement("div",{className:n.flexRow,style:{minWidth:"300px"}},t.createElement("div",{className:n.flexColumn},t.createElement(f,{variant:"subtitle1",className:n.label},"Checks Passing"),t.createElement(f,{variant:"body2"},w,"%")),t.createElement("div",{className:n.flexColumn},t.createElement(f,{variant:"subtitle1",className:n.label},"Entities Complete"),N)))))},qt=k(e=>({root:{borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`},tab:{textTransform:"uppercase",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)}})),Yt=({unfilteredFacets:e,onChange:a,kind:n,type:r})=>{var l,i,o;const d=qt(),s={types:(l=e==null?void 0:e.types.filter(({count:m})=>m>0))!=null?l:[]},c=O(m=>{var g;a((g=s==null?void 0:s.types[m].kind)!=null?g:"",s==null?void 0:s.types[m].type)},[s==null?void 0:s.types,a]);I(()=>{var m,g,u;const y=(s==null?void 0:s.types)&&s.types.length>=0,v=!n&&y,E=n&&y&&!(s!=null&&s.types.find(({kind:w,type:N})=>n===w&&(!r&&!N||r===N)));(v||E)&&a((g=(m=s==null?void 0:s.types[0])==null?void 0:m.kind)!=null?g:"",(u=s==null?void 0:s.types[0])==null?void 0:u.type,!0)},[n,r,s==null?void 0:s.types,a]);const p=(i=s==null?void 0:s.types.map(({kind:m,type:g,count:u})=>{const y=`${m}|${g!=null?g:""}`;return{key:y,label:`${g!=null?g:m} (${u>50?"50+":u})`,id:y,tabProps:{className:d.tab}}}))!=null?i:[];if(!p.length)return null;const h=(o=s==null?void 0:s.types.findIndex(m=>m.kind===n&&(!m.type&&!r||m.type===r)))!=null?o:-1;return t.createElement(t.Fragment,null,t.createElement($t,null),t.createElement(ye,{onChange:c,tabs:p,selectedIndex:h>-1?h:void 0}))},Zt=e=>({key:`skeleton${e}`,label:"",id:`skeleton${e}`}),ea=()=>{const e=Array.from({length:4},(a,n)=>Zt(n));return t.createElement(ye,{tabs:e})};var Se=(e=>(e.Alpha="default",e.Owner="all",e.Status="all",e))(Se||{});const X=12,ta=k(e=>({pagination:{width:"-webkit-fill-available",display:"flex",justifyContent:"center",position:"fixed",bottom:"0",backgroundColor:e.palette.type==="dark"?"#333333":"#F8F8F8",marginRight:"40px"}})),aa=({response:e,listingsPerPage:a,cursor:n,setCursor:r,prevCursors:l,setPrevCursors:i,labelPerPageDropdown:o,urlRoute:d})=>{var s;const c=ta(),p=e!=null&&e.edges?e==null?void 0:e.edges[(e==null?void 0:e.edges.length)-1]:{cursor:""},[h,m]=S(0),g=()=>{i(E=>[...E,n]),r(p==null?void 0:p.cursor)},u=()=>{r(l[l.length-1]),i(E=>E.slice(0,-1))},y=(E,w)=>{m(N=>(w>N?g():u(),w))},v=E=>{window.open(`/soundcheck/${d!=null?d:"tracks?tracksPerPage="}${E.target.value}`,"_self")};return t.createElement(pe,{className:c.pagination,component:"div",count:(s=e==null?void 0:e.totalCount)!=null?s:-1,rowsPerPage:a!=null?a:10,onPageChange:y,page:h,onRowsPerPageChange:v,labelRowsPerPage:o!=null?o:"Listings per page:",rowsPerPageOptions:[X,X*2,X*4]})},na=k(e=>({pagination:{width:"-webkit-fill-available",display:"flex",justifyContent:"center",position:"fixed",bottom:"0",backgroundColor:e.palette.type==="dark"?"#333333":"#F8F8F8",zIndex:1e3}})),ee=({defaultPageSize:e,label:a})=>{const[n,r]=S(),[l,i]=Z(),o=l.get(a),d=o?parseInt(o,10):e,[s,c]=S(0),p=O(h=>{var m;l.set("entitiesPerPage",(m=h.target.value)!=null?m:e),i(l,{replace:!0}),c(0),r(void 0)},[e,l,i]);return{cursor:n,setCursor:r,pageSize:d,currentPage:s,setCurrentPage:c,onRowsPerPageChange:p}},te=({totalCount:e,setCursor:a,endCursor:n,prevCursor:r,defaultPageSize:l,currentPage:i,setCurrentPage:o,onRowsPerPageChange:d,pageSize:s,labelRowsPerPage:c,rowsPerPageOptions:p})=>{const h=na(),m=O(()=>{n&&a(n)},[n,a]),g=O(()=>{r&&a(r)},[r,a]),u=(y,v)=>{o(E=>(v>E?m():v<E&&g(),v))};return t.createElement(pe,{className:h.pagination,component:"div",count:e,page:i,onPageChange:u,rowsPerPage:s!=null?s:l,onRowsPerPageChange:d,labelRowsPerPage:c,rowsPerPageOptions:p!=null?p:[l,l*2,l*4]})},Ie=it(e=>{const a=e.palette.type==="dark"?e.palette.common.black:e.palette.grey[300];return{tooltip:{backgroundColor:a,color:e.palette.text.primary,maxWidth:"400px"},arrow:{color:a}}})(ue),ra=k(e=>({headerWrapper:{marginTop:e.spacing(.5)},entityRefName:{fontWeight:"bold"},iconWrapper:{padding:e.spacing(1.5,.5),display:"flex",alignItems:"center",justifyContent:"center"}})),la=({check:{name:e,description:a},icon:n,entityRef:r})=>{const l=ra(),i=W(r);return t.createElement(x,{spacing:1},t.createElement(x,{container:!0,direction:"row",spacing:1,wrap:"nowrap"},t.createElement("div",{className:l.iconWrapper},n),t.createElement(f,{variant:"h6",className:l.headerWrapper,noWrap:!0},e)),t.createElement(x,{item:!0,wrap:"nowrap"},t.createElement(f,{variant:"subtitle2",className:l.entityRefName},G(i,{defaultKind:i.kind}))),t.createElement(wt,{content:a}))},oa=({children:e,check:a,icon:n,entityRef:r})=>t.createElement(Ie,{arrow:!0,title:t.createElement(la,{check:a,icon:n,entityRef:r}),enterDelay:150,placement:"top"},e),ia=k(e=>({root:{padding:0},iconWrapper:{padding:e.spacing(1.5),display:"flex",alignItems:"center",justifyContent:"center"},link:{"&:hover $iconWrapper, &:active $iconWrapper, &:focus $iconWrapper":{backgroundColor:e.palette.infoBackground}},icon:{width:"17px",height:"17px"},virtualized:{borderBottom:`1px solid ${e.palette.divider}`,borderRight:`1px solid ${e.palette.divider}`}})),Le=z(({programId:e,check:a,entityRef:n,result:r,entityRoute:l,isVirtualized:i})=>{const o=ia();if(typeof n!="string"){const p=t.createElement("div",{className:o.iconWrapper},t.createElement("div",{className:o.icon}));return i?t.createElement("div",{className:`${o.root} ${o.virtualized}`,"aria-hidden":!0},p):t.createElement("td",{className:o.root,"aria-hidden":!0},p)}const d=t.createElement(Et,{className:o.icon,result:r!=null?r:A.NotReported}),s=t.createElement("div",{className:o.iconWrapper},d),c=r&&r===A.NotApplicable?s:t.createElement(j,{className:o.link,to:`${l(W(n))}/soundcheck/tracks/${e}/checks/${a.id}`},s);return i?t.createElement("div",{className:`${o.root} ${o.virtualized}`},t.createElement(oa,{check:a,icon:d,entityRef:n},c)):t.createElement("td",{className:`${o.root}`},c)}),sa=k(e=>({root:{height:"8px",minWidth:"64px",marginLeft:e.spacing(2),borderRadius:"100vh",backgroundColor:e.palette.background.default},bar:{backgroundColor:e.palette.success.main,transition:"none"}})),Fe=e=>{var a,n;const r=sa(e),l=D(()=>Object.entries(e.progress).reduce((o,[,d])=>o+d,0),[e.progress]);if(l===0)return null;const i=(a=e.progress[A.Passed])!=null?a:0;return t.createElement(ue,{arrow:!0,title:`Check passing for ${i} of ${l} ${l===1?"entity":"entities"}`,enterDelay:0,placement:"top"},t.createElement(st,{variant:"determinate",value:((n=e.progress[A.Passed])!=null?n:0)/l*100,classes:{root:r.root,bar:r.bar}}))},Oe=8,ca=16,$={programTitle:70,levelTitle:30,check:42,entityRefFooter:100,paginationControl:50},H={programTitle:350+ca*2,checkResult:42},ze=e=>e.reduce((a,n)=>a+n.height,0),da=e=>e*H.checkResult+H.programTitle,Ae=e=>e.filter(a=>a!==void 0).map(a=>{const n=W(a);return G(n,{defaultKind:n.kind})}).reduce((a,n)=>a.length>n.length?a:n,""),Be=e=>Oe*e+Oe,We="NoLevel",ma=e=>({name:We,badge:{options:{level:0,color:""},variant:yt.Medal},entityRef:e,ordinal:0}),De=k(e=>({checkNameCell:{padding:0,backgroundColor:e.palette.background.paper},checkNameContent:{padding:`0 ${e.spacing(2)}px`,display:"flex",justifyContent:"space-between",alignItems:"center"},checkNameTypography:{overflow:"hidden",textOverflow:"ellipsis"},checkIndicator:{flexBasis:e.spacing(8)},checkNameCellVirtualized:{height:`${$.check}px`,lineHeight:`${$.check}px`,borderBottom:`1px solid ${e.palette.divider}`,borderRight:`1px solid ${e.palette.divider}`}})),pa=z(({programId:e,programName:a,check:n,entityRefs:r,results:l,entityRoute:i})=>{const o=De(),d=D(()=>ke(l.filter(({result:c})=>c!==A.NotApplicable),"result"),[l]),s=new Map(l.map(c=>[c.entityRef,c.result]));return t.createElement("tr",{"data-testid":"track-check-row"},t.createElement("th",{scope:"row",className:o.checkNameCell,"aria-label":`${n.name} check for ${a} track`},t.createElement("div",{className:o.checkNameContent},t.createElement(f,{className:o.checkNameTypography,variant:"subtitle2",component:"p"},n.name),t.createElement(Fe,{className:o.checkIndicator,progress:d}))),r.map((c,p)=>t.createElement(Le,{key:p,programId:e,check:n,entityRef:c,result:typeof c=="string"?s.get(c):void 0,entityRoute:i})))}),ua=({name:e,progress:a})=>{const n=De();return t.createElement("div",{className:n.checkNameCell,"aria-label":`${e} check`},t.createElement("div",{className:`${n.checkNameContent} ${n.checkNameCellVirtualized}`},t.createElement(f,{variant:"subtitle2",component:"p",className:n.checkNameTypography},e),t.createElement(Fe,{className:n.checkIndicator,progress:a})))},ae=k(e=>{const a=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{root:{color:ce(e.palette.getContrastText(a),.8),backgroundColor:a},levelContent:{padding:`${e.spacing(.5)}px ${e.spacing(2)}px`,backgroundColor:a},levelTypography:{overflow:"hidden",textOverflow:"ellipsis"},levelHeaderCell:{padding:`${e.spacing(.5)}px ${e.spacing(2)}px`,borderRight:`1px solid ${e.palette.divider}`,height:`${$.levelTitle}px`}}}),ga=z(({level:e,entityRefs:a,programName:n})=>{const r=ae();return t.createElement("tr",{className:r.root,"data-testid":"track-level-row"},t.createElement("th",{scope:"row",className:r.root},t.createElement("div",{className:r.levelContent},t.createElement(f,{className:r.levelTypography,variant:"subtitle2",component:"p","aria-label":`${e.name} for ${n} track`},e.name))),a.map((l,i)=>t.createElement("td",{key:i,className:r.root,"aria-hidden":!0})))}),fa=({name:e})=>{const a=ae();return t.createElement("div",{className:`${a.levelHeaderCell} ${a.root}`,"aria-label":`${e}`},t.createElement(f,{variant:"subtitle2",component:"p",className:a.levelTypography},e))},ha=()=>{const e=ae();return t.createElement("div",{className:`${e.levelHeaderCell} ${e.root}`},"\xA0")},ya=k(e=>({virtualized:{borderRight:`1px solid ${e.palette.divider}`,height:`${$.programTitle}px`,display:"flex",justifyContent:"center",alignItems:"center"}})),va=z(({entityRef:e,highestLevels:a,trackType:n})=>{const r=a.find(i=>i.entityRef===e);let l=r!=null&&r.badge?t.createElement(ge,{badge:r.badge}):t.createElement(fe,null);return n==="campaign"&&(l=t.createElement(he,null)),l}),Ea=({highestLevel:e,trackType:a})=>{const n=ya();if(!(e!=null&&e.badge))return t.createElement("div",{className:n.virtualized},"\xA0");let r=e.name!==We?t.createElement(ge,{badge:e.badge}):t.createElement(fe,null);return a==="campaign"&&(r=t.createElement(he,null)),t.createElement("div",{className:n.virtualized},r)},Me=k(e=>({programNameCell:{padding:0,position:"sticky",backgroundColor:e.palette.background.paper},programNameContent:{padding:e.spacing(2)},programNameTypography:{overflow:"hidden",textOverflow:"ellipsis"},badgeCellContent:{display:"flex",justifyContent:"center",alignItems:"center"},programNameCellVirtualized:{borderRight:`1px solid ${e.palette.divider}`}})),ka=z(({program:e,entityRefs:a,highestLevels:n})=>{const r=Me();return t.createElement("tr",{"data-testid":"track-title-row"},t.createElement("th",{scope:"row",className:r.programNameCell},t.createElement("div",{className:r.programNameContent},t.createElement(f,{className:r.programNameTypography,variant:"h5",component:"p"},e.name))),a.map((l,i)=>{var o;return typeof l!="string"?t.createElement("td",{key:i,"aria-hidden":!0}):t.createElement("td",{key:i,"data-testid":"track-certification-cell"},t.createElement("div",{className:r.badgeCellContent},t.createElement(va,{entityRef:l,highestLevels:n,trackType:(o=e.type)!=null?o:void 0})))}))}),ba=z(({name:e})=>{const a=Me();return t.createElement("div",{className:`${a.programNameCell} ${a.programNameCellVirtualized}`},t.createElement("div",{className:a.programNameContent},t.createElement(f,{className:a.programNameTypography,variant:"h5",component:"p"},e)))}),Ca=({program:e,highestLevels:a,levels:n,entityRefs:r,entityRoute:l})=>t.createElement("tbody",null,t.createElement(ka,{program:e,entityRefs:r,highestLevels:a}),n.map((i,o)=>t.createElement(et,{key:o},t.createElement(ga,{entityRefs:r,level:i,programName:e.name}),i.checks.map(({check:d,results:s},c)=>t.createElement(pa,{key:c,check:d,programId:e.id,programName:e.name,entityRefs:r,results:s,entityRoute:l}))))),Ge=e=>{const a=R(M);return L([K.EntitiesByRefs,e],async()=>a.getEntitiesByRefs({entityRefs:e.entityRefs,fields:e.fields}),{refetchOnWindowFocus:!1,onError:()=>{},enabled:!!e.entityRefs})},je=e=>{const a=R(M);return L([K.EntityByRef,e],async()=>a.getEntityByRef(e),{onError:()=>{},enabled:!!e})},He=k(e=>({root:{position:"sticky",bottom:"-1px",backgroundColor:e.palette.background.default,boxShadow:`0 -1px ${e.palette.divider}`,"& td$cell, & th$cell":{border:0,padding:e.spacing(1)},"& td$cell":{backgroundColor:e.palette.background.default}},row:{boxShadow:`1px 0 ${e.palette.background.default}, -1px 0 ${e.palette.background.default}`},cell:{verticalAlign:"top"},cellInner:{textOrientation:"mixed",writingMode:"vertical-lr",transform:"rotate(-20deg)",transformOrigin:`100% ${e.spacing(1)}px`,wordBreak:"keep-all",fontWeight:"bold",overflow:"hidden",textOverflow:"ellipsis",maxHeight:"max(15vh, 175px)"}})),wa=({entityRefs:e})=>{const a=F(U),n=He(),{data:r}=Ge({entityRefs:Tt.compact(e),fields:["kind","metadata.name","metadata.namespace","metadata.title"]});return t.createElement("tfoot",{className:n.root,"data-testid":"results-table-footer"},t.createElement("tr",{className:n.row},t.createElement("td",{className:n.cell}),e.map((l,i)=>{if(typeof l!="string")return t.createElement("th",{key:i,className:n.cell,"aria-hidden":!0});const o=W(l),d=r==null?void 0:r.items.find(s=>s&&V(s)===l);return t.createElement("th",{scope:"col",key:i,className:n.cell},t.createElement("div",{className:n.cellInner},t.createElement(j,{to:a(o)},d!=null&&d.metadata.title?d.metadata.title:G(o,{defaultKind:o.kind}))))})))},Ra=({entityRef:e})=>{const{data:a}=je(e),n=F(U),r=He(),l=e?W(e):void 0,i=l?t.createElement(j,{to:n(l)},a!=null&&a.metadata.title?a.metadata.title:G(l,{defaultKind:l.kind})):t.createElement(t.Fragment,null);return t.createElement("div",{className:r.cell},t.createElement("div",{className:r.cellInner},i))},Na=k(e=>({table:{backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap","& th, & td":{border:`1px solid ${e.palette.divider}`,borderCollapse:"collapse"},paddingBottom:e.spacing(2)},programTitle:{padding:e.spacing(2)},checkResult:{padding:e.spacing(1.5)},title:{padding:`${e.spacing(1)}px ${e.spacing(2)}px`},header:{backgroundColor:e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100]}})),ne=({entityCount:e=25,levelCount:a=3,checkCount:n=5})=>{const r=Na(),l=new Array(e).fill(void 0),i=new Array(n).fill(void 0),o=new Array(a).fill(void 0);return t.createElement("table",{className:r.table},t.createElement("tbody",null,t.createElement("tr",null,t.createElement("td",{className:r.programTitle},t.createElement(Q,{width:180,height:40})),l.map((d,s)=>t.createElement("td",{key:s}))),o.map((d,s)=>t.createElement(t.Fragment,{key:s},t.createElement("tr",{className:r.header},t.createElement("td",{className:r.title},t.createElement(Q,{width:180})),l.map((c,p)=>t.createElement("td",{key:p}))),i.map((c,p)=>t.createElement("tr",{key:p},t.createElement("td",{className:r.title},t.createElement(Q,{width:240})),l.map((h,m)=>t.createElement("td",{key:m,className:r.checkResult},t.createElement(Q,{width:18,height:18,variant:"rect"})))))))))},Ve=25,xa=k(e=>({root:{width:"100%"},table:{overflow:"auto",width:"100%",backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap",textAlign:"left","& th, & td":{border:`1px solid ${e.palette.divider}`,borderCollapse:"collapse"},"& th:first-of-type":{position:"sticky",left:0,zIndex:1,maxWidth:"65ch"},"& tfoot":{bottom:0,zIndex:100},"& tbody td:first-of-type":{border:`1px solid ${e.palette.divider}`,boxShadow:`1px 0 ${e.palette.background.default}, -1px 0 ${e.palette.background.default}`}}})),Pa=z(e=>{const{setError:a,kind:n,type:r,ownerEntityRef:l}=e,i=xa(),o=F(U),{cursor:d,pageSize:s,...c}=ee({defaultPageSize:Ve,label:"entitiesPerPage"}),{data:p,isLoading:h,isError:m}=be(l,{kind:n,type:r},s,d);if(I(()=>{a==null||a(m?new Error("Error loading track overview"):void 0)},[m,a]),h)return t.createElement(ne,null);if(!p||!l)return null;const{programs:g,entityRefs:u,totalCount:y,endCursor:v,prevCursor:E}=p;if(!h&&!g.length)return t.createElement(Rt,{missing:"data",title:"Missing tracks",description:t.createElement(t.Fragment,null,"Looks like the group"," ",G(W(l),{defaultKind:"Group"})," ","doesn't own any ",r!=null?r:n," components that have Soundcheck tracks set up.",t.createElement("br",null),t.createElement("br",null),"If you're an administrator, you can learn more about configuring and filtering tracks in the"," ",t.createElement(j,{to:"https://www.npmjs.com/package/@spotify/backstage-plugin-soundcheck-backend#entity-filter"},"docs"),".")});if(m)return null;const w=u.length>=25?u:[...u,...Array.from({length:25-u.length},()=>{})];return t.createElement("div",{className:i.root},t.createElement("table",{className:i.table,"aria-label":"Check results"},g.map(({program:N,levels:T,highestLevels:b},C)=>t.createElement(Ca,{key:C,program:N,entityRefs:w,levels:T,highestLevels:b,entityRoute:o})),t.createElement(wa,{entityRefs:w})),t.createElement(te,{...c,totalCount:y,defaultPageSize:Ve,endCursor:v,prevCursor:E,labelRowsPerPage:"Entities per page:",pageSize:s}))}),$a=e=>t.createElement(ba,{name:e}),Ta=e=>({type:"ProgramHeader",render:()=>$a(e)}),Sa=e=>e?t.createElement(fa,{name:e}):t.createElement(ha,null),Ue=e=>({type:"LevelHeader",render:()=>Sa(e)}),Ia=(e,a)=>t.createElement(ua,{name:e,progress:a}),_e=(e,a)=>({type:"CheckTitle",render:()=>Ia(e,a)}),La=(e,a,n,r,l)=>t.createElement(Le,{check:a,entityRef:n,entityRoute:l,programId:e,result:r,isVirtualized:!0}),Ke=(e,a,n,r,l)=>({type:"CheckResult",render:()=>La(e,a,n,r,l)}),Fa=e=>t.createElement(Ra,{entityRef:e}),re=e=>({type:"EntityHeader",render:()=>Fa(e)}),Oa=(e,a)=>t.createElement(Ea,{highestLevel:e,trackType:a}),za=(e,a)=>({type:"LevelBadge",render:()=>Oa(e,a)}),Qe=e=>a=>{const n=e[a.rowIndex].cells[a.columnIndex];return n?t.createElement("div",{style:a.style},n.render()):t.createElement("div",{style:a.style})},Aa=(e,a,n)=>{var r;const l=[];for(const{program:o,levels:d,highestLevels:s}of e){l.push({height:$.programTitle,cells:[Ta(o.name),...a.map(c=>{var p;const h=c?s.find(m=>m.entityRef===c)||ma(c):void 0;return za(h,(p=o.type)!=null?p:void 0)})]});for(const c of d){l.push({height:$.levelTitle,cells:[Ue(c.name),...a.map(p=>Ue(""))]});for(const{check:p,results:h}of c.checks)l.push({height:$.check,cells:[_e(p.name,ke(h.filter(({result:m})=>m!==A.NotApplicable),"result")),...a.map(m=>{var g,u;return Ke(o.id,p,m,(u=(g=h.find(y=>y.entityRef===m))==null?void 0:g.result)!=null?u:A.NotApplicable,n)})]})}}const i=Ae(a!=null?a:[]);return l.push({height:Be((r=i.length)!=null?r:1),cells:[re(""),...a.map(o=>re(o||""))]}),l},Je=25,Ba=k(e=>({table:{backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap",textAlign:"left",overflow:"auto"}})),Wa=({setError:e,kind:a,type:n,ownerEntityRef:r})=>{const{cursor:l,pageSize:i,...o}=ee({defaultPageSize:Je,label:"entitiesPerPage"}),{data:d,isLoading:s,isError:c}=be(r,{kind:a,type:n},i,l),p=Ba(),h=F(U);I(()=>{e==null||e(c?new Error("Error loading program overview"):void 0)},[c,e]);const[m,g]=S(0),u=tt(null);if(at(()=>{d&&r&&u!=null&&u.current&&g(u.current.clientWidth)},[u,d,r]),s)return t.createElement(ne,null);if(!d||!r)return null;const{programs:y,entityRefs:v,totalCount:E,endCursor:w,prevCursor:N}=d,T=v.length>=25?v:[...v,...Array.from({length:25-v.length},()=>{})],b=Aa(y,T,h),C=Qe(b);return t.createElement("div",{ref:u},t.createElement(x,{"aria-label":`Check results for ${n!=null?n:a}`,key:`${a}|${n!=null?n:""}`,item:!0,xs:12},m>0&&t.createElement(St,{className:p.table,columnCount:T.length+1,columnWidth:P=>P===0?H.programTitle:H.checkResult,rowCount:b.length,rowHeight:P=>b[P].height,height:ze(b)+$.paginationControl,width:m},C)),t.createElement(te,{...o,totalCount:E,defaultPageSize:Je,endCursor:w,prevCursor:N,pageSize:i,labelRowsPerPage:"Entities per page:"}))},Da=({facets:e,ownerEntityRef:a,kind:n,type:r,setError:l})=>{const i=D(()=>{const o=new Map;return e.types.forEach(({kind:d,type:s})=>{const c=`${d}|${s!=null?s:""}`;o.set(c,t.createElement(Wa,{key:c,ownerEntityRef:a,kind:d,type:s,setError:l}))}),o},[e,a,l]);return t.createElement("div",null,i.get(`${n}|${r!=null?r:""}`))},Ma=k(()=>({scrollContainer:{overflow:"auto"}})),Ga=({facets:e,ownerEntityRef:a,hasError:n,kind:r,type:l,setError:i,useVirtualizedResultsTable:o,isFixedGroup:d})=>{var s,c,p;const h=Ma();if(n)return t.createElement(kt,{severity:"error",title:n.message});const m="Use the groups drop-down list at the top-right of the page to select another group.";return e&&((c=(s=e.types)==null?void 0:s.length)!=null?c:0)>0?(p=e.types)!=null&&p.find(g=>g.count>0)?t.createElement("div",{className:h.scrollContainer},o?t.createElement(Da,{facets:e,kind:r,type:l,setError:i,ownerEntityRef:a,hasError:n}):t.createElement(Pa,{ownerEntityRef:a,kind:r,type:l,setError:i})):t.createElement(bt,{ownerEntityRef:a,selectGroupHint:m}):t.createElement(Ct,{ownerEntityRef:a,selectGroupHint:d?void 0:m})},ja=k(e=>({tableContainer:{padding:0,backgroundColor:"transparent"},campaignsGrid:{margin:`0 0 ${e.spacing(3)}px`},campaignsCard:{display:"flex",width:"100%",flexDirection:"column",padding:e.spacing(2),gap:e.spacing(2)},campaignsLink:{textAlign:"center",margin:`${e.spacing(1)}rem 0 ${e.spacing(1)}`},tableLoading:{backgroundColor:e.palette.background.paper,padding:e.spacing(6)}})),Xe=3,Ha=({groupSelectorError:e,isFixedGroup:a=!1})=>{var n;const[r,l]=Z(),{group:i,kind:o,type:d}=Object.fromEntries(r.entries()),s=F(vt),[c,p]=S(void 0),[h,m]=S(void 0);I(()=>{((c==null?void 0:c.kind)!==o||(c==null?void 0:c.type)!==d)&&p({kind:o,type:d})},[o,d,c]);const{data:g,isLoading:u}=Lt(i),{data:y}=we({orderAlphabetical:"default",searchByOwner:i,searchByStatus:"active"}),v=y==null?void 0:y.edges.map(C=>C.node),E=v==null?void 0:v.slice(0,Xe),w=(n=R(ie).getOptionalBoolean("soundcheck.virtualizeOverviewPage"))!=null?n:!0,N=h||e,T=O((C,P,q)=>{C&&(p({kind:C,type:P}),P?(r.set("kind",C),r.set("type",P)):(r.delete("type"),r.set("kind",C)),l(r,{replace:q}))},[r,l]),b=ja();return t.createElement(x,{container:!0,spacing:0},v&&v.length>0&&t.createElement(x,{item:!0,xs:12,className:b.campaignsGrid},t.createElement(ct,null,t.createElement(dt,{expandIcon:t.createElement(Nt,null)},t.createElement(f,{variant:"h6"},"Campaigns")),t.createElement(mt,null,t.createElement("div",{className:b.campaignsCard},E==null?void 0:E.map(C=>t.createElement("div",{key:C.id},t.createElement(Xt,{campaign:C})))),v.length>Xe&&t.createElement(j,{to:s(),className:b.campaignsLink},"More Campaigns")))),t.createElement(x,{item:!0,xs:12},u?t.createElement(ea,null):t.createElement(Yt,{unfilteredFacets:g,kind:c==null?void 0:c.kind,type:c==null?void 0:c.type,onChange:T})),t.createElement(x,{item:!0,xs:12,className:b.tableContainer},u?t.createElement("div",{className:b.tableLoading},t.createElement($e,{size:80})):t.createElement(Ga,{facets:g,kind:c==null?void 0:c.kind,type:c==null?void 0:c.type,setError:m,hasError:N,ownerEntityRef:i,useVirtualizedResultsTable:w,isFixedGroup:a})))};export{B as C,Se as F,At as G,$e as L,Ha as O,aa as P,X as R,Ie as S,Ot as U,Ft as a,Pe as b,H as c,ze as d,da as e,$ as f,_e as g,Ke as h,Ae as i,Be as j,re as k,Qe as l,ee as m,ne as n,te as o,Te as p,Mt as q,Ce as r,je as s,Re as t,we as u,Ge as v};
|
|
2
|
+
//# sourceMappingURL=OverviewPageContent-9845035d.esm.js.map
|
package/dist/esm/{RefetchingIndicator-b4961e02.esm.js → RefetchingIndicator-8312818a.esm.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{makeStyles as m,LinearProgress as a}from"@material-ui/core";import e,{useState as s}from"react";import p from"react-use/lib/useDebounce";import c from"react-use/lib/useUnmount";import"@backstage/catalog-model";import"@backstage/core-plugin-api";import{useIsFetching as d}from"@tanstack/react-query";import"./routes-
|
|
2
|
-
//# sourceMappingURL=RefetchingIndicator-
|
|
1
|
+
import{makeStyles as m,LinearProgress as a}from"@material-ui/core";import e,{useState as s}from"react";import p from"react-use/lib/useDebounce";import c from"react-use/lib/useUnmount";import"@backstage/catalog-model";import"@backstage/core-plugin-api";import{useIsFetching as d}from"@tanstack/react-query";import"./routes-06f9616b.esm.js";import{F as l}from"./EmptyState-a3a6154f.esm.js";import"@backstage/plugin-catalog-react";import"react-router-dom";const f=m(t=>({indicator:{position:"absolute",width:"100%",zIndex:t.zIndex.speedDial}})),u=()=>{const t=d(),r=f(),[i,o]=s(!!t),[I,n]=p(()=>{o(!!t)},250,[t]);return c(n),i?e.createElement(l,null,e.createElement("div",{className:r.indicator},e.createElement(a,{variant:"indeterminate","data-testid":"refetching-indicator"}))):null};export{u as R};
|
|
2
|
+
//# sourceMappingURL=RefetchingIndicator-8312818a.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Page as s,Header as u}from"@backstage/core-components";import{makeStyles as E}from"@material-ui/core";import{SpotifyLicenseBanner as i}from"@spotify/backstage-plugin-core";import e,{useState as d,useEffect as v}from"react";import{U as f,G as g,O as m}from"./OverviewPageContent-9845035d.esm.js";import{S as n,c as S}from"./EmptyState-a3a6154f.esm.js";import{s as a,i as p}from"./license-e9e73904.esm.js";import{stringifyEntityRef as k}from"@backstage/catalog-model";import{useEntity as y}from"@backstage/plugin-catalog-react";import{useSearchParams as P,Routes as h,Route as w}from"react-router-dom";import"@backstage/core-plugin-api";import"react-use/lib/useAsync";import"@material-ui/lab/Autocomplete";import"react-use/lib/useLocalStorage";import"@tanstack/react-query";import"./routes-06f9616b.esm.js";import"graphql-request";import"graphql-tag";import"@backstage/core-compat-api";import"@material-ui/icons/ExpandMore";import"@material-ui/icons/ArrowDropDown";import"@material-ui/icons/ArrowDropUp";import"@material-ui/core/styles";import"framer-motion";import"./RefetchingIndicator-8312818a.esm.js";import"react-use/lib/useDebounce";import"react-use/lib/useUnmount";import"lodash";import"@material-ui/lab";import"react-window";import"@material-ui/icons/Check";import"@material-ui/icons/Close";import"@material-ui/icons/HelpOutline";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/ReportProblemOutlined";import"classnames";import"../images/empty-state.svg";const C=E(t=>({overviewContainer:{padding:t.spacing(1,3)}})),G=t=>{const{title:r="Soundcheck"}=t,o=C(),[c,l]=d(void 0);return e.createElement(n,null,e.createElement(f,null,e.createElement(S,null,e.createElement(s,{themeId:"website"},e.createElement(i,{backend:a,invalidLicenseMessage:p}),e.createElement(u,{title:r},e.createElement(g,{setError:l})),e.createElement("div",{className:o.overviewContainer},e.createElement(m,{groupSelectorError:c}))))))},L=()=>{const{entity:t}=y(),[r,o]=P();return v(()=>{!r.get("group")&&t&&(r.set("group",k(t)),o(r,{replace:!0}))},[r,o,t]),e.createElement(n,null,e.createElement(h,null,e.createElement(w,{path:"/*",element:e.createElement(e.Fragment,null,e.createElement(i,{backend:a,invalidLicenseMessage:p,inline:!0}),e.createElement(m,{isFixedGroup:!0}))})))};export{L as FixedGroupOverviewPage,G as OverviewPage};
|
|
2
|
+
//# sourceMappingURL=index-8da96e46.esm.js.map
|