@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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spotify/backstage-plugin-soundcheck",
|
|
3
3
|
"description": "Ensure quality, reliability and alignment of software development with codified checks and guidance.",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.3",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://backstage.spotify.com",
|
|
7
7
|
"main": "./dist/index.esm.js",
|
|
@@ -37,14 +37,15 @@
|
|
|
37
37
|
"prepare": "yarn generate"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@backstage/catalog-client": "^1.6.
|
|
41
|
-
"@backstage/catalog-model": "^1.4.
|
|
42
|
-
"@backstage/core-compat-api": "^0.2.
|
|
43
|
-
"@backstage/core-components": "^0.14.
|
|
44
|
-
"@backstage/core-plugin-api": "^1.9.
|
|
45
|
-
"@backstage/frontend-plugin-api": "^0.6.
|
|
46
|
-
"@backstage/plugin-catalog
|
|
47
|
-
"@backstage/plugin-
|
|
40
|
+
"@backstage/catalog-client": "^1.6.1",
|
|
41
|
+
"@backstage/catalog-model": "^1.4.5",
|
|
42
|
+
"@backstage/core-compat-api": "^0.2.1",
|
|
43
|
+
"@backstage/core-components": "^0.14.1",
|
|
44
|
+
"@backstage/core-plugin-api": "^1.9.1",
|
|
45
|
+
"@backstage/frontend-plugin-api": "^0.6.1",
|
|
46
|
+
"@backstage/plugin-catalog": "^1.18.0",
|
|
47
|
+
"@backstage/plugin-catalog-react": "^1.11.0",
|
|
48
|
+
"@backstage/plugin-permission-react": "^0.4.21",
|
|
48
49
|
"@backstage/types": "^1.1.1",
|
|
49
50
|
"@date-io/luxon": "^1.0.0",
|
|
50
51
|
"@hookform/resolvers": "^3.3.2",
|
|
@@ -52,8 +53,8 @@
|
|
|
52
53
|
"@material-ui/icons": "^4.9.1",
|
|
53
54
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
54
55
|
"@material-ui/pickers": "3.3.11",
|
|
55
|
-
"@spotify/backstage-plugin-core": "^0.
|
|
56
|
-
"@spotify/backstage-plugin-soundcheck-common": "^0.
|
|
56
|
+
"@spotify/backstage-plugin-core": "^0.7.0",
|
|
57
|
+
"@spotify/backstage-plugin-soundcheck-common": "^0.13.0",
|
|
57
58
|
"@tanstack/react-query": "^4.6.1",
|
|
58
59
|
"@types/react-csv": "^1.1.6",
|
|
59
60
|
"@uiw/react-md-editor": "3.19.5",
|
|
@@ -71,6 +72,7 @@
|
|
|
71
72
|
"react-dnd-html5-backend": "^16.0.1",
|
|
72
73
|
"react-hook-form": "^7.19.5",
|
|
73
74
|
"react-use": "^17.2.4",
|
|
75
|
+
"react-virtuoso": "^4.0.0",
|
|
74
76
|
"react-window": "^1.8.8",
|
|
75
77
|
"recharts": "^2.8.0",
|
|
76
78
|
"rehype-sanitize": "^6.0.0",
|
|
@@ -82,19 +84,19 @@
|
|
|
82
84
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
83
85
|
},
|
|
84
86
|
"devDependencies": {
|
|
85
|
-
"@backstage/cli": "^0.
|
|
86
|
-
"@backstage/core-app-api": "^1.12.
|
|
87
|
-
"@backstage/dev-utils": "^1.0.
|
|
87
|
+
"@backstage/cli": "^0.26.0",
|
|
88
|
+
"@backstage/core-app-api": "^1.12.1",
|
|
89
|
+
"@backstage/dev-utils": "^1.0.28",
|
|
88
90
|
"@backstage/e2e-test-utils": "^0.1.1",
|
|
89
|
-
"@backstage/frontend-test-utils": "^0.1.
|
|
90
|
-
"@backstage/test-utils": "^1.5.
|
|
91
|
+
"@backstage/frontend-test-utils": "^0.1.3",
|
|
92
|
+
"@backstage/test-utils": "^1.5.1",
|
|
91
93
|
"@graphql-codegen/cli": "^5.0.0",
|
|
92
94
|
"@graphql-codegen/typescript": "^4.0.0",
|
|
93
95
|
"@graphql-codegen/typescript-graphql-request": "^6.0.0",
|
|
94
96
|
"@graphql-codegen/typescript-operations": "^4.0.0",
|
|
95
97
|
"@playwright/test": "^1.32.3",
|
|
96
|
-
"@sp4b-dev/test-utils": "^0.0.
|
|
97
|
-
"@spotify/backstage-plugin-core-common": "^0.5.
|
|
98
|
+
"@sp4b-dev/test-utils": "^0.0.2",
|
|
99
|
+
"@spotify/backstage-plugin-core-common": "^0.5.11",
|
|
98
100
|
"@testing-library/jest-dom": "^6.0.0",
|
|
99
101
|
"@testing-library/react": "^14.0.0",
|
|
100
102
|
"@testing-library/user-event": "^14.0.0",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Link as g,InfoCard as E}from"@backstage/core-components";import{useRouteRef as y}from"@backstage/core-plugin-api";import{useEntity as k}from"@backstage/plugin-catalog-react";import{Divider as C}from"@material-ui/core";import v from"@material-ui/core/styles/makeStyles";import{SpotifyLicenseBanner as h}from"@spotify/backstage-plugin-core";import e,{Fragment as S}from"react";import{C as c,u as L,a as w}from"./CertificationSidebar-5e4230a7.esm.js";import"@tanstack/react-query";import{c as N}from"./routes-93cd1496.esm.js";import"@backstage/catalog-model";import{A as R,N as b}from"./EmptyState-6a402254.esm.js";import"react-router-dom";import{s as D,i as A}from"./license-e9e73904.esm.js";import"@material-ui/lab";const I=()=>e.createElement(e.Fragment,null,e.createElement(c,{hideDescription:!0}),e.createElement(c,{hideDescription:!0})),s=v(t=>({certificationWrapper:{display:"flex",justifyContent:"space-between",alignItems:"center"},infoCard:{display:"grid",gridRowGap:t.spacing(2)},emptyState:{overflow:"hidden"}})),n=({children:t,title:o})=>{const a=s();return e.createElement(E,{title:o},e.createElement("div",{className:a.infoCard},e.createElement(h,{inline:!0,backend:D,invalidLicenseMessage:A}),t))},x=({title:t="Soundcheck"})=>{const{entity:o}=k(),a=s(),{data:i,isError:p,isLoading:d}=L(o),f=y(N);return p?e.createElement(n,{title:t},e.createElement(R,{severity:"error",title:"Error loading certifications"})):d||!i?e.createElement(n,{title:t},e.createElement(I,null)):i.length?e.createElement(n,{title:t},i.map((r,u)=>{var m,l;return e.createElement(S,{key:r.program.name},e.createElement("div",{className:a.certificationWrapper,"data-testid":"soundcheck-track-row"},e.createElement(w,{key:r.program.id,name:r.program.name,badge:(m=r.highestLevel)==null?void 0:m.badge,isCampaign:((l=r.program)==null?void 0:l.type)==="campaign"}),e.createElement(g,{to:f({trackId:r.program.id})},"View Details")),u<i.length-1?e.createElement(C,null):null)})):e.createElement(n,{title:t},e.createElement("div",{className:a.emptyState},e.createElement(b,null)))};export{x as C};
|
|
2
|
-
//# sourceMappingURL=Card-2862fdca.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{stringifyEntityRef as k}from"@backstage/catalog-model";import{useApi as v,useRouteRef as b}from"@backstage/core-plugin-api";import{useQuery as C}from"@tanstack/react-query";import{s as S,a as U,b as $}from"./routes-93cd1496.esm.js";import{useEntity as D}from"@backstage/plugin-catalog-react";import{makeStyles as m,Tooltip as H,Typography as c,alpha as p,Box as W}from"@material-ui/core";import t from"react";import{C as G,L as N,a as M,b as P,F as g,A as j}from"./EmptyState-6a402254.esm.js";import{Link as O}from"react-router-dom";import Q from"classnames";import _ from"@material-ui/icons/Schedule";import{useAutoUpdatingRelativeTime as q}from"@spotify/backstage-plugin-core";import{DateTime as I}from"luxon";import{MarkdownContent as u,Link as J}from"@backstage/core-components";import{Skeleton as o}from"@material-ui/lab";function K(e){const a=v(S),n=k(e);return C(["soundcheck/certifications",n],async()=>a.getAllCertifications(n))}function T(e,a){const n=v(S),l=k(e);return C(["soundcheck/certifications",l,a],async()=>n.getCertificationDetailsForTrack(l,a),{enabled:!!a})}const V=m(e=>({root:{display:"inline-flex",alignItems:"center",gap:e.spacing(1)}})),x=({timestamp:e,description:a})=>{const n=V(),l=I.fromISO(e).toLocaleString(I.DATETIME_FULL),i=q(e),r=a?`${a}: ${i}`:void 0;return t.createElement("div",{className:n.root},t.createElement(H,{title:l},t.createElement(c,{variant:"caption","aria-label":r},i)),t.createElement(_,null))},L=m(e=>({root:{display:"grid",width:"100%",gridTemplateColumns:"auto 1fr auto",gridColumnGap:e.spacing(1),padding:e.spacing(1),alignItems:"center","&.selected":{backgroundColor:p(e.palette.primary[e.palette.type],.2)},"&:hover, &:active, &:focus":{backgroundColor:p(e.palette.primary[e.palette.type],.3)}}})),X=({className:e,href:a,children:n})=>a?t.createElement(O,{to:a,className:e},n):t.createElement("div",{className:e},n),Y=({result:e,name:a,timestamp:n,selected:l=!1,href:i})=>{const r=L(),d=Q(r.root,{selected:l});return t.createElement(X,{href:i,className:d},t.createElement(G,{result:e}),t.createElement(c,{variant:"body2"},a),n?t.createElement(x,{timestamp:n}):null)},Z=m(e=>({noChecks:{padding:e.spacing(1)},checks:{padding:0,margin:0,flex:1,listStyle:"none"},checkItem:{borderBottom:`1px solid ${e.palette.divider}`,"&:last-of-type":{borderBottom:"0"}}})),ee=({checks:e,playlistId:a,trackId:n,checkId:l})=>{const i=Z(),r=b(U),d=b($);return e.length?t.createElement("ul",{className:i.checks},e.map(s=>t.createElement("li",{key:s.id,className:i.checkItem},t.createElement(Y,{...s,selected:s.id===l,href:a?d({playlistId:a,trackId:n,checkId:s.id}):r({trackId:n,checkId:s.id})})))):t.createElement(c,{variant:"body2",className:i.noChecks},"No applicable checks at this level.")},R=m(e=>{const a=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{wrapper:{backgroundColor:a,color:p(e.palette.getContrastText(a),.8),fontSize:e.typography.caption.fontSize,minHeight:"auto",borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`,padding:e.spacing(1),display:"grid",gridTemplateAreas:({badge:n})=>[`"${n?"badge":"title"} title"`,`"${n?".":"description"} description"`].join(" "),gridTemplateColumns:"auto 1fr"},title:{gridArea:"title",textTransform:"uppercase",fontWeight:"bold",color:p(e.palette.getContrastText(a),.8),fontSize:e.typography.body2.fontSize,paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5),lineHeight:1},badge:{gridArea:"badge",marginRight:e.spacing(1)},description:{gridArea:"description",color:p(e.palette.getContrastText(a),.8),fontSize:e.typography.subtitle2.fontSize,"& p":{marginBlockStart:0,marginBlockEnd:0}}}}),te=e=>{const a=R({badge:e.badge});return t.createElement("div",{className:a.wrapper},e.badge?t.createElement(N,{className:a.badge,badge:e.badge}):null,t.createElement(c,{className:a.title},e.title),e.description?t.createElement(u,{className:a.description,content:e.description}):null)},A=({level:e,checkId:a,trackId:n,playlistId:l,isCampaign:i})=>{var r;return t.createElement(t.Fragment,null,!i&&t.createElement(te,{badge:e.badge,title:e.name,description:e.description}),t.createElement(ee,{checks:(r=e.checks)!=null?r:[],playlistId:l,trackId:n,checkId:a}))},z=({badge:e,className:a,size:n="small",isCampaign:l})=>{const i=a||"";let r=t.createElement(M,{className:i,size:n});return l?r=t.createElement(P,{className:i,size:n}):e&&(r=t.createElement(N,{className:i,size:n,badge:e})),r},E=m(e=>({description:{padding:0,margin:0,display:"block","& p":{margin:0}},root:{padding:e.spacing(2),margin:0,display:"grid",gridTemplateColumns:"min-content auto",gridGap:e.spacing(2)},title:{fontSize:e.typography.pxToRem(18),fontWeight:700,lineHeight:1.235,marginBottom:"6px"},level:{textTransform:"uppercase",color:e.palette.text.secondary,fontWeight:700,letterSpacing:"1px"}}));function ae({description:e,documentationUrl:a}){const n=E();return a?t.createElement("div",{className:n.description},t.createElement(u,{content:e}),t.createElement(J,{to:a},"Learn more")):t.createElement("div",{className:n.description},t.createElement(u,{content:e}))}const B=({name:e,badge:a,description:n,documentationUrl:l,isCampaign:i=!1})=>{const r=E();return t.createElement("div",{className:r.root},t.createElement(z,{badge:a,isCampaign:i,size:"large"}),t.createElement("div",null,t.createElement(c,{className:r.title},e),n&&t.createElement(ae,{description:n,documentationUrl:l})))},w=({hideDescription:e=!1})=>{const a=E();return t.createElement(g,null,t.createElement("div",{className:a.root},t.createElement(o,{width:44,height:44}),t.createElement("div",null,t.createElement(c,{variant:"caption",className:a.level},t.createElement(o,{width:100})),t.createElement(c,{variant:"h4",className:a.title},t.createElement(o,{width:300})),!e&&t.createElement(c,{variant:"body2"},t.createElement(o,null)))))},f=()=>{const e=L();return t.createElement(g,null,t.createElement("div",{className:e.root},t.createElement(o,{width:24,height:24}),t.createElement(c,{variant:"body2"},t.createElement(o,null)),t.createElement(o,{width:100,height:24})))},ne=()=>{const e=R({});return t.createElement(g,null,t.createElement("div",{className:e.wrapper},t.createElement(o,{className:e.title}),t.createElement(c,{className:e.description},t.createElement(o,null))))},F=()=>{const e=re();return t.createElement("div",null,t.createElement(w,null),new Array(3).fill(null).map((a,n)=>t.createElement(t.Fragment,{key:`skeleton-level-${n}`},t.createElement(ne,null),t.createElement("ul",{className:e.checks},t.createElement(f,null),t.createElement(f,null),t.createElement(f,null)))))},re=m(()=>({checks:{padding:0,margin:0,flex:1,listStyle:"none"}})),ie=({playlistId:e,trackId:a,checkId:n})=>{var l;const{entity:i}=D(),{data:r,isLoading:d,isError:s}=T(i,a);if(s)return t.createElement("div",null,t.createElement(W,{padding:2},t.createElement(j,{severity:"error",title:"Error loading certification"})));if(d||!a)return t.createElement(F,null);if(!r)return null;const h=r.program.type==="campaign";return t.createElement("div",null,t.createElement(B,{name:r.program.name,badge:(l=r.highestLevel)==null?void 0:l.badge,description:r.program.description,documentationUrl:r.program.documentationURL,isCampaign:h}),r==null?void 0:r.levels.map(y=>t.createElement(A,{key:y.ordinal,level:y,checkId:n,trackId:a,playlistId:e,isCampaign:h})))};export{w as C,x as R,B as a,T as b,z as c,F as d,A as e,ie as f,K as u};
|
|
2
|
-
//# sourceMappingURL=CertificationSidebar-5e4230a7.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useApi as F,errorApiRef as M}from"@backstage/core-plugin-api";import{QueryClient as O,QueryClientProvider as W}from"@tanstack/react-query";import{memoize as D}from"lodash";import r,{createContext as y,useState as p,useCallback as l,useContext as v,useRef as L,useEffect as U}from"react";import{makeStyles as c,Typography as d,Modal as Q,Box as H,Button as E,withStyles as m,Fade as K}from"@material-ui/core";import{Alert as j}from"@material-ui/lab";import q from"@material-ui/icons/Check";import J from"@material-ui/icons/Close";import V from"@material-ui/icons/HelpOutline";import X from"@material-ui/icons/RemoveCircleOutline";import Y from"@material-ui/icons/ReportProblemOutlined";import{R as n}from"./routes-93cd1496.esm.js";import u from"classnames";import{parseEntityRef as b}from"@backstage/catalog-model";import{humanizeEntityRef as R}from"@backstage/plugin-catalog-react";import Z from"../images/empty-state.svg";const _=D(e=>new O({defaultOptions:{queries:{refetchInterval:6e4,refetchIntervalInBackground:!1,refetchOnWindowFocus:"always",retry:2,retryDelay:t=>{const a=450+Math.ceil(Math.random()*100);return Math.min(a*2**t,3e4)},onError:t=>e.post(t)}}})),ee=e=>{const t=F(M),a=_(t);return r.createElement(W,{client:a},e.children)};var P=(e=>(e.GetAllPrograms="soundcheck/programs",e.GetChecks="soundcheck/checks",e.GetCollectors="soundcheck/collectors",e.GetFactSchema="soundcheck/collectors/schema",e.GetEntityFacets="soundcheck/catalog/facets",e.GetSoftwareEntityRefsForUser="soundcheck/entities/softwareEntityRefsForUser",e.GetCampaigns="soundcheck/campaigns",e.GetCampaignProgress="soundcheck/campaigns/getCampaignProgress",e.GetOverallCheckPassRateSnapshots="soundcheck/charts/overallCheckPassRateSnapshots",e.GetOverallCheckPassRateTrends="soundcheck/charts/overallCheckPassRateTrends",e.GetIndividualCheckPassRateSnapshots="soundcheck/charts/getIndividualCheckPassRateSnapshots",e.GetIndividualCheckPassRateTrends="soundcheck/charts/getIndividualCheckPassRateTrends",e.GetOverallTrackPassRateSnapshots="soundcheck/charts/overallTrackPassRateSnapshots",e.GetOverallTrackPassRateTrends="soundcheck/charts/overallTrackPassRateTrends",e.GetIndividualTrackPassRateSnapshots="soundcheck/charts/individualTrackPassRateSnapshots",e.GetIndividualTrackPassRateTrends="soundcheck/charts/individualTrackPassRateTrends",e.GetOverallEntityPassRateTrends="soundcheck/charts/overallEntityPassRateTrends",e.GetIndividualEntityPassRateSnapshots="soundcheck/charts/individualEntityPassRateSnapshots",e.GetIndividualEntityPassRateTrends="soundcheck/charts/individualEntityPassRateTrends",e.GetOverallGroupPassRateTrends="soundcheck/charts/overallGroupPassRateTrends",e.GetIndividualGroupPassRateSnapshots="soundcheck/charts/individualGroupPassRateSnapshots",e.GetIndividualGroupPassRateTrends="soundcheck/charts/individualGroupPassRateTrends",e.EntityByRef="soundcheck/catalog/entityByRef",e.EntitiesByRefs="soundcheck/catalog/entitiesByRef",e.TrackEntities="soundcheck/tracks/entities",e))(P||{}),T=(e=>(e.DeleteCheck="soundcheck/deleteCheck",e.CreateCheck="soundcheck/createCheck",e.UpdateCheck="soundcheck/updateCheck",e.DeleteProgram="soundcheck/deleteProgram",e.CreateProgram="soundcheck/createProgram",e.UpdateProgram="soundcheck/updateProgram",e.UpdateCollectorConfig="soundcheck/updateCollectorConfig",e.CreateCampaign="soundcheck/createCampaign",e.UpdateCampaign="soundcheck/updateCampaign",e.DeleteCampaign="soundcheck/deleteCampaign",e.ArchiveCampaign="soundcheck/archiveCampaign",e))(T||{});const te=c(e=>({root:{padding:e.spacing(3)},icon:{display:"none"},message:{padding:0},type:{fontWeight:700,lineHeight:1.75}})),x=e=>{const{type:t,...a}=te();return r.createElement(j,{severity:e.severity,elevation:1,classes:a,onClose:e.onClose},r.createElement(d,{classes:{root:t}},e.title),e.children)},G=y({}),ae=e=>{const[t,a]=p(),o=l(h=>{a(h)},[]),s=l(()=>{a(null)},[]);return r.createElement(G.Provider,{value:{showAlert:o,clearAlert:s}},t&&r.createElement(x,{severity:t.severity,title:t.title,onClose:s},t.message),e.children)},re=()=>v(G),se=c(e=>({modalContent:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",padding:"25px",backgroundColor:e.palette.type==="dark"?e.palette.grey[800]:e.palette.grey[200]},modalButtons:{display:"flex",justifyContent:"space-evenly","& button":{width:"40%",maxWidth:"185px"}},modalMessage:{margin:"15px 0 35px"}})),N=y({}),oe=e=>{const t=se(),[a,o]=p(!1),[s,h]=p(),i=L(),w=l(({title:$,message:z,error:B})=>(h({title:$,message:z,error:B}),o(!0),new Promise(A=>{i.current=A})),[]),I=l(()=>{i.current&&i.current(!0),o(!1)},[]),C=l(()=>{i.current&&i.current(!1),o(!1)},[]);return r.createElement(N.Provider,{value:{showModal:w}},e.children,s&&r.createElement(Q,{open:a,onClose:C,"aria-labelledby":"confirmation-modal-title","aria-describedby":"confirmation-modal-description"},r.createElement(H,{className:t.modalContent},r.createElement(d,{id:"confirmation-modal-title",variant:"h6"},s.title),r.createElement(d,{className:t.modalMessage,id:"confirmation-modal-description",variant:"body1"},s.message),r.createElement("div",{className:t.modalButtons},!s.error&&r.createElement(E,{onClick:C,variant:"contained","aria-label":"cancel"},"Cancel"),r.createElement(E,{color:"primary",onClick:I,variant:"contained","aria-label":"confirm"},s.error?"Ok":"Confirm")))))},ne=()=>v(N),ce=e=>({[n.Passed]:"Check passed",[n.NotReported]:"Check not reported",[n.Failed]:"Check failed",[n.Warning]:"Check produced warning(s)",[n.NotApplicable]:"Check not applicable"})[e],ie=m(e=>({root:{color:e.palette.success.main}}))(q),le=m(e=>({root:{color:e.palette.error.main}}))(J),de=m(e=>({root:{color:e.palette.warning.main}}))(Y),me=m(e=>({root:{color:e.palette.info.main}}))(V),pe=m(e=>({root:{color:e.palette.text.disabled}}))(X),ue=({result:e,className:t})=>{const a={className:t,"aria-label":ce(e),"aria-hidden":!1};return e===n.Passed?r.createElement(ie,{...a}):e===n.NotReported?r.createElement(me,{...a}):e===n.Failed?r.createElement(le,{...a}):e===n.Warning?r.createElement(de,{...a}):e===n.NotApplicable?r.createElement(pe,{...a}):null},S=24,he=11,g=e=>e==="small"?1:2,ge=c({root:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",borderWidth:"2px",fontWeight:700,width:({size:e})=>`${S*g(e)}px`,height:({size:e})=>`${S*g(e)}px`,fontSize:({size:e})=>`${he*g(e)}px`}}),k=({className:e,label:t,size:a="small"})=>{const o=ge({size:a});return r.createElement("span",{className:u(e,o.root),role:"img","aria-label":`${t} badge`},t)},ke=c(e=>({root:{background:({color:t})=>t,color:e.palette.common.black,borderColor:e.palette.common.black,borderStyle:"solid","&::after":{position:"absolute",display:"block",content:'""',top:0,left:0,width:"100%",height:"100%",borderRadius:"50%",boxShadow:["inset 0 -0.18em 0 0 rgba(0, 0, 0, 0.25)","inset 0px 0.18em 0px 0px rgba(255, 255, 255, 0.5)","inset 0px 1.3em 0px -0.5em rgba(255, 255, 255, 0.2)"].join(",")}}})),fe=({className:e,badge:t,size:a="small"})=>{const o=ke({color:t.options.color,size:a});return r.createElement(k,{className:u(e,o.root),size:a,label:`L${t.options.level}`})},Ce=c({root:{borderColor:"currentColor",borderStyle:"dashed"}}),ye=({className:e,size:t="small"})=>{const a=Ce();return r.createElement(k,{className:u(e,a.root),size:t,label:"NL"})},ve=c({root:{borderColor:"currentColor",borderStyle:"solid"}}),Ee=({className:e,size:t="small"})=>{const a=ve();return r.createElement(k,{className:u(e,a.root),size:t,label:"C"})},be=({children:e})=>{const[t,a]=p(!1);return U(()=>{const o=setTimeout(()=>{a(!0)},250);return()=>clearTimeout(o)},[]),r.createElement(K,{in:t,timeout:250},e)},Re=c(e=>({card:{backgroundColor:e.palette.background.paper,border:`1px solid ${e.palette.border}`,borderRadius:e.shape.borderRadius,display:"flex",padding:e.spacing(5)},container:{margin:"0 auto",display:"flex",flexDirection:"row",alignItems:"center",gap:e.spacing(5)},content:{width:"20rem",display:"flex",flexDirection:"column",gap:e.spacing(2)},header:{display:"flex",flexDirection:"column",gap:e.spacing(2)},description:{color:e.palette.grey[600],fontWeight:500},action:{display:"inline-block"},img:{maxHeight:400}})),f=({title:e,description:t,imgSrc:a,action:o})=>{const s=Re();return r.createElement("div",{className:s.card},r.createElement("div",{className:s.container},r.createElement("div",{className:s.content},r.createElement("header",{className:s.header},r.createElement(d,{variant:"h5"},e),r.createElement(d,{variant:"body1",className:s.description},t)),o&&r.createElement("div",{className:s.action},o)),r.createElement("div",null,r.createElement("img",{src:a!=null?a:Z,className:s.img,alt:e}))))},Pe="No certifications available",Te=({ownerEntityRef:e,selectGroupHint:t})=>{let a="There are no tracks configured that apply to this entity.";return e&&(a=`Looks like the group '${R(b(e),{defaultKind:"Group"})}' doesn't own any entities that have any applicable tracks configured. ${t}`),r.createElement(f,{title:Pe,description:a})},xe="Missing entities",Ge=({ownerEntityRef:e,selectGroupHint:t})=>{if(!e)return null;const a=R(b(e),{defaultKind:"Group"});return r.createElement(f,{title:xe,description:`The group '${a}' doesn't own any entities. ${t!=null?t:""}`})};export{x as A,oe as B,ue as C,f as E,be as F,fe as L,T as M,Te as N,P as Q,ee as S,ye as a,Ee as b,Ge as c,ne as d,ae as e,re as u};
|
|
2
|
-
//# sourceMappingURL=EmptyState-6a402254.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import e,{useState as te,useEffect as ae,useRef as ne,createContext as re,useContext as ie,useMemo as le}from"react";import{useApi as S,useRouteRef as y,useRouteRefParams as L}from"@backstage/core-plugin-api";import{useEntity as f}from"@backstage/plugin-catalog-react";import{Link as O,useParams as j,Routes as oe,Route as v,Navigate as I}from"react-router-dom";import{R as ce,b as C,c as se,u as $,d as de,a as me,e as pe,f as ue}from"./CertificationSidebar-5e4230a7.esm.js";import{useQuery as B}from"@tanstack/react-query";import{s as F,R as u,d as w,c as x,b as G,f as A,a as Q}from"./routes-93cd1496.esm.js";import{stringifyEntityRef as D}from"@backstage/catalog-model";import{A as R,F as H,N as ge,S as fe}from"./EmptyState-6a402254.esm.js";import{makeStyles as g,Typography as k,Box as V,Tab as W,Tabs as Y,styled as M,Accordion as Ee,AccordionSummary as he,AccordionDetails as ye,useTheme as ve,Paper as ke,Divider as be}from"@material-ui/core";import{SpotifyLicenseBanner as Ce}from"@spotify/backstage-plugin-core";import{s as Re,i as Ie}from"./license-e9e73904.esm.js";import{Skeleton as E}from"@material-ui/lab";import{MarkdownContent as N,LinearGauge as we,Link as xe}from"@backstage/core-components";import Ne from"react-confetti";import Te from"react-use/lib/useMeasure";import q from"react-use/lib/usePrevious";import{R as Pe}from"./RefetchingIndicator-b4961e02.esm.js";import Se from"@material-ui/icons/ExpandMore";import{i as Le}from"./chartUtils-080232d7.esm.js";import T from"lodash";import"classnames";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 $e(t){const a=S(F);return B(["soundcheck/certifications",t],async()=>a.getCertificationDetails(t))}function Be(t,a,n){const i=S(F),r=D(t);return B(["soundcheck/check-details",r,a,n],async()=>i.getCheckResultDetails(r,a,n),{enabled:!!a&&!!n})}function P(t){const a=S(F),n=D(t);return B(["soundcheck/playlists",n],async()=>a.getPlaylists(n))}const Fe=g({markdownContent:{"& :last-child":{marginBottom:0}}}),Ae=({state:t,notes:a})=>{const n=Fe(),i={[u.Passed]:"success",[u.Failed]:"error",[u.Warning]:"warning",[u.NotReported]:"info",[u.NotApplicable]:"info"}[t],r={[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(R,{severity:i,title:r},a?e.createElement(N,{className:n.markdownContent,content:a}):null)},De=()=>{const t=J();return e.createElement(H,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))))},J=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)}})),K=({programId:t,checkId:a})=>{const n=J(),{entity:i}=f(),{data:r,isLoading:l,isError:o}=Be(i,t,a);if(o)return e.createElement(V,{padding:2},e.createElement(R,{severity:"error",title:"Error loading check details"}));if(l||!t||!a)return e.createElement(De,null);if(!r)return null;const{name:s,description:p,result:d,timestamp:c,notes:m}=r;return e.createElement("div",{className:n.root,"data-testid":"check-details-view"},e.createElement("div",{className:n.topBar},e.createElement(k,{variant:"h2",className:n.title},s),c?e.createElement(ce,{timestamp:c,description:"Last updated"}):null),e.createElement(Ae,{state:d,notes:m}),e.createElement("div",{className:n.description,"data-testid":"soundcheck-check-details-description"},e.createElement(k,{variant:"h3",className:n.subtitle},"Description"),e.createElement(N,{content:p})))},We=g(()=>({root:{position:"absolute",width:"100%",height:"100%"}})),Me=({programId:t})=>{var a,n;const i=We(),{entity:r}=f(),{data:l,isLoading:o}=C(r,t),[s,{width:p,height:d}]=Te(),c=o?void 0:(n=(a=l==null?void 0:l.highestLevel)==null?void 0:a.ordinal)!=null?n:-1,m=q(c),h=q(t),[ee,U]=te(!1);return ae(()=>{typeof m!="undefined"&&typeof c!="undefined"&&t===h&&c>m&&U(!0)},[c,m,t,h]),ee?e.createElement("div",{ref:s,className:i.root},e.createElement(Ne,{width:p,height:d,numberOfPieces:1e3,gravity:1,initialVelocityY:20,recycle:!1,onConfettiComplete:()=>U(!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)}})),ze=({id:t,name:a,badge:n,href:i,selected:r=!1})=>{const l=X(),{entity:o}=f(),{data:s}=C(o,t);return e.createElement(W,{className:l.root,classes:{wrapper:l.wrapper},value:t,label:e.createElement(e.Fragment,null,e.createElement(se,{badge:n,isCampaign:(s==null?void 0:s.program.type)==="campaign",className:l.badge}),a),component:O,to:i,selected:r})},Ue=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)}})),Oe=({id:t,name:a,href:n,selected:i=!1})=>{const r=Ue();return e.createElement(W,{className:r.root,classes:{wrapper:r.wrapper},value:t,label:a,component:O,to:n,selected:i})},z=()=>{const t=X();return e.createElement(W,{className:t.root,classes:{wrapper:t.wrapper},label:e.createElement(E,{width:180})})},je=()=>e.createElement(H,null,e.createElement(Y,{value:!1,indicatorColor:"primary"},e.createElement(z,null),e.createElement(z,null),e.createElement(z,null)));function Ge(t=[],a=[],n,i){if(n){const l=t.findIndex(o=>o.id===n);return l<0?!1:l}const r=a.findIndex(l=>l.program.id===i);return r<0?!1:r+t.length}const Qe=({playlistId:t,trackId:a})=>{const{entity:n}=f(),{isLoading:i,data:r}=$(n),{isLoading:l,data:o}=P(n),s=y(w),p=y(x);if(l||i||!a)return e.createElement(je,null);const d=Ge(o,r,t,a);return e.createElement(Y,{value:d,indicatorColor:"primary","aria-label":"Certifications",variant:"scrollable"},(o==null?void 0:o.length)&&o.map(({id:c,name:m})=>e.createElement(Oe,{key:c,id:c,name:m,selected:c===a,href:s({playlistId:c})})),r&&r.filter(({program:{type:c}})=>c!=="playlist").map(({program:{id:c,name:m},highestLevel:h})=>e.createElement(ze,{key:c,id:c,name:m,badge:h==null?void 0:h.badge,selected:c===a,href:p({trackId:c})})))},He=M(Ee)(({theme:t})=>({margin:"0 !important",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}`}})),Ve=M(({...t})=>e.createElement(he,{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"}})),Ye=M(ye)(()=>({margin:"0 !important",borderRadius:0,padding:0})),qe=g(()=>({sidebar:{width:"100%"}})),Je=({playlistId:t,trackId:a,checkId:n})=>{var i;const r=qe(),{entity:l}=f(),o=ne(null),{data:s,isLoading:p,isError:d}=C(l,a);if(d)return e.createElement("div",null,e.createElement(V,{padding:2},e.createElement(R,{severity:"error",title:"Error loading certification"})));if(p||!a)return e.createElement(de,null);if(!s)return null;const c=s.program.type==="campaign";return e.createElement(He,{ref:o,defaultExpanded:!0,elevation:0},e.createElement(Ve,{expandIcon:e.createElement(Se,null),"aria-controls":"certification-content",id:"certification-summary"},e.createElement(me,{name:s.program.name,badge:(i=s.highestLevel)==null?void 0:i.badge,description:s.program.description,documentationUrl:s.program.documentationURL,isCampaign:c})),e.createElement(Ye,null,e.createElement("div",{className:r.sidebar},s==null?void 0:s.levels.map(m=>e.createElement(pe,{key:m.ordinal,level:m,checkId:n,trackId:a,playlistId:t,isCampaign:c})))))},Z=re(void 0),Ke=()=>{const t=ie(Z);if(!t)throw new Error("useAPlaylistCertificationContext must be used within an PlaylistCertificationProvider");return t},Xe=t=>{const{children:a,entityRef:n}=t,i=$e(n);return e.createElement(Z.Provider,{value:i},a)},Ze=(t,a)=>{if(a)return a.filter(n=>t.trackIds.includes(n.program.id)).map(n=>{const i=T.sumBy(n.levels,o=>T.filter(o.checks,{result:u.Passed}).length),r=T.sumBy(n.levels,o=>T.reject(o.checks,{result:u.NotApplicable}).length),l=r===0?0:i/r;return{id:n.program.id,name:n.program.name,checkPassRate:l}})},_e=g(()=>({root:{margin:0,width:"250px"},trackItem:{display:"flex",flexDirection:"column",alignItems:"flex-start"},trackName:{margin:0,padding:0}})),et=({playlist:t})=>{const a=_e(),{data:n}=Ke(),i=ve(),r=le(()=>Ze(t,n),[n,t]);return e.createElement("div",{className:a.root},r&&r.map(l=>e.createElement("div",{className:a.trackItem,key:l.id},e.createElement(k,{variant:"caption",color:"textSecondary"},l.name),e.createElement("div",{style:{width:"100%",margin:0,padding:0}},e.createElement(we,{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 tt({description:t,documentationUrl:a}){const n=_();return a?e.createElement("div",{className:n.description},e.createElement(N,{content:t}),e.createElement(xe,{to:a},"Learn more")):e.createElement("div",{className:n.description},e.createElement(N,{content:t}))}const at=({playlist:t})=>{const a=_(),{name:n,description:i}=t;return e.createElement("div",{className:a.root},e.createElement(et,{playlist:t}),e.createElement("div",null,e.createElement(k,{className:a.title},n),i&&e.createElement(tt,{description:i,documentationUrl:void 0})))},nt=g(t=>({root:{margin:0,display:"grid",gridTemplateColumns:"1fr",backgroundColor:Le(t)?t.palette.background.paper:t.palette.background.default},section:{backgroundColor:t.palette.background.paper,borderBottom:`1px solid ${t.palette.divider}`,padding:0},twoColumns:{display:"grid",gridTemplateColumns:"1fr 2fr"},sidebar:{display:"grid",gridTemplateColumns:"1fr",borderRight:`1px solid ${t.palette.divider}`}})),rt=({playlist:t,entityRef:a})=>{const n=nt(),{trackId:i,checkId:r}=j();return e.createElement("div",{className:n.root},e.createElement(Xe,{entityRef:a},e.createElement("div",{className:n.section},e.createElement(at,{playlist:t,entityRef:a})),e.createElement("div",{className:n.twoColumns},e.createElement("div",{className:n.sidebar},t.trackIds.map(l=>e.createElement(Je,{key:l,playlistId:t.id,trackId:l,checkId:r}))),e.createElement("div",{className:n.section},e.createElement(K,{programId:i,checkId:r})))))},it=g(t=>({paper:{overflow:"hidden",position:"relative"},view:{display:"grid",gridTemplateColumns:"1fr 2fr"},sidebar:{borderRight:`1px solid ${t.palette.divider}`}})),lt=()=>{const{playlistId:t,trackId:a,checkId:n}=j(),i=it(),{entity:r}=f(),{isError:l,isFetched:o,data:s}=$(r),{isError:p,data:d}=P(r);if(l||p)return e.createElement(R,{severity:"error",title:"Error loading certifications"});const c=t&&(d==null?void 0:d.find(h=>h.id===t));if(t&&!c)return e.createElement(R,{severity:"error",title:"Playlist ${playlistId} not found."});if(o&&!(s!=null&&s.length))return e.createElement(ge,null);const m=r?D(r):void 0;return e.createElement(ke,{className:i.paper},e.createElement(Pe,null),e.createElement(Qe,{playlistId:t,trackId:a}),e.createElement(be,null),c&&e.createElement(rt,{playlist:c,entityRef:m}),!c&&a&&e.createElement("div",{"data-testid":"soundcheck-certification-view",className:i.view},e.createElement("div",{className:i.sidebar},e.createElement(ue,{trackId:a,checkId:n})),e.createElement(K,{programId:a,checkId:n}),e.createElement(Me,{programId:a})))},ot=g(t=>({root:{"&:not(:first-child)":{marginTop:t.spacing(2)}}})),b=()=>{const t=ot();return e.createElement(e.Fragment,null,e.createElement(Ce,{backend:Re,invalidLicenseMessage:Ie,inline:!0}),e.createElement("div",{className:t.root},e.createElement(lt,null)))},ct=()=>{var t,a;const{entity:n}=f(),i=y(w),r=y(x),{isLoading:l,data:o}=P(n),{isLoading:s,data:p}=$(n);if(l||s)return null;const d=(t=o==null?void 0:o[0])==null?void 0:t.id,c=(a=p==null?void 0:p[0])==null?void 0:a.program.id;return!d&&!c?null:e.createElement(I,{to:d?i({playlistId:d}):r({trackId:c}),replace:!0})},st=()=>{var t;const{entity:a}=f(),{playlistId:n}=L(w),i=y(A),{data:r}=P(a),l=(t=r==null?void 0:r.find(o=>o.id===n))==null?void 0:t.trackIds[0];return l?e.createElement(I,{to:i({playlistId:n,trackId:l}),replace:!0}):null},dt=()=>{var t,a;const{entity:n}=f(),{playlistId:i,trackId:r}=L(A),{data:l}=C(n,r),o=y(G),s=(a=(t=l==null?void 0:l.levels[0])==null?void 0:t.checks[0])==null?void 0:a.id;return s?e.createElement(I,{to:o({playlistId:i,trackId:r,checkId:s}),replace:!0}):null},mt=()=>{var t,a;const{entity:n}=f(),{trackId:i}=L(x),r=y(Q),{data:l}=C(n,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(I,{to:r({trackId:i,checkId:o}),replace:!0}):null},pt=()=>e.createElement(oe,null,e.createElement(v,{path:G.path,element:e.createElement(b,null)}),e.createElement(v,{path:A.path,element:e.createElement(e.Fragment,null,e.createElement(b,null),e.createElement(dt,null))}),e.createElement(v,{path:w.path,element:e.createElement(e.Fragment,null,e.createElement(b,null),e.createElement(st,null))}),e.createElement(v,{path:x.path,element:e.createElement(e.Fragment,null,e.createElement(b,null),e.createElement(mt,null))}),e.createElement(v,{path:Q.path,element:e.createElement(b,null)}),e.createElement(v,{path:"/",element:e.createElement(e.Fragment,null,e.createElement(b,null),e.createElement(ct,null))})),ut=()=>e.createElement(fe,null,e.createElement(pt,null));export{ut as EntitySoundcheckContent};
|
|
2
|
-
//# sourceMappingURL=EntitySoundcheckContent-bc7bdbe2.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useApi as w,identityApiRef as re,useRouteRef as T,configApiRef as le}from"@backstage/core-plugin-api";import t,{useState as $,useEffect as I,createContext as Ze,useContext as et,useMemo as W,useCallback as A,memo as F,Fragment as tt}from"react";import{useSearchParams as oe,useLocation as at,useNavigate as nt}from"react-router-dom";import{s as V,r as rt,h as lt,i as ot,R as O,B as it,j as st}from"./routes-93cd1496.esm.js";import{stringifyEntityRef as U,parseEntityRef as B}from"@backstage/catalog-model";import{catalogApiRef as G,EntityRefLink as ie,humanizeEntityRef as M,entityRouteRef as _}from"@backstage/plugin-catalog-react";import ct from"react-use/lib/useAsync";import{makeStyles as E,alpha as se,TextField as dt,CircularProgress as ce,Grid as N,Typography as f,Button as mt,Menu as pt,MenuItem as de,TablePagination as me,withStyles as ut,Tooltip as pe,LinearProgress as gt,Accordion as ft,AccordionSummary as ht,AccordionDetails as yt}from"@material-ui/core";import vt from"@material-ui/lab/Autocomplete";import{useQuery as L}from"@tanstack/react-query";import{Q as K,C as Et,L as ue,a as ge,b as fe,A as kt,N as bt,c as Ct}from"./EmptyState-6a402254.esm.js";import{HeaderTabs as he,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 ye}from"@material-ui/core/styles";import{motion as ve}from"framer-motion";import{R as $t}from"./RefetchingIndicator-b4961e02.esm.js";import St,{countBy as Ee}from"lodash";import{Skeleton as Q}from"@material-ui/lab";import{VariableSizeGrid as Tt}from"react-window";function ke(e,a,n,r){const l=w(V);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 be(){const e=w(G);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:U(n)}})},{staleTime:5*60*1e3,refetchInterval:!1,refetchOnWindowFocus:!1})}function It(){const e=w(re),a=w(G);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:U(r),type:(s=r.spec)==null?void 0:s.type}})})}function Ce(e){const a=w(V);return L([K.GetCampaigns,JSON.stringify(e)],async()=>a.getCampaigns(e),{staleTime:5*60*1e3,refetchInterval:!1,refetchOnWindowFocus:!1})}function Lt(e){const a=w(V);return L(["soundcheck/facets-for-owner",e],async()=>a.getFacetsForOwner(e),{enabled:!!e,staleTime:5*60*1e3,refetchInterval:!1,refetchOnWindowFocus:!1})}const Ft=()=>{const[e,a]=oe(),n=Object.fromEntries(e.entries()),[r,l]=$(n),i=T(rt),o=at().pathname.replace(/\/+$/,"")===i();return I(()=>{o&&a(r,{replace:!0})},[r,o]),[r,l]},we=e=>{const a=w(V);return L([K.GetIndividualEntityPassRateSnapshots,{...e,numberOfDays:0}],async()=>a.getIndividualEntityPassRates({...e,numberOfDays:0}),{staleTime:5*60*1e3,refetchInterval:!1,refetchOnWindowFocus:!1})},Re={loading:!0},Ne=Ze(Re),Ot=()=>et(Ne),zt=({children:e})=>{const[a,n]=$(Re),r=w(G),l=w(re),{value:i,loading:o,error:d}=ct(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=U(i);n({user:i,userEntityRef:s,loading:o,error:d})}else n({loading:o,error:d})},[i,o,d]),t.createElement(Ne.Provider,{value:a},e)},xe=()=>{const{data:e,isLoading:a,isError:n}=It(),{data:r,isLoading:l,isError:i}=be();return{options:W(()=>{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}},At=E(e=>({root:{width:"100%",minWidth:250},textField:{"& $notchedOutline":{borderColor:se(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"}),Bt=e=>{const{onChange:a,initialValue:n,setError:r}=e,{options:l,isLoading:i,isError:o}=xe(),d=At(),[s,c]=$(null),p=w(le).getOptionalString("soundcheck.overview.defaultSelectedGroupType");I(()=>{var m,u;if(!i&&l!=null&&l.length&&!s){let g;n?g=(m=l.find(y=>y.ref===n))!=null?m:l[0]:p?g=(u=l.find(y=>y.type===p))!=null?u:l[0]:g=l[0],g&&(c(g),a==null||a(g.ref))}},[i,l,s,a,n,p]);const h=A((m,u)=>{c(u),a==null||a(u==null?void 0:u.ref)},[a,c]);return I(()=>{r==null||r(o?new Error("Error loading groups"):void 0)},[o,r]),o?null:t.createElement(vt,{"aria-label":"Current group",className:d.root,classes:{clearIndicator:d.clearIndicator,popupIndicator:d.popupIndicator},disableClearable:!0,options:l!=null?l:[],loading:i,groupBy:m=>m.key,value:s,freeSolo:!1,onChange:h,getOptionLabel:m=>m.name,renderInput:m=>t.createElement(dt,{...m,variant:"outlined",placeholder:i?"Loading":"Select a group",className:d.textField,InputProps:{...m.InputProps,className:d.input,classes:{notchedOutline:d.notchedOutline},endAdornment:t.createElement(t.Fragment,null,i?t.createElement(ce,{color:"inherit",size:20}):null,m.InputProps.endAdornment)}})})},Dt=E(e=>({loadingContainer:{marginTop:e.spacing(1),display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}})),Pe=({size:e})=>{const a=Dt();return t.createElement(N,{container:!0,className:a.loadingContainer},t.createElement(ce,{size:e}))},Wt=ye(e=>({detailRow:{marginBottom:e.spacing(1)},label:{fontWeight:"bold",color:e.palette.text.primary},value:{marginLeft:e.spacing(1)}})),z=({label:e,value:a})=>{const n=Wt();return t.createElement(N,{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))},Gt=ye(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=Gt(),{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(N,{container:!0,className:a.innerContainer,spacing:2},t.createElement(N,{item:!0,container:!0,xs:12,spacing:0},t.createElement(z,{label:"Name",value:n}),t.createElement(z,{label:"Description",value:r}),t.createElement(z,{label:"Owner",value:t.createElement(ie,{entityRef:l})}),d&&t.createElement(z,{label:"Support channel",value:d}),t.createElement(z,{label:"Start date",value:J(i)}),t.createElement(z,{label:"Target completion date",value:J(o)}))))};function jt({angle:e,arc:a,direction:n,dist:r,emoji:l,delay:i,fontSize:o,speed:d}){return t.createElement(ve.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 Ht=["\u{1F4C8}","\u{1F4CA}","\u{1F4C9}","\u{1F680}","\u2B50\uFE0F"],Vt=E(()=>({container:{position:"relative"}}));function Ut({angle:e=125,density:a=20,emojis:n=Ht,fontSizeMin:r=6,fontSizeMax:l=24,size:i=300,speed:o=4}){const d=Vt(),s=W(()=>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(jt,{key:`${c.emoji}-${p}`,...c})))}const _t=E(()=>({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 $e({title:e,subtitle:a}){const n=_t();return t.createElement("div",{className:n.container},t.createElement("div",{className:n.textContainer},t.createElement(Ut,null),t.createElement(ve.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 Kt=E(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%"}})),Qt=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))},Jt=e=>e==null?void 0:e.filter(({snapshotPassRate:a})=>a===100).length,qt=e=>{if(e!=null&&e.length){const a=Jt(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=Kt(),r=T(lt),l=T(ot),i=nt(),[o,d]=$(null),s=150,c=e.track.levels.flatMap(({checks:X})=>X.map(({id:Ye})=>Ye)),{data:p,isLoading:h,isError:m}=we({tracks:[{trackId:e.track.id}],checkIds:{included:c}}),u=(a=p==null?void 0:p.individualEntityPassRates)!=null?a:[],g=X=>{d(X.currentTarget)},y=()=>{d(null)},k=()=>{i(l({campaignId:e.id}))},v=()=>{i(r({campaignId:e.id}))};if(h)return t.createElement("div",{"data-testid":"loading-indicator"},t.createElement($e,null));if(m)return t.createElement(f,{color:"error"},"Failed to load campaigns progress.");const b=u.length?Qt(u):0,R=qt(u),{name:P,description:x,ownerEntityRef:C,targetCompletionDate:D,startDate:Xe,supportChannel:ne}=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"},P),t.createElement(f,{variant:"body1",className:n.description},x.length>s?`${x.substring(0,s)}...`:x)),t.createElement("div",null,t.createElement(mt,{variant:"text","aria-controls":"menu","aria-haspopup":"true",onClick:g},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(pt,{id:"campaign-menu",anchorEl:o,keepMounted:!0,open:!!o,onClose:y},t.createElement(de,{onClick:v},"View"),t.createElement(de,{onClick:k},"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(ie,{entityRef:C}))),ne&&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},ne))),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(Xe))),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(D)))),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"},b,"%")),t.createElement("div",{className:n.flexColumn},t.createElement(f,{variant:"subtitle1",className:n.label},"Entities Complete"),R)))))},Yt=E(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)}})),Zt=({unfilteredFacets:e,onChange:a,kind:n,type:r})=>{var l,i,o;const d=Yt(),s={types:(l=e==null?void 0:e.types.filter(({count:m})=>m>0))!=null?l:[]},c=A(m=>{var u;a((u=s==null?void 0:s.types[m].kind)!=null?u:"",s==null?void 0:s.types[m].type)},[s==null?void 0:s.types,a]);I(()=>{var m,u,g;const y=(s==null?void 0:s.types)&&s.types.length>=0,k=!n&&y,v=n&&y&&!(s!=null&&s.types.find(({kind:b,type:R})=>n===b&&(!r&&!R||r===R)));(k||v)&&a((u=(m=s==null?void 0:s.types[0])==null?void 0:m.kind)!=null?u:"",(g=s==null?void 0:s.types[0])==null?void 0:g.type)},[n,r,s==null?void 0:s.types,a]);const p=(i=s==null?void 0:s.types.map(({kind:m,type:u,count:g})=>{const y=`${m}|${u!=null?u:""}`;return{key:y,label:`${u!=null?u:m} (${g>50?"50+":g})`,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(he,{onChange:c,tabs:p,selectedIndex:h>-1?h:void 0}))},ea=e=>({key:`skeleton${e}`,label:"",id:`skeleton${e}`}),ta=()=>{const e=Array.from({length:4},(a,n)=>ea(n));return t.createElement(he,{tabs:e})};var Se=(e=>(e.Alpha="default",e.Owner="all",e.Status="all",e))(Se||{});const q=12,aa=E(e=>({pagination:{width:"-webkit-fill-available",display:"flex",justifyContent:"center",position:"fixed",bottom:"0",backgroundColor:e.palette.type==="dark"?"#333333":"#F8F8F8",marginRight:"40px"}})),na=({response:e,listingsPerPage:a,cursor:n,setCursor:r,prevCursors:l,setPrevCursors:i,labelPerPageDropdown:o,urlRoute:d})=>{var s;const c=aa(),p=e!=null&&e.edges?e==null?void 0:e.edges[(e==null?void 0:e.edges.length)-1]:{cursor:""},[h,m]=$(0),u=()=>{i(v=>[...v,n]),r(p==null?void 0:p.cursor)},g=()=>{r(l[l.length-1]),i(v=>v.slice(0,-1))},y=(v,b)=>{m(R=>(b>R?u():g(),b))},k=v=>{window.open(`/soundcheck/${d!=null?d:"tracks?tracksPerPage="}${v.target.value}`,"_self")};return t.createElement(me,{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:k,labelRowsPerPage:o!=null?o:"Listings per page:",rowsPerPageOptions:[q,q*2,q*4]})},ra=E(e=>({pagination:{width:"-webkit-fill-available",display:"flex",justifyContent:"center",position:"fixed",bottom:"0",backgroundColor:e.palette.type==="dark"?"#333333":"#F8F8F8",marginRight:"40px",zIndex:1e3}})),Y=({defaultPageSize:e,label:a})=>{const[n,r]=$(),[l,i]=oe(),o=l.get(a),d=o?parseInt(o,10):e,[s,c]=$(0),p=A(h=>{i(m=>{var u;return m.set("entitiesPerPage",(u=h.target.value)!=null?u:e),m}),c(0),r(void 0)},[e,i]);return{cursor:n,setCursor:r,pageSize:d,currentPage:s,setCurrentPage:c,onRowsPerPageChange:p}},Z=({totalCount:e,setCursor:a,endCursor:n,prevCursor:r,defaultPageSize:l,currentPage:i,setCurrentPage:o,onRowsPerPageChange:d,pageSize:s,labelRowsPerPage:c,rowsPerPageOptions:p})=>{const h=ra(),m=A(()=>{n&&a(n)},[n,a]),u=A(()=>{r&&a(r)},[r,a]),g=(y,k)=>{o(v=>(k>v?m():k<v&&u(),k))};return t.createElement(me,{className:h.pagination,component:"div",count:e,page:i,onPageChange:g,rowsPerPage:s!=null?s:l,onRowsPerPageChange:d,labelRowsPerPage:c,rowsPerPageOptions:p!=null?p:[l,l*2,l*4]})},Te=ut(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}}})(pe),la=E(e=>({headerWrapper:{marginTop:e.spacing(.5)},entityRefName:{fontWeight:"bold"},iconWrapper:{padding:e.spacing(1.5,.5),display:"flex",alignItems:"center",justifyContent:"center"}})),oa=({check:{name:e,description:a},icon:n,entityRef:r})=>{const l=la(),i=B(r);return t.createElement(N,{spacing:1},t.createElement(N,{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(N,{item:!0,wrap:"nowrap"},t.createElement(f,{variant:"subtitle2",className:l.entityRefName},M(i,{defaultKind:i.kind}))),t.createElement(wt,{content:a}))},ia=({children:e,check:a,icon:n,entityRef:r})=>t.createElement(Te,{arrow:!0,title:t.createElement(oa,{check:a,icon:n,entityRef:r}),enterDelay:150,placement:"top"},e),sa=E(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}`}})),Ie=F(({programId:e,check:a,entityRef:n,result:r,entityRoute:l,isVirtualized:i})=>{const o=sa();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:O.NotReported}),s=t.createElement("div",{className:o.iconWrapper},d),c=r&&r===O.NotApplicable?s:t.createElement(j,{className:o.link,to:`${l(B(n))}/soundcheck/tracks/${e}/checks/${a.id}`},s);return i?t.createElement("div",{className:`${o.root} ${o.virtualized}`},t.createElement(ia,{check:a,icon:d,entityRef:n},c)):t.createElement("td",{className:`${o.root}`},c)}),ca=E(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"}})),Le=e=>{var a,n;const r=ca(e),l=W(()=>Object.entries(e.progress).reduce((o,[,d])=>o+d,0),[e.progress]);if(l===0)return null;const i=(a=e.progress[O.Passed])!=null?a:0;return t.createElement(pe,{arrow:!0,title:`Check passing for ${i} of ${l} ${l===1?"entity":"entities"}`,enterDelay:0,placement:"top"},t.createElement(gt,{variant:"determinate",value:((n=e.progress[O.Passed])!=null?n:0)/l*100,classes:{root:r.root,bar:r.bar}}))},Fe=8,da=16,S={programTitle:70,levelTitle:30,check:42,entityRefFooter:100,paginationControl:50},H={programTitle:350+da*2,checkResult:42},Oe=e=>e.reduce((a,n)=>a+n.height,0),ze=e=>e*H.checkResult+H.programTitle,Ae=e=>e.filter(a=>a!==void 0).map(a=>{const n=B(a);return M(n,{defaultKind:n.kind})}).reduce((a,n)=>a.length>n.length?a:n,""),Be=e=>Fe*e+Fe,De="NoLevel",ma=e=>({name:De,badge:{options:{level:0,color:""},variant:it.Medal},entityRef:e,ordinal:0}),We=E(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:`${S.check}px`,lineHeight:`${S.check}px`,borderBottom:`1px solid ${e.palette.divider}`,borderRight:`1px solid ${e.palette.divider}`}})),pa=F(({programId:e,programName:a,check:n,entityRefs:r,results:l,entityRoute:i})=>{const o=We(),d=W(()=>Ee(l.filter(({result:c})=>c!==O.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(Le,{className:o.checkIndicator,progress:d}))),r.map((c,p)=>t.createElement(Ie,{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=We();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(Le,{className:n.checkIndicator,progress:a})))},ee=E(e=>{const a=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{root:{color:se(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:`${S.levelTitle}px`}}}),ga=F(({level:e,entityRefs:a,programName:n})=>{const r=ee();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=ee();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=ee();return t.createElement("div",{className:`${e.levelHeaderCell} ${e.root}`},"\xA0")},ya=E(e=>({virtualized:{borderRight:`1px solid ${e.palette.divider}`,height:`${S.programTitle}px`,display:"flex",justifyContent:"center",alignItems:"center"}})),va=F(({entityRef:e,highestLevels:a,trackType:n})=>{const r=a.find(i=>i.entityRef===e);let l=r!=null&&r.badge?t.createElement(ue,{badge:r.badge}):t.createElement(ge,null);return n==="campaign"&&(l=t.createElement(fe,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!==De?t.createElement(ue,{badge:e.badge}):t.createElement(ge,null);return a==="campaign"&&(r=t.createElement(fe,null)),t.createElement("div",{className:n.virtualized},r)},Ge=E(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=F(({program:e,entityRefs:a,highestLevels:n})=>{const r=Ge();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=F(({name:e})=>{const a=Ge();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(tt,{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}))))),Me=e=>{const a=w(G);return L([K.EntitiesByRefs,e],async()=>a.getEntitiesByRefs({entityRefs:e.entityRefs,fields:e.fields}),{refetchOnWindowFocus:!1,onError:()=>{},enabled:!!e.entityRefs})},je=e=>{const a=w(G);return L([K.EntityByRef,e],async()=>a.getEntityByRef(e),{onError:()=>{},enabled:!!e})},He=E(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=T(_),n=He(),{data:r}=Me({entityRefs:St.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=B(l),d=r==null?void 0:r.items.find(s=>s&&U(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:M(o,{defaultKind:o.kind}))))})))},Ra=({entityRef:e})=>{const{data:a}=je(e),n=T(_),r=He(),l=e?B(e):void 0,i=l?t.createElement(j,{to:n(l)},a!=null&&a.metadata.title?a.metadata.title:M(l,{defaultKind:l.kind})):t.createElement(t.Fragment,null);return t.createElement("div",{className:r.cell},t.createElement("div",{className:r.cellInner},i))},Na=E(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]}})),te=({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=E(e=>({root:{width:"100%"},table:{overflow:"auto",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:"60ch"},"& 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=F(e=>{const{setError:a,kind:n,type:r,ownerEntityRef:l}=e,i=xa(),o=T(_),{cursor:d,pageSize:s,...c}=Y({defaultPageSize:Ve,label:"entitiesPerPage"}),{data:p,isLoading:h,isError:m}=ke(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(te,null);if(!p||!l)return null;const{programs:u,entityRefs:g,totalCount:y,endCursor:k,prevCursor:v}=p;if(!h&&!u.length)return t.createElement(Rt,{missing:"data",title:"Missing tracks",description:t.createElement(t.Fragment,null,"Looks like the group"," ",M(B(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 b=g.length>=25?g:[...g,...Array.from({length:25-g.length},()=>{})];return t.createElement("div",{className:i.root},t.createElement("table",{className:i.table,"aria-label":"Check results"},u.map(({program:R,levels:P,highestLevels:x},C)=>t.createElement(Ca,{key:C,program:R,entityRefs:b,levels:P,highestLevels:x,entityRoute:o})),t.createElement(wa,{entityRefs:b})),t.createElement(Z,{...c,totalCount:y,defaultPageSize:Ve,endCursor:k,prevCursor:v,labelRowsPerPage:"Entities per page:",pageSize:s}))}),$a=e=>t.createElement(ba,{name:e}),Sa=e=>({type:"ProgramHeader",render:()=>$a(e)}),Ta=e=>e?t.createElement(fa,{name:e}):t.createElement(ha,null),Ue=e=>({type:"LevelHeader",render:()=>Ta(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(Ie,{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}),ae=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:S.programTitle,cells:[Sa(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:S.levelTitle,cells:[Ue(c.name),...a.map(p=>Ue(""))]});for(const{check:p,results:h}of c.checks)l.push({height:S.check,cells:[_e(p.name,Ee(h.filter(({result:m})=>m!==O.NotApplicable),"result")),...a.map(m=>{var u,g;return Ke(o.id,p,m,(g=(u=h.find(y=>y.entityRef===m))==null?void 0:u.result)!=null?g:O.NotApplicable,n)})]})}}const i=Ae(a!=null?a:[]);return l.push({height:Be((r=i.length)!=null?r:1),cells:[ae(""),...a.map(o=>ae(o||""))]}),l},Je=25,Ba=E(e=>({table:{backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap",textAlign:"left",overflow:"auto"}})),Da=({setError:e,kind:a,type:n,ownerEntityRef:r})=>{const{cursor:l,pageSize:i,...o}=Y({defaultPageSize:Je,label:"entitiesPerPage"}),{data:d,isLoading:s,isError:c}=ke(r,{kind:a,type:n},i,l),p=Ba(),h=T(_);if(I(()=>{e==null||e(c?new Error("Error loading program overview"):void 0)},[c,e]),s)return t.createElement(te,null);if(!d||!r)return null;const{programs:m,entityRefs:u,totalCount:g,endCursor:y,prevCursor:k}=d,v=u.length>=25?u:[...u,...Array.from({length:25-u.length},()=>{})],b=Aa(m,v,h),R=Qe(b);return t.createElement(t.Fragment,null,t.createElement(N,{"aria-label":`Check results for ${n!=null?n:a}`,key:`${a}|${n!=null?n:""}`,item:!0,xs:12},t.createElement(Tt,{className:p.table,columnCount:v.length+1,columnWidth:P=>P===0?H.programTitle:H.checkResult,rowCount:b.length,rowHeight:P=>b[P].height,height:Oe(b)+S.paginationControl,width:ze(v.length)},R)),t.createElement(Z,{...o,totalCount:g,defaultPageSize:Je,endCursor:y,prevCursor:k,pageSize:i,labelRowsPerPage:"Entities per page:"}))},Wa=({facets:e,ownerEntityRef:a,kind:n,type:r,setError:l})=>{const i=W(()=>{const o=new Map;return e.types.forEach(({kind:d,type:s})=>{const c=`${d}|${s!=null?s:""}`;o.set(c,t.createElement(Da,{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:""}`))},Ga=E(()=>({scrollContainer:{overflow:"auto"}})),Ma=({facets:e,ownerEntityRef:a,hasError:n,kind:r,type:l,setError:i,useVirtualizedResultsTable:o,isFixedGroup:d})=>{var s,c,p;const h=Ga();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(u=>u.count>0)?t.createElement("div",{className:h.scrollContainer},o?t.createElement(Wa,{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=E(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)}})),qe=3,Ha=({groupSelectorError:e,searchParams:a,setSearchParams:n,isFixedGroup:r=!1})=>{var l;const{group:i,kind:o,type:d}=a,s=T(st),[c,p]=$(void 0),[h,m]=$(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:u,isLoading:g}=Lt(i),{data:y}=Ce({orderAlphabetical:"default",searchByOwner:i,searchByStatus:"active"}),k=y==null?void 0:y.edges.map(C=>C.node),v=k==null?void 0:k.slice(0,qe),b=(l=w(le).getOptionalBoolean("soundcheck.virtualizeOverviewPage"))!=null?l:!0,R=h||e,P=A((C,D)=>{C&&(p({kind:C,type:D}),D?n({...a,kind:C,type:D}):(a!=null&&a.hasOwnProperty("type")&&delete a.type,n({...a,kind:C})))},[a,n]),x=ja();return t.createElement(N,{container:!0,spacing:0},k&&k.length>0&&t.createElement(N,{item:!0,xs:12,className:x.campaignsGrid},t.createElement(ft,null,t.createElement(ht,{expandIcon:t.createElement(Nt,null)},t.createElement(f,{variant:"h6"},"Campaigns")),t.createElement(yt,null,t.createElement("div",{className:x.campaignsCard},v==null?void 0:v.map(C=>t.createElement("div",{key:C.id},t.createElement(Xt,{campaign:C})))),k.length>qe&&t.createElement(j,{to:s(),className:x.campaignsLink},"More Campaigns")))),t.createElement(N,{item:!0,xs:12},g?t.createElement(ta,null):t.createElement(Zt,{unfilteredFacets:u,kind:c==null?void 0:c.kind,type:c==null?void 0:c.type,onChange:P})),t.createElement(N,{item:!0,xs:12,className:x.tableContainer},g?t.createElement("div",{className:x.tableLoading},t.createElement(Pe,{size:80})):t.createElement(Ma,{facets:u,kind:c==null?void 0:c.kind,type:c==null?void 0:c.type,setError:m,hasError:R,ownerEntityRef:i,useVirtualizedResultsTable:b,isFixedGroup:r})))};export{z as C,Se as F,Bt as G,Pe as L,Ha as O,na as P,q as R,Te as S,zt as U,Ce as a,Ot as b,xe as c,H as d,Oe as e,ze as f,S as g,_e as h,Ke as i,Ae as j,Be as k,ae as l,Qe as m,Y as n,te as o,Z as p,$e as q,Mt as r,be as s,je as t,Ft as u,we as v,Me as w};
|
|
2
|
-
//# sourceMappingURL=OverviewPageContent-d5467d2c.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Page as h,Header as P}from"@backstage/core-components";import{makeStyles as S}from"@material-ui/core";import{SpotifyLicenseBanner as p}from"@spotify/backstage-plugin-core";import e,{useState as s}from"react";import k from"react-use/lib/useLocalStorage";import{u as w,U as y,G as C,O as c}from"./OverviewPageContent-d5467d2c.esm.js";import{stringifyEntityRef as L}from"@backstage/catalog-model";import"@backstage/core-plugin-api";import"@tanstack/react-query";import"./routes-93cd1496.esm.js";import{useEntity as G}from"@backstage/plugin-catalog-react";import{S as l,B as O}from"./EmptyState-6a402254.esm.js";import{Routes as R,Route as b}from"react-router-dom";import{s as u,i as d}from"./license-e9e73904.esm.js";import"react-use/lib/useAsync";import"@material-ui/lab/Autocomplete";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-b4961e02.esm.js";import"react-use/lib/useDebounce";import"react-use/lib/useUnmount";import"lodash";import"@material-ui/lab";import"react-window";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"classnames";import"../images/empty-state.svg";const x=S(r=>({overviewContainer:{padding:r.spacing(1,3)}})),B=r=>{const{title:o="Soundcheck"}=r,i=x(),[t,a]=w(),{group:v}=t,[E,g]=s(void 0),[n,f]=k("soundcheck.overview.groupRef",null);return e.createElement(l,null,e.createElement(y,null,e.createElement(O,null,e.createElement(h,{themeId:"website"},e.createElement(p,{backend:u,invalidLicenseMessage:d}),e.createElement(P,{title:o},e.createElement(C,{onChange:m=>{m&&(a({...t,group:m}),f(m))},initialValue:n!=null?n:v,setError:g})),e.createElement("div",{className:i.overviewContainer},e.createElement(c,{groupSelectorError:E,searchParams:t,setSearchParams:a}))))))},F=()=>{const{entity:r}=G(),o={group:L(r)},[i,t]=s(o);return e.createElement(l,null,e.createElement(R,null,e.createElement(b,{path:"/*",element:e.createElement(e.Fragment,null,e.createElement(p,{backend:u,invalidLicenseMessage:d,inline:!0}),e.createElement(c,{searchParams:i,setSearchParams:t,isFixedGroup:!0}))})))};export{F as FixedGroupOverviewPage,B as OverviewPage};
|
|
2
|
-
//# sourceMappingURL=index-5610fc82.esm.js.map
|