@spotify/backstage-plugin-soundcheck 0.4.1 → 0.5.0
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 +25 -0
- package/config.d.ts +4 -0
- package/dist/esm/CheckFormContext-6f85a3bf.esm.js +2 -0
- package/dist/esm/EntitySoundcheckContent-8fdad07c.esm.js +2 -0
- package/dist/esm/{RefetchingIndicator-96188300.esm.js → RefetchingIndicator-0caa936c.esm.js} +2 -2
- package/dist/esm/index-0a05659f.esm.js +2 -0
- package/dist/esm/index-40aa00c1.esm.js +284 -0
- package/dist/esm/index-92271e48.esm.js +2 -0
- package/dist/esm/{index-9d77be51.esm.js → index-b3600988.esm.js} +2 -2
- package/dist/index.d.ts +10 -3
- package/dist/index.esm.js +1 -1
- package/package.json +25 -21
- package/dist/esm/EntitySoundcheckContent-d0819302.esm.js +0 -2
- package/dist/esm/index-5d64d93c.esm.js +0 -157
- package/dist/esm/index-808077a4.esm.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @spotify/backstage-plugin-soundcheck
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added support for displaying tabs for entities without types (like entities with kind System or Domain) on Soundcheck Overview page.
|
|
8
|
+
Such entities will be grouped by their kind and displayed on the tabs with corresponding names (in case if at least one track is applicable to such entities).
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Upgraded to Backstage `v1.15.0`
|
|
13
|
+
- Updated dependency `graphql-request` to `6.1.0`.
|
|
14
|
+
- Updated dependency `@types/node` to `^18.0.0`.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @spotify/backstage-plugin-core@0.5.3
|
|
18
|
+
|
|
19
|
+
## 0.4.2
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Upgraded to Backstage `v1.14.0`
|
|
24
|
+
- Implemented numerous enhancements to ensure compliance with accessibility standards.
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
- @spotify/backstage-plugin-core@0.5.2
|
|
27
|
+
|
|
3
28
|
## 0.4.1
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/config.d.ts
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import n,{createContext as c,useState as e,useContext as i}from"react";const h=c({selectedProgram:null,setSelectedProgram:()=>{},isLoading:!1,setIsLoading:()=>{},showAddModal:!1,setShowAddModal:()=>{}}),m=({children:o})=>{const[d,t]=e(null),[s,r]=e(!1),[a,l]=e(!1);return n.createElement(h.Provider,{value:{selectedProgram:d,setSelectedProgram:t,isLoading:s,setIsLoading:r,showAddModal:a,setShowAddModal:l}},o)},u=()=>i(h),g=c({selectedCheck:null,setSelectedCheck:()=>{},isLoading:!1,setIsLoading:()=>{},showAddModal:!1,setShowAddModal:()=>{}}),C=({children:o})=>{const[d,t]=e(null),[s,r]=e(!1),[a,l]=e(!1);return n.createElement(g.Provider,{value:{selectedCheck:d,setSelectedCheck:t,isLoading:s,setIsLoading:r,showAddModal:a,setShowAddModal:l}},o)},P=()=>i(g);export{C,m as P,u as a,P as u};
|
|
2
|
+
//# sourceMappingURL=CheckFormContext-6f85a3bf.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{useState as W,useEffect as M}from"react";import{Link as O,useParams as Q,Routes as j,Route as k,Navigate as I}from"react-router-dom";import{makeStyles as p,Typography as f,Box as U,Tab as L,Tabs as T,Paper as V,Divider as Y}from"@material-ui/core";import{SpotifyLicenseBanner as q}from"@spotify/backstage-plugin-core";import{useEntity as u}from"@backstage/plugin-catalog-react";import{R as G}from"./RefetchingIndicator-0caa936c.esm.js";import{s as H,R as c,A as y,F as x,a as J,u as B,L as K,N as X,b,c as g,d as Z,C as _,e as F,S as ee}from"./index-40aa00c1.esm.js";import{Skeleton as s}from"@material-ui/lab";import{MarkdownContent as P}from"@backstage/core-components";import{stringifyEntityRef as te}from"@backstage/catalog-model";import{useApi as ae,useRouteRef as C,useRouteRefParams as ne}from"@backstage/core-plugin-api";import{useQuery as re}from"@tanstack/react-query";import ie from"react-use/lib/useMeasure";import $ from"react-use/lib/usePrevious";import le from"react-confetti";import"react-use/lib/useDebounce";import"graphql-request";import"graphql-tag";import"lodash";import"@material-ui/core/styles/makeStyles";import"classnames";import"@material-ui/icons/Schedule";import"luxon";import"@material-ui/icons/Check";import"@material-ui/icons/Close";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/HelpOutline";function oe(t,n,a){const r=ae(H),i=te(t);return re(["soundcheck/check-details",i,n,a],async()=>r.getCheckResultDetails(i,n,a),{enabled:!!n&&!!a})}const ce=p({markdownContent:{"& :last-child":{marginBottom:0}}}),se=({state:t,notes:n})=>{const a=ce(),r={[c.Passed]:"success",[c.Failed]:"error",[c.NotReported]:"info",[c.NotApplicable]:"info"}[t],i={[c.Passed]:"Check passed",[c.Failed]:"Check did not pass",[c.NotReported]:"Check not reported",[c.NotApplicable]:"Check not applicable"}[t];return e.createElement(y,{severity:r,title:i},n?e.createElement(P,{className:a.markdownContent,content:n}):null)},me=()=>{const t=A();return e.createElement(x,null,e.createElement("div",{className:t.root,"data-testid":"check-details-view"},e.createElement("div",{className:t.topBar},e.createElement(f,{variant:"h2",className:t.title},e.createElement(s,{width:300,height:32})),e.createElement(s,{width:100,height:32})),e.createElement(s,{variant:"rect",height:120}),e.createElement("div",{"data-testid":"soundcheck-check-details-description"},e.createElement(f,{variant:"h3"},e.createElement(s,null)),e.createElement(s,null),e.createElement(s,null),e.createElement(s,null))))},A=p(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)}})),de=({programId:t,checkId:n})=>{const a=A(),{entity:r}=u(),{data:i,isLoading:l,isError:o}=oe(r,t,n);if(o)return e.createElement(U,{padding:2},e.createElement(y,{severity:"error",title:"Error loading check details"}));if(l||!t||!n)return e.createElement(me,null);if(!i)return null;const{name:h,description:d,result:v,timestamp:m,notes:E}=i;return e.createElement("div",{className:a.root,"data-testid":"check-details-view"},e.createElement("div",{className:a.topBar},e.createElement(f,{variant:"h2",className:a.title},h),m?e.createElement(J,{timestamp:m,description:"Last updated"}):null),e.createElement(se,{state:v,notes:E}),e.createElement("div",{className:a.description,"data-testid":"soundcheck-check-details-description"},e.createElement(f,{variant:"h3",className:a.subtitle},"Description"),e.createElement(P,{content:d})))},pe=p(()=>({root:{position:"absolute",width:"100%",height:"100%"}})),ue=({programId:t})=>{var n,a;const r=pe(),{entity:i}=u(),{data:l,isLoading:o}=B(i,t),[h,{width:d,height:v}]=ie(),m=o?void 0:(a=(n=l==null?void 0:l.highestLevel)==null?void 0:n.ordinal)!=null?a:-1,E=$(m),R=$(t),[z,S]=W(!1);return M(()=>{typeof E!="undefined"&&typeof m!="undefined"&&t===R&&m>E&&S(!0)},[m,E,t,R]),z?e.createElement("div",{ref:h,className:r.root},e.createElement(le,{width:d,height:v,numberOfPieces:1e3,gravity:1,initialVelocityY:20,recycle:!1,onConfettiComplete:()=>S(!1)})):null},D=p(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)}})),he=({id:t,name:n,badge:a,href:r,selected:i=!1})=>{const l=D();return e.createElement(L,{className:l.root,classes:{wrapper:l.wrapper},value:t,label:e.createElement(e.Fragment,null,a?e.createElement(K,{badge:a,className:l.badge}):e.createElement(X,{className:l.badge}),n),component:O,to:r,selected:i})},w=()=>{const t=D();return e.createElement(L,{className:t.root,classes:{wrapper:t.wrapper},label:e.createElement(s,{width:180})})},Ee=()=>e.createElement(x,null,e.createElement(T,{value:!1,indicatorColor:"primary"},e.createElement(w,null),e.createElement(w,null),e.createElement(w,null)));function fe(t=[],n){const a=t.findIndex(r=>r.program.id===n);return a<0?!1:a}const ge=({trackId:t})=>{const{entity:n}=u(),{isLoading:a,data:r}=b(n),i=C(g);if(a||!t)return e.createElement(Ee,null);const l=fe(r,t);return e.createElement(T,{value:l,indicatorColor:"primary","aria-label":"Certifications",variant:"scrollable"},r&&r.map(({program:{id:o,name:h},highestLevel:d})=>e.createElement(he,{key:o,id:o,name:h,badge:d==null?void 0:d.badge,selected:o===t,href:i({trackId:o})})))},ve=p({paper:{overflow:"hidden",position:"relative"},view:{display:"grid",gridTemplateColumns:"1fr 2fr"}}),ke=()=>{const{trackId:t,checkId:n}=Q(),a=ve(),{entity:r}=u(),{isError:i,isFetched:l,data:o}=b(r);return i?e.createElement(y,{severity:"error",title:"Error loading certifications"}):l&&!(o!=null&&o.length)?e.createElement(Z,null):e.createElement(V,{className:a.paper},e.createElement(G,null),e.createElement(ge,{trackId:t}),e.createElement(Y,null),e.createElement("div",{"data-testid":"soundcheck-certification-view",className:a.view},e.createElement(_,{trackId:t,checkId:n}),e.createElement(de,{programId:t,checkId:n}),e.createElement(ue,{programId:t})))},ye=p(t=>({root:{"&:not(:first-child)":{marginTop:t.spacing(2)}}})),N=()=>{const t=ye();return e.createElement(e.Fragment,null,e.createElement(q,{backend:"soundcheck",invalidLicenseMessage:"Submitted check results will still be stored, but it will not be possible to view certifications or individual results until a valid license is present.",inline:!0}),e.createElement("div",{className:t.root},e.createElement(ke,null)))},be=()=>{var t;const{entity:n}=u(),a=C(g),{data:r}=b(n),i=(t=r==null?void 0:r[0])==null?void 0:t.program.id;return i?e.createElement(I,{to:a({trackId:i}),replace:!0}):null},Ce=()=>{var t,n;const{entity:a}=u(),{trackId:r}=ne(g),i=C(F),{data:l}=B(a,r),o=(n=(t=l==null?void 0:l.levels[0])==null?void 0:t.checks[0])==null?void 0:n.id;return o?e.createElement(I,{to:i({trackId:r,checkId:o}),replace:!0}):null},we=()=>e.createElement(j,null,e.createElement(k,{path:"/",element:e.createElement(e.Fragment,null,e.createElement(N,null),e.createElement(be,null))}),e.createElement(k,{path:g.path,element:e.createElement(e.Fragment,null,e.createElement(N,null),e.createElement(Ce,null))}),e.createElement(k,{path:F.path,element:e.createElement(N,null)})),Ne=()=>e.createElement(ee,null,e.createElement(we,null));export{Ne as EntitySoundcheckContent};
|
|
2
|
+
//# sourceMappingURL=EntitySoundcheckContent-8fdad07c.esm.js.map
|
package/dist/esm/{RefetchingIndicator-96188300.esm.js → RefetchingIndicator-0caa936c.esm.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{useState as n}from"react";import{makeStyles as a,LinearProgress as m}from"@material-ui/core";import s from"react-use/lib/useDebounce";import"@backstage/catalog-model";import"@backstage/core-plugin-api";import{useIsFetching as c}from"@tanstack/react-query";import{F as d}from"./index-
|
|
2
|
-
//# sourceMappingURL=RefetchingIndicator-
|
|
1
|
+
import e,{useState as n}from"react";import{makeStyles as a,LinearProgress as m}from"@material-ui/core";import s from"react-use/lib/useDebounce";import"@backstage/catalog-model";import"@backstage/core-plugin-api";import{useIsFetching as c}from"@tanstack/react-query";import{F as d}from"./index-40aa00c1.esm.js";import"@backstage/plugin-catalog-react";import"react-router-dom";const p=a(t=>({indicator:{position:"absolute",width:"100%",zIndex:t.zIndex.speedDial}})),l=()=>{const t=c(),i=p(),[r,o]=n(!!t);return s(()=>{o(!!t)},250,[t]),r?e.createElement(d,null,e.createElement("div",{className:i.indicator},e.createElement(m,{variant:"indeterminate","data-testid":"refetching-indicator"}))):null};export{l as R};
|
|
2
|
+
//# sourceMappingURL=RefetchingIndicator-0caa936c.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t,{useState as k,useEffect as A,useCallback as B,useMemo as me,useReducer as Ce}from"react";import{Link as Ze,useSearchParams as ye,Routes as Je,Route as et}from"react-router-dom";import{MarkdownContent as tt,Link as at,ContentHeader as rt,Page as nt,Header as lt,TabbedLayout as J}from"@backstage/core-components";import{SpotifyLicenseBanner as ot}from"@spotify/backstage-plugin-core";import{Box as L,Paper as it,Grid as m,Button as w,Slide as st,Dialog as ct,AppBar as mt,Toolbar as dt,Typography as C,IconButton as j,TextField as R,Collapse as pt,makeStyles as y,ButtonGroup as ke,Menu as be,MenuItem as M,FormControl as ut,InputLabel as gt,Select as ht,Card as de,ListItemIcon as P,ListItemText as I,withStyles as pe,CardContent as Ne,CardHeader as Et,Divider as vt,CardActions as ft,List as xe,ListItem as Q,Tooltip as U,InputAdornment as Se,NativeSelect as Le,Chip as we,CircularProgress as Ct}from"@material-ui/core";import{makeStyles as F,createStyles as ue}from"@material-ui/core/styles";import{u as O,C as yt,a as G,P as kt}from"./CheckFormContext-6f85a3bf.esm.js";import De from"@material-ui/icons/Close";import{Controller as ge,useForm as bt}from"react-hook-form";import Nt from"@material-ui/icons/AddCircleOutline";import xt from"@material-ui/icons/ArrowDropDown";import Pe from"@material-ui/icons/Delete";import"@backstage/catalog-model";import{useApi as z}from"@backstage/core-plugin-api";import{useQuery as Ie,useQueryClient as ee,useMutation as te}from"@tanstack/react-query";import{s as q,Q as W,j as ae,M as re,w as ne,S as St,P as Lt,i as wt}from"./index-40aa00c1.esm.js";import{EntityRefLink as Te}from"@backstage/plugin-catalog-react";import Dt from"@material-ui/icons/MoreVert";import Pt from"@material-ui/icons/ControlPointDuplicate";import It from"@material-ui/icons/Edit";import Ae from"@material-ui/icons/Visibility";import $e from"@material-ui/icons/Group";import{Skeleton as Ve}from"@material-ui/lab";import Tt from"@material-ui/icons/Search";import{useDrag as At,useDrop as $t,DndProvider as Vt}from"react-dnd";import{HTML5Backend as Bt}from"react-dnd-html5-backend";import Rt from"@material-ui/icons/OpenInNew";import Mt from"@material-ui/icons/DoneAllRounded";import Ft from"@material-ui/icons/Menu";import Be from"@material-ui/icons/Add";import Re from"@material-ui/icons/DragIndicator";import Ot from"@material-ui/icons/Remove";import{v4 as Gt}from"uuid";import"graphql-request";import"graphql-tag";import"lodash";import"@material-ui/core/styles/makeStyles";import"classnames";import"@material-ui/icons/Schedule";import"luxon";import"@material-ui/icons/Check";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/HelpOutline";function zt(e,a,r){const l=z(q);return Ie([W.GetAllPrograms,e,a,r],async()=>l.getAllPrograms(e,a,r))}const qt="Error Creating Track";function Wt(){const e=z(q),a=ee(),{showAlert:r}=ae(),l=async n=>{const o=await e.createProgram(n);if(!o)throw new Error("Failed to create track.");return o};return te([re.CreateProgram],l,{onSuccess:async()=>{await a.invalidateQueries({queryKey:[W.GetAllPrograms]})},onError:n=>{let o="Failed to create track.";n instanceof Error&&(o=n.message),r({severity:"error",title:qt,message:o})}})}function Me(e,a,r){const l=z(q);return Ie([W.GetCheckers,e,a,r],async()=>l.getCheckers(e,a,r))}const Ht=e=>{const[a,r]=k(void 0),[l,n]=k([[]]),[o,i]=k([!1]);A(()=>{a===void 0&&e!=null&&e.length&&r(e)},[e,a]);const s=B((p,u)=>{n(h=>{const v=[...h];return v[u]=[...v[u],p],v}),r(h=>h==null?void 0:h.filter(v=>v.id!==p.id)),i(h=>{if(h[u]){const v=[...h];return v[u]=!1,v}return h})},[]),d=B((p,u)=>{n(h=>{const v=[...h];return v[u]=v[u].filter(b=>b.id!==p.id),v}),r(h=>[...h!=null?h:[],p])},[]),c=B(()=>{n(p=>[...p,[]]),i(p=>[...p,!1])},[]),g=B(p=>{l.length>1&&n(u=>{const h=[...u],v=h.splice(p,1)[0];return r(b=>[...b!=null?b:[],...v]),h})},[l]),E=B(()=>{const p=l.map(u=>u.length===0);return i(p),!p.some(u=>u)},[l]);return{chips:a,inputChipsList:l,handleDrop:s,handleDelete:d,addInput:c,removeInput:g,inputErrors:o,setInputErrors:i,areInputsValid:E,setInputChipsList:n}},_t=F(e=>({footer:{padding:e.spacing(2)}})),Fe=({onCancel:e,saveButtonText:a,onSave:r,isLoading:l})=>{const n=_t();return t.createElement(L,{position:"fixed",bottom:"0",width:"100%"},t.createElement(it,{elevation:3,className:n.footer},t.createElement(m,{container:!0,item:!0,spacing:2,justifyContent:"space-between"},t.createElement(m,{item:!0},t.createElement(w,{variant:"contained",color:"primary",onClick:e},"Cancel")),t.createElement(m,{item:!0},t.createElement(w,{variant:"contained",color:"primary",disabled:l,onClick:()=>r()},a)))))},jt=F(e=>({appBar:{position:"relative"},title:{flex:1,fontSize:e.typography.h6.fontSize},closeIcon:{marginRight:e.spacing(2)},content:{flex:"1 0 auto",padding:e.spacing(2),overflowX:"hidden",backgroundColor:e.palette.type==="dark"?"#333":e.palette.common.white}})),Qt=t.forwardRef(function(e,a){return t.createElement(st,{direction:"up",ref:a,...e})}),Oe=({open:e,handleClose:a,title:r,children:l})=>{const n=jt();return t.createElement(ct,{fullScreen:!0,open:e,onClose:a,TransitionComponent:Qt},t.createElement(mt,{className:n.appBar},t.createElement(dt,null,t.createElement(C,{className:n.title},r),t.createElement(j,{edge:"end",color:"inherit",onClick:a,"aria-label":"close",className:n.closeIcon},t.createElement(De,null)))),t.createElement(L,{className:n.content},l))},le=({name:e,control:a,error:r,label:l,placeholder:n,disabled:o,rules:i,messages:s,helperText:d,multiline:c,minRows:g})=>t.createElement(ge,{name:e,control:a,defaultValue:"",rules:i,render:({field:E})=>t.createElement(R,{...E,fullWidth:!0,multiline:c,minRows:g,placeholder:n,label:l,disabled:o,variant:"outlined",margin:"normal",error:!!r,helperText:r?s[r.type]:d})}),Ut=F(e=>({section:{gap:0},sectionLabel:{fontWeight:700,color:e.palette.primary.main}})),Kt=({control:e,error:a,isLoading:r})=>{const l=Ut();return t.createElement("div",{className:l.section},t.createElement(C,{className:l.sectionLabel},"Check Details"),t.createElement(le,{name:"checkName",control:e,error:a,label:"Check Name",placeholder:"Choose a name",disabled:r,rules:{required:!0,maxLength:100},messages:{required:"This field is required",maxLength:"Input must be less than 100 characters"}}))},Xt=F(e=>({root:{display:"flex",flexDirection:"column",gap:0},button:{marginLeft:-e.spacing(1)},title:{fontWeight:700,color:e.palette.primary.main}})),Yt=({title:e,children:a})=>{const[r,l]=k(!1),n=Xt(),o=()=>{l(!r)};return t.createElement("div",{className:n.root},t.createElement(m,{container:!0,alignItems:"center",spacing:0},t.createElement(m,{item:!0},t.createElement(j,{onClick:o,className:n.button},t.createElement(Nt,null))),t.createElement(m,{item:!0},t.createElement(C,{className:n.title},e))),t.createElement(pt,{in:r},a))},Zt=({control:e,passError:a,failError:r,isLoading:l})=>t.createElement(Yt,{title:"Pass and fail messages (optional)"},t.createElement(le,{name:"passMessage",control:e,error:a,label:"Pass Message",placeholder:"Enter pass message...",disabled:l,rules:{},messages:{}}),t.createElement(le,{name:"failMessage",control:e,error:r,label:"Fail Message",placeholder:"Enter fail message...",disabled:l,rules:{},messages:{}})),Jt=({control:e,error:a,isLoading:r})=>t.createElement(le,{name:"description",control:e,error:a,label:"Check Description",disabled:r,multiline:!0,minRows:4,placeholder:"Enter a brief description about the check",helperText:"Enter a brief description about the check",rules:{required:!0,maxLength:500},messages:{required:"This field is required",maxLength:"Description must be less than 500 characters"}}),ea=y(e=>({button:{backgroundColor:e.palette.background.default,color:e.palette.primary.main},label:{paddingRight:e.spacing(2)},icon:{borderLeft:`1px solid ${e.palette.primary.main}`,padding:e.spacing(1,0,0,1)},menu:{marginTop:"52px"}})),ta=({onAddCondition:e,onAddExpression:a})=>{const r=ea(),[l,n]=k(null),o=!!l,i=d=>{n(d.currentTarget)},s=()=>{n(null)};return t.createElement(L,null,t.createElement(ke,{color:"primary"},t.createElement(w,{id:"add-button",className:r.button,"aria-controls":o?"add-menu":void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:i},t.createElement(L,{className:r.label},"Add"),t.createElement(L,{className:r.icon},t.createElement(xt,null)))),t.createElement(be,{id:"add-menu",anchorEl:l,open:o,onClose:s,classes:{paper:r.menu},MenuListProps:{"aria-labelledby":"add-button"}},t.createElement(M,{onClick:()=>{e(),s()}},"Add Condition"),t.createElement(M,{onClick:()=>{a(),s()}},"Add Expression")))},he=({name:e,control:a,selectLabel:r,options:l})=>t.createElement(ge,{name:e,control:a,render:({field:n})=>t.createElement(ut,{variant:"outlined",style:{minWidth:200}},t.createElement(gt,{id:`${e}-select-label`},r),t.createElement(ht,{...n,"data-testid":`${e}-select`,labelId:`${e}-select-label`,label:r},l.map(({value:o,label:i})=>t.createElement(M,{key:o,value:o},i))))});var Ge=(e=>(e.AllOf="ALL OF",e.AnyOf="ANY OF",e))(Ge||{}),ze=(e=>(e.Equal="equal",e.NotEqual="notEqual",e.Matches="matches",e.LessThan="lessThan",e.LessThanInclusive="lessThanInclusive",e.GreaterThan="greaterThan",e.GreaterThanInclusive="greaterThanInclusive",e.In="in",e.NotIn="notIn",e.Contains="contains",e.DoesNotContain="doesNotContain",e.SemverGt="semverGt",e.SemverGte="semverGte",e.SemverLt="semverLt",e.SemverLte="semverLte",e.SemverEq="semverEq",e.SemverNeq="semverNeq",e.SemverSatisfies="semverSatisfies",e.SemverGtr="semverGtr",e.SemverLtr="semverLtr",e))(ze||{});const aa={equal:"Equals",notEqual:"Does Not Equal",matches:"Matches",semverGt:"Version Greater Than",semverGte:"Version Greater Than or Equals",semverLt:"Version Less Than",semverLte:"Version Less Than or Equals",semverEq:"Version Equals",semverNeq:"Version Not Equals",semverSatisfies:"Version Satisfies Range",semverGtr:"Version Greater Than Range",semverLtr:"Version Less Than Range",lessThan:"Less Than",lessThanInclusive:"Less Than or Equals",greaterThan:"Greater Than",greaterThanInclusive:"Greater Than or Equals",in:"In Array",notIn:"Not in Array",contains:"Contains",doesNotContain:"Does Not Contain"},ra=y(e=>({container:{borderLeft:`1px solid ${e.palette.grey[500]}`,marginLeft:e.spacing(2),padding:e.spacing(2,0,2,0),display:"flex",flexDirection:"row",gap:0},connector:{borderBottom:`1px solid ${e.palette.grey[500]}`,padding:e.spacing(0),width:"15px",height:"45px"},innerContainer:{backgroundColor:e.palette.background.default,border:`1px solid ${e.palette.grey[500]}`,display:"flex",flexDirection:"column"},inputsContainer:{padding:e.spacing(2),display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:e.spacing(1)},header:{background:"linear-gradient(90deg, #007DFF 0%, #0057B2 100%)",width:"100%",height:"8px"},deleteIcon:{color:e.palette.type==="dark"?e.palette.background.default:e.palette.common.black}})),na=({control:e,name:a,handleDelete:r})=>{const l=ra(),n=Object.values(ze).map(o=>({value:o,label:aa[o]}));return t.createElement(L,{className:l.container},t.createElement(L,{className:l.connector}),t.createElement(L,{className:l.innerContainer},t.createElement(L,{className:l.header}),t.createElement(L,{className:l.inputsContainer},t.createElement(he,{name:`${a}.factRef`,control:e,selectLabel:"Fact",options:n}),t.createElement(he,{name:`${a}.path`,control:e,selectLabel:"Path",options:n}),t.createElement(he,{name:`${a}.operator`,control:e,selectLabel:"Operator",options:n}),t.createElement(ge,{name:`${a}.value`,control:e,defaultValue:"",render:({field:o})=>t.createElement(R,{...o,label:"Value",variant:"outlined"})}))),t.createElement(j,{onClick:r,"data-test-id":`${a}-delete-button`},t.createElement(Pe,{className:l.deleteIcon})))},la=({conditions:e,control:a,name:r,handleDelete:l})=>t.createElement(t.Fragment,null,e.map((n,o)=>t.createElement(m,{item:!0,key:o},t.createElement(na,{control:a,name:`${r}.conditions[${o}]`,"data-testid":`${r}-condition-input`,handleDelete:l})))),oa=({expression:e,control:a,name:r,depth:l,getValues:n,setValue:o,trigger:i})=>e?t.createElement(m,{item:!0},t.createElement(qe,{control:a,name:`${r}.expression`,depth:l+1,getValues:n,setValue:o,trigger:i})):null,ia=y(e=>({selectedButton:{backgroundColor:"rgba(46, 119, 208, 0.08)"},button:{fontWeight:700,backgroundColor:e.palette.background.default,color:e.palette.primary.main,"&:hover":{backgroundColor:"rgba(46, 119, 208, 0.2)"}}})),sa=({onSelect:e})=>{const[a,r]=k(null),l=ia(),n=o=>{r(o),e(o)};return t.createElement(ke,{color:"primary"},Object.values(Ge).map(o=>t.createElement(w,{key:o,className:a===o?`${l.selectedButton} ${l.button}`:`${l.button}`,onClick:()=>n(o)},o)))},ca=(e,a,r,l)=>({handleAddCondition:async()=>{const n=`${e}`,o=a(n),i=[...(o==null?void 0:o.conditions)||[],{factRef:"",path:"",operator:"",value:""}],s=`${e}.conditions`;r(s,i),await l(s)},handleAddExpression:async()=>{r(`${e}.expression`,{factRef:"",path:"",operator:"",value:"",conditions:[{factRef:"",path:"",operator:"",value:""}]}),await l(`${e}.expression`)}}),ma=F(e=>({root:{backgroundColor:e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100],border:`1px solid ${e.palette.grey[500]}`,padding:e.spacing(2)},inner:{marginLeft:e.spacing(2),borderLeft:`1px solid ${e.palette.grey[500]}`},connector:{borderBottom:`1px solid ${e.palette.grey[500]}`,padding:e.spacing(0),width:"15px",height:"20px"}})),qe=({control:e,name:a,depth:r,getValues:l,setValue:n,trigger:o})=>{const i=ma(),{handleAddCondition:s,handleAddExpression:d}=ca(a,l,n,o),c=`${a}`,g=l(c),E=(g==null?void 0:g.conditions)||[],p=g==null?void 0:g.expression;return t.createElement(L,{className:r>0?i.inner:i.root},r>0&&t.createElement(L,{className:i.connector}),t.createElement(m,{container:!0,spacing:0,direction:"column"},t.createElement(m,{item:!0},t.createElement(sa,{onSelect:()=>{}})),t.createElement(m,{item:!0,container:!0,spacing:0,direction:"column"},t.createElement(la,{handleDelete:()=>{},conditions:E,control:e,name:a}),t.createElement(oa,{expression:p,control:e,name:a,depth:r,getValues:l,setValue:n,trigger:o})),t.createElement(m,{item:!0},t.createElement(ta,{onAddCondition:s,onAddExpression:d}))))},da=()=>{const{control:e,handleSubmit:a,getValues:r,setValue:l,trigger:n,formState:{errors:o}}=bt({defaultValues:{checkName:"",description:"",expression:{factRef:"",path:"",operator:"",value:"",conditions:[{factRef:"",path:"",operator:"",value:"",conditions:[]}]}}}),{showModal:i}=ne();return{control:e,handleSubmit:a,getValues:r,setValue:l,trigger:n,errors:o,onSubmit:async s=>{await i({title:"Save Check",message:`Are you sure you want to save check: ${s.checkName}?`})}}},pa=F(e=>({root:{overflow:"hidden",display:"flex",marginBottom:"53px"},card:{padding:e.spacing(3),display:"flex",gap:e.spacing(2.5)},sectionLabel:{fontWeight:700,margin:e.spacing(2,0),color:e.palette.primary.main}})),We=({title:e,open:a,handleClose:r})=>{const l=pa(),{setSelectedCheck:n,isLoading:o}=O(),{control:i,handleSubmit:s,getValues:d,setValue:c,trigger:g,errors:E,onSubmit:p}=da();return t.createElement(Oe,{handleClose:r,title:e,open:a},t.createElement("form",{onSubmit:s(p)},t.createElement(m,{container:!0,spacing:2,className:l.root},t.createElement(m,{item:!0,xs:9},t.createElement(de,{className:l.card},t.createElement(C,{className:l.sectionLabel,style:{margin:0}},"Check Details"),t.createElement(Kt,{control:i,error:E.checkName,isLoading:o}),t.createElement(Jt,{control:i,error:E.description,isLoading:o}),t.createElement(C,{className:l.sectionLabel},"Rules"),t.createElement(qe,{control:i,getValues:d,setValue:c,trigger:g,name:"expression",depth:0}),t.createElement(Zt,{control:i,passError:E.passMessage,failError:E.failMessage,isLoading:o}))),t.createElement(m,{item:!0,xs:3},t.createElement(C,{variant:"body1"},"..."))),t.createElement(m,{container:!0,spacing:4,className:l.root},t.createElement(Fe,{onCancel:()=>{n(null),r()},saveButtonText:"Save new check",isLoading:o,onSave:s(p)}))))},ua=()=>{const{selectedCheck:e,setSelectedCheck:a}=O();return t.createElement(We,{handleClose:()=>a(null),title:"Edit a Check",open:!!e,onSave:async()=>{a(null)}})},ga=()=>{const{setShowAddModal:e,showAddModal:a}=O();return t.createElement(We,{handleClose:()=>e(!1),title:"Create a Check",open:a,onSave:async()=>{e(!1)}})},ha=({handleEdit:e,handleView:a,handleDuplicate:r,handleDelete:l})=>{const[n,o]=k(null),i=!!n,s=c=>{c.stopPropagation(),o(c.currentTarget)},d=c=>{c.stopPropagation(),o(null)};return t.createElement(t.Fragment,null,t.createElement(j,{"aria-label":"summary-card-actions",id:"summary-card-action-menu-button","aria-controls":i?"summary-card-action-menu":void 0,"aria-expanded":i?"true":void 0,"aria-haspopup":"true",onClick:s},t.createElement(Dt,null)),t.createElement(be,{id:"summary-card-action-menu",anchorEl:n,open:i,onClose:d,getContentAnchorEl:null,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},MenuListProps:{"aria-labelledby":"summary-card-action-menu-button"}},e?t.createElement(M,{"data-testid":"summary-card-action-edit",onClick:c=>{e(c),d(c)}},t.createElement(P,null,t.createElement(It,{fontSize:"small"})),t.createElement(I,null,"Edit")):t.createElement(M,{"data-testid":"summary-card-action-view",onClick:c=>{a(c),d(c)}},t.createElement(P,null,t.createElement(Ae,{fontSize:"small"})),t.createElement(I,null,"View")),t.createElement(M,{"data-testid":"summary-card-action-duplicate",onClick:c=>{r(c),d(c)}},t.createElement(P,null,t.createElement(Pt,{fontSize:"small"})),t.createElement(I,null,"Duplicate")),l&&t.createElement(M,{"data-testid":"summary-card-action-delete",onClick:c=>{l(c),d(c)}},t.createElement(P,null,t.createElement(Pe,{fontSize:"small"})),t.createElement(I,null,"Delete"))))},Ea=pe(e=>ue({root:{width:"100%",height:"100%",minHeight:"385px",display:"flex",flexDirection:"column",padding:e.spacing(2),position:"relative"}}))(de),va=pe(()=>ue({root:{display:"flex",flexDirection:"column",flex:1,gap:"3px"}}))(Ne);pe(()=>ue({root:{position:"absolute",display:"block",zIndex:10,top:2.5,left:2.5,right:2.5,bottom:2.5,"&:hover ~ div > .burst":{backgroundSize:"200%"}}}))(({classes:e,to:a,message:r,children:l,onClick:n})=>t.createElement(Ze,{className:e==null?void 0:e.root,to:a,onClick:n},t.createElement(C,{variant:"srOnly"},r),l));const fa=y(e=>({root:{position:"relative",height:"100%"},cardSection:{marginBottom:e.spacing(2)},summaryDescription:{maxHeight:"150px",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:6,WebkitBoxOrient:"vertical",wordBreak:"break-word"}})),He=({title:e,description:a,children:r,handleDuplicate:l,handleDelete:n,handleEdit:o,handleView:i})=>{const s=fa();return t.createElement(Ea,null,t.createElement(Et,{title:e,action:t.createElement(t.Fragment,null,t.createElement(ha,{handleDelete:n,handleEdit:o,handleDuplicate:l,handleView:i}))}),t.createElement(va,null,t.createElement("div",{className:s.cardSection},t.createElement("div",{className:s.summaryDescription},t.createElement(tt,{content:a!=null?a:""}))),r&&t.createElement("div",{className:s.cardSection},r)),t.createElement(vt,null),t.createElement(ft,null,t.createElement(w,{size:"small",color:"primary",role:"link",onClick:o||i},o?"Edit":"View")))},Ca="Error Deleting Check";function ya(){const e=z(q),a=ee(),{showAlert:r}=ae(),l=async n=>{const o=await e.deleteChecker(n);if(!o)throw new Error(`Failed to delete check ${n}`);return o};return te([re.DeleteChecker],l,{onSuccess:()=>{a.invalidateQueries({queryKey:[W.GetCheckers]})},onError:(n,o)=>{let i=`Failed to delete check ${o}`;n instanceof Error&&(i=n.message),r({severity:"error",title:Ca,message:i})}})}const ka=y(e=>({root:{position:"relative",height:"100%"},cardSection:{marginBottom:e.spacing(2)},listItem:{padding:0},listItemText:{margin:0}})),ba=({check:e})=>{var a;const r=ka();return t.createElement(xe,{dense:!0,disablePadding:!0,className:r.cardSection},t.createElement(C,{variant:"overline",color:"textSecondary"},"Check Details"),t.createElement(Q,{disableGutters:!0,className:r.listItem},t.createElement(U,{title:"Owner"},t.createElement(P,null,t.createElement($e,{color:"action",fontSize:"small"}))),t.createElement(I,{className:r.listItemText,primary:t.createElement(Te,{entityRef:(a=e.ownerEntityRef)!=null?a:"No Owner"})})))},Na=({checker:e})=>{const{showModal:a}=ne(),{mutate:r}=ya(),{setSelectedCheck:l}=O(),{id:n,name:o,description:i,isEditable:s}=e,d=B(async()=>{await a({title:"Delete Check",message:`Are you sure you want to delete the check '${o}'?`})&&r(n)},[a,o,r,n]);return t.createElement(He,{title:o!=null?o:n,description:i,children:e.ownerEntityRef&&t.createElement(ba,{check:e}),handleView:()=>{},handleEdit:s?()=>l(e):void 0,handleDuplicate:()=>{},handleDelete:s?d:void 0})},xa=()=>t.createElement(t.Fragment,null,Array.from({length:10},(e,a)=>t.createElement(m,{key:`loading-${a}`,xs:12,sm:12,md:6,lg:4,xl:3,item:!0,role:"listitem"},t.createElement(Ve,{variant:"rect",height:385})))),Sa=y(()=>({searchIcon:{opacity:".5"},clearButton:{height:"36px",width:"36px"}})),_e=({searchTerm:e,setSearchTerm:a,showClear:r=!0,placeholder:l="Search...",...n})=>{const o=Sa(),i=d=>{a(d.target.value)},s=()=>{a("")};return t.createElement(R,{...n,fullWidth:!0,placeholder:l,value:e,onChange:i,InputProps:{startAdornment:t.createElement(Se,{position:"start"},t.createElement(Tt,{className:o.searchIcon,"data-testid":"search-icon"})),endAdornment:r&&e?t.createElement(Se,{position:"end"},t.createElement(j,{edge:"end",onClick:s,className:o.clearButton},t.createElement(De,null))):null}})},La=y(()=>({searchbar:{maxWidth:"350px"},filters:{display:"flex",alignItems:"center"},dropdownFilters:{margin:"0 15px",display:"flex",alignItems:"center"},selectHolder:{marginLeft:"10px"}})),wa=({isLoading:e,searchTerm:a,setSearchTerm:r,filterAlpha:l,handleAlphabeticalFilterChange:n,filterOwner:o,handleOwnerFilterChange:i,owners:s})=>{const d=La();return t.createElement(m,{item:!0,xs:9,className:d.filters},t.createElement(_e,{searchTerm:a,disabled:e,setSearchTerm:r,placeholder:"Search available checks",variant:"outlined",size:"small",className:d.searchbar}),t.createElement("div",{className:d.dropdownFilters},t.createElement(C,null,"Sort by: "),t.createElement(Le,{className:d.selectHolder,value:l,onChange:n},t.createElement("option",{value:"default"},"Default"),t.createElement("option",{value:"ascending"},"Name A-Z"),t.createElement("option",{value:"descending"},"Name Z-A"))),t.createElement("div",{className:d.dropdownFilters},t.createElement(C,null,"Filter by owner: "),t.createElement(Le,{className:d.selectHolder,value:o,onChange:i},t.createElement("option",{key:"all",value:"all"},"All"),s==null?void 0:s.map((c,g)=>t.createElement("option",{key:c+g,value:c},c)))))},Da=y(e=>({headerButtons:{display:"flex",gap:e.spacing(1),flexWrap:"nowrap",justifyContent:"end"},header:{padding:"16px 0"}})),Pa=(e,a)=>e==null?void 0:e.sort((r,l)=>{var n,o;const i=(n=r==null?void 0:r.name)==null?void 0:n.toLowerCase(),s=(o=l==null?void 0:l.name)==null?void 0:o.toLowerCase();return!i||!s?0:i<s?a==="ascending"?-1:1:i>s?a==="ascending"?1:-1:0}),Ia=e=>{const a=e==null?void 0:e.map(r=>r==null?void 0:r.ownerEntityRef);return[...new Set(a)]},Ee=({searchTermProp:e,filterAlphaProp:a,filterOwnerProp:r,checks:l})=>{const n=l==null?void 0:l.filter(i=>{var s;return(s=i==null?void 0:i.name)==null?void 0:s.toLowerCase().includes(e.toLowerCase())}),o=r&&r!=="all"?n==null?void 0:n.filter(i=>{var s;return((s=i==null?void 0:i.ownerEntityRef)==null?void 0:s.toLowerCase())===r.toLowerCase()}):n;return a==="default"?o:Pa(o!=null?o:[],a)},Ta=({checksPerPage:e,currentCursor:a})=>{const r=Da(),[l,n]=k(a),{data:o,isLoading:i}=Me(void 0,e,l),[s,d]=k(o);A(()=>{o&&d(f=>{var x,T;const ie=(x=f==null?void 0:f.edges)!=null?x:[],se=o.edges,K=[...ie,...se],X=[],ce=K.reduce((Y,_)=>X.includes(_.checker.id)?Y:(X.push(_.checker.id),[...Y,_]),[]);return{endCursor:o.endCursor,totalCount:o.totalCount,hasNextPage:(T=o==null?void 0:o.hasNextPage)!=null?T:!1,edges:ce}})},[o]);const c=s==null?void 0:s.edges[(s==null?void 0:s.edges.length)-1],g=s==null?void 0:s.edges.map(f=>f.checker),{setShowAddModal:E}=O(),[p,u]=k(),[h,v]=k(""),[b,N]=k("default"),[S,D]=k("all"),[H,$]=k([]),V=f=>{const x=Ee({searchTermProp:h,filterAlphaProp:f.target.value,filterOwnerProp:S,checks:g!=null?g:[]});N(f.target.value),u(x)},oe=f=>{const x=Ee({searchTermProp:h,filterAlphaProp:b,filterOwnerProp:f.target.value,checks:g!=null?g:[]});D(f.target.value),u(x)};return A(()=>{const f=s==null?void 0:s.edges.map(T=>T.checker),x=Ia(f!=null?f:[]);u(f),$(x!=null?x:[])},[i,s]),A(()=>{const f=s==null?void 0:s.edges.map(T=>T.checker),x=Ee({searchTermProp:h,filterAlphaProp:b,filterOwnerProp:S,checks:f!=null?f:[]});u(x)},[h,b,S,s]),t.createElement(m,{container:!0,direction:"row"},t.createElement(m,{container:!0,spacing:4,className:r.header},t.createElement(wa,{isLoading:i,searchTerm:h,setSearchTerm:v,filterAlpha:b,handleAlphabeticalFilterChange:V,filterOwner:S,handleOwnerFilterChange:oe,owners:H}),t.createElement(m,{item:!0,xs:3},t.createElement("div",{className:r.headerButtons},t.createElement(w,{variant:"contained",color:"primary",onClick:()=>E(!0)},"Add New Check")))),t.createElement(m,{container:!0,spacing:4,role:"list","aria-label":"checks"},i?t.createElement(xa,null):p==null?void 0:p.map(f=>t.createElement(m,{key:f.id,xs:12,sm:12,md:6,lg:4,xl:3,item:!0,role:"listitem","aria-label":"result"},t.createElement(Na,{checker:f})))),(s==null?void 0:s.hasNextPage)&&t.createElement(w,{onClick:()=>n(c==null?void 0:c.cursor)},"Load More Checkers"))},Aa=y(e=>({checksPageContainer:{padding:e.spacing(3)}})),$a=()=>{const e=Aa(),[a]=ye(),r=a.get("checksPerPage"),l=r?parseInt(r,10):10,{selectedCheck:n,showAddModal:o}=O();return t.createElement("div",{className:e.checksPageContainer},t.createElement(Ta,{checksPerPage:l}),o&&t.createElement(ga,null),n&&t.createElement(ua,null))},Va=()=>t.createElement(yt,null,t.createElement($a,null)),Ba=y(e=>({root:{position:"relative",height:"100%"},cardSection:{marginBottom:e.spacing(2)},listItem:{padding:0},listItemText:{margin:0}})),Ra=({program:e})=>{var a,r,l;const n=Ba(),o=(r=(a=e.levels)==null?void 0:a.length)!=null?r:0,i=(l=e.levels)==null?void 0:l.reduce((s,d)=>s+d.checks.length,0);return t.createElement(xe,{dense:!0,disablePadding:!0,className:n.cardSection},t.createElement(C,{variant:"overline",color:"textSecondary"},"Track Details"),t.createElement(Q,{disableGutters:!0,className:n.listItem},t.createElement(U,{title:"Levels"},t.createElement(P,null,t.createElement(Ft,{color:"action",fontSize:"small"}))),t.createElement(I,{className:n.listItemText,primary:t.createElement(C,{variant:"body2",color:"textSecondary"},`${o} ${o===1?"Level":"Levels"}`)})),t.createElement(Q,{disableGutters:!0,className:n.listItem},t.createElement(U,{title:"Checks"},t.createElement(P,null,t.createElement(Mt,{color:"action",fontSize:"small"}))),t.createElement(I,{className:n.listItemText,primary:t.createElement(C,{variant:"body2",color:"textSecondary"},`${i} ${i===1?"Check":"Checks"}`)})),e.documentationURL&&t.createElement(Q,{disableGutters:!0,className:n.listItem},t.createElement(U,{title:"Documentation"},t.createElement(P,null,t.createElement(Rt,{color:"action",fontSize:"small"}))),t.createElement(I,{className:n.listItemText,primary:t.createElement(at,{to:e.documentationURL,target:"_blank",rel:"noopener noreferrer"},"Learn more")})),t.createElement(Q,{disableGutters:!0,className:n.listItem},t.createElement(U,{title:"Owner"},t.createElement(P,null,t.createElement($e,{color:"action",fontSize:"small"}))),t.createElement(I,{className:n.listItemText,primary:t.createElement(Te,{entityRef:e.ownerEntityRef})})))},Ma="Error Deleting Track";function Fa(){const e=z(q),a=ee(),{showAlert:r}=ae(),l=async n=>{const o=await e.deleteProgram(n);if(!o)throw new Error(`Failed to delete track ${n}`);return o};return te([re.DeleteProgram],l,{onSuccess:()=>{a.invalidateQueries({queryKey:[W.GetAllPrograms]})},onError:(n,o)=>{let i=`Failed to delete track ${o}`;n instanceof Error&&(i=n.message),r({severity:"error",title:Ma,message:i})}})}const Oa=({summary:e})=>{const{showModal:a}=ne(),{mutate:r}=Fa(),{setSelectedProgram:l}=G(),n=B(async()=>{await a({title:"Delete Track",message:`Are you sure you want to delete track ${e.name}?`})&&r(e.id)},[a,e.id,e.name,r]);return t.createElement(He,{title:e.name,description:e.description,children:t.createElement(Ra,{program:e}),handleView:()=>{},handleEdit:e.isEditable?()=>{l(e)}:void 0,handleDuplicate:()=>{},handleDelete:e.isEditable?n:void 0})},Ga=()=>t.createElement(t.Fragment,null,Array.from({length:6},(e,a)=>t.createElement(m,{key:`loading-${a}`,xs:12,sm:12,md:6,lg:4,xl:3,item:!0,role:"listitem"},t.createElement(Ve,{variant:"rect",height:385})))),za=y(e=>({headerButtons:{display:"flex",gap:e.spacing(1),flexWrap:"nowrap"}})),qa=({programsPerPage:e,currentCursor:a})=>{var r;const l=za(),{setShowAddModal:n}=G(),[o,i]=k(a),{data:s,isLoading:d}=zt(void 0,e,o),[c,g]=k(s);A(()=>{s&&g(u=>{var h,v;const b=(h=u==null?void 0:u.edges)!=null?h:[],N=s.edges,S=[...b,...N],D=[],H=S.reduce(($,V)=>D.includes(V.program.id)?$:(D.push(V.program.id),[...$,V]),[]);return{endCursor:s.endCursor,totalCount:s.totalCount,hasNextPage:(v=s==null?void 0:s.hasNextPage)!=null?v:!1,edges:H}})},[s]);const E=(r=c==null?void 0:c.edges)==null?void 0:r.map(u=>u==null?void 0:u.program),p=c==null?void 0:c.edges[(c==null?void 0:c.edges.length)-1];return t.createElement(m,{container:!0,direction:"row"},t.createElement(rt,{title:"Tracks"},t.createElement("div",{className:l.headerButtons},t.createElement(w,{variant:"contained",color:"primary",onClick:()=>n(!0)},"Create Track"))),t.createElement(m,{container:!0,spacing:4,role:"list","aria-label":"tracks"},d?t.createElement(Ga,null):E==null?void 0:E.map(u=>t.createElement(m,{key:u.id,xs:12,sm:12,md:6,lg:4,xl:3,item:!0,role:"listitem","aria-label":"result"},t.createElement(Oa,{summary:u})))),(c==null?void 0:c.hasNextPage)&&t.createElement(w,{onClick:()=>i(p==null?void 0:p.cursor)},"Load More Programs"))},Wa=y(e=>({titleInput:{marginBottom:e.spacing(1)},title:{fontWeight:700},container:{padding:"0 12px"}})),Ha=({programName:e,programNameError:a,handleProgramNameChange:r,disabled:l})=>{const n=Wa();return t.createElement(m,{className:n.container,item:!0,xs:12},t.createElement(C,{className:n.title,variant:"subtitle2"},"Track name"),t.createElement(C,{variant:"body2"},"Give your track a meaningful name so it\u2019s easy to remember it"),t.createElement(R,{fullWidth:!0,placeholder:"Untitled track",value:e,onChange:r,disabled:l,className:n.titleInput,variant:"outlined",size:"small",margin:"normal",error:a,helperText:a?"Track name must be at least 1 character and less than 100 characters":""}))},_a=y(e=>({button:{border:"none",fontWeight:700,fontSize:e.typography.subtitle2.fontSize,lineHeight:"19px",color:e.palette.primary.main,textTransform:"none"}})),ve=({label:e,...a})=>{const r=_a();return t.createElement(w,{className:r.button,...a},e)},je=y(e=>{const a=e.palette.type==="dark",r=a?e.palette.common.white:e.palette.common.black,l=a?e.palette.grey[700]:e.palette.common.white,n=a?e.palette.grey[500]:e.palette.grey[300],o=a?e.palette.common.white:e.palette.common.black;return{chip:{width:"100%",height:"36px",color:r,justifyContent:"space-between",background:l,border:`1px solid ${n}`,borderRadius:4,boxShadow:"0px 2px 5px rgba(0, 0, 0, 0.1)",cursor:"move","&:focus":{background:l,borderColor:o,"& $icon":{color:e.palette.primary.main}}},icon:{}}}),ja=({chip:e})=>{const[a,r]=At(()=>({type:"chip",item:{id:e.id,label:e.label},collect:n=>({isDragging:n.isDragging()})})),l=je();return t.createElement(we,{ref:r,label:e.label,className:l.chip,icon:t.createElement(Re,{"data-testid":"drag-indicator-icon"}),onDelete:()=>{},deleteIcon:t.createElement(Ae,{className:l.icon,"data-testid":"visibility-icon"})})},Qe=y(e=>({columnHeader:{display:"flex",justifyContent:"space-between",alignItems:"center"},subtitle:{fontSize:e.typography.h6.fontSize},chipContainer:{display:"flex",flexDirection:"column",alignItems:"flex-start",padding:e.spacing(1),gap:e.spacing(1)},loadingContainer:{marginTop:e.spacing(1),display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}})),Qa=()=>{const e=Qe();return t.createElement(m,{container:!0,className:e.loadingContainer},t.createElement(Ct,null))},Ua=({chips:e})=>t.createElement(t.Fragment,null,e.map(a=>t.createElement(ja,{key:a.id,chip:a}))),Ka=()=>t.createElement(C,{variant:"body1",color:"textSecondary"},"There are no matches."),Xa=({isLoading:e,chips:a=[]})=>{const r=Qe(),[l,n]=k(""),o=me(()=>a.filter(d=>d.label.toLowerCase().includes(l.toLowerCase())),[a,l]),i=a.length>0||l,s=()=>{if(e)return t.createElement(Qa,null);if(o.length>0)return t.createElement(Ua,{chips:o});if(i)return t.createElement(Ka,null)};return t.createElement(m,{container:!0},t.createElement(m,{item:!0,xs:12,className:r.columnHeader},t.createElement(C,{className:r.subtitle},"Checks"),t.createElement(ve,{label:"Add Check",startIcon:t.createElement(Be,null)})),t.createElement(m,{item:!0,xs:12},t.createElement(_e,{searchTerm:l,disabled:e,setSearchTerm:n,placeholder:"Search available checks",variant:"outlined",size:"small"})),t.createElement(m,{item:!0,className:r.chipContainer,xs:12},s()))},Ya=y(e=>({input:{border:`1px solid ${e.palette.grey[600]}`,borderRadius:4,padding:e.spacing(1),minHeight:80},hoverBackground:{background:e.palette.type==="dark"?e.palette.grey[600]:e.palette.grey[200]},normalBackground:{background:e.palette.type==="dark"?e.palette.grey[700]:e.palette.common.white},error:{border:"1px solid red"},chipContainer:{display:"flex",flexDirection:"column"}})),Za=({chips:e,onDelete:a,onDrop:r,error:l=!1,placeholder:n=""})=>{const o=Ya(),i=je(),[{isOver:s},d]=$t(()=>({accept:"chip",drop:c=>{r(c)},collect:c=>({isOver:c.isOver()})}));return t.createElement("div",{ref:d,className:`${o.input} ${l?o.error:""} ${s?o.hoverBackground:o.normalBackground}`,"data-testid":"droppable-input"},t.createElement("div",{className:o.chipContainer},e!=null&&e.length?e.map(c=>t.createElement(we,{key:c.id,label:c.label,className:i.chip,icon:t.createElement(Re,null),onDelete:()=>a(c)})):n))},Ja=y(e=>({inputBase:{fontSize:e.typography.subtitle1.fontSize,fontWeight:700}})),er=({levelName:e,handleLevelNameChange:a,disabled:r})=>{const l=Ja();return t.createElement(R,{fullWidth:!0,placeholder:"Untitled level",value:e,onChange:a,disabled:r,InputProps:{classes:{input:l.inputBase}}})},tr=y(e=>({inputBase:{fontSize:e.typography.subtitle1.fontSize},inputContainer:{margin:"16px 0 0"}})),ar=({levelDescription:e,levelNameLabel:a,handleLevelDescriptionChange:r,disabled:l})=>{const n=tr();return t.createElement(R,{fullWidth:!0,placeholder:"Enter description here",className:n.inputContainer,multiline:!0,value:e,variant:"outlined",label:`${a} Description`,onChange:r,disabled:l,InputProps:{classes:{input:n.inputBase}}})},rr=y(e=>({columnHeader:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(2)},subtitle:{fontSize:e.typography.h6.fontSize},levelHeader:{display:"flex",alignItems:"center"},removeButton:{minWidth:150}})),nr=({inputChipsList:e,handleDelete:a,handleDrop:r,addInput:l,removeInput:n,levelsErrors:o,levelNames:i,levelDescriptions:s,handleLevelNameChange:d,handleLevelDescriptionChange:c})=>{const g=rr();return t.createElement(m,{container:!0},t.createElement(m,{item:!0,xs:12,className:g.columnHeader},t.createElement(C,{className:g.subtitle},"Levels"),t.createElement(ve,{label:"Add Level",startIcon:t.createElement(Be,null),onClick:l})),e.map((E,p)=>t.createElement(m,{container:!0,item:!0,xs:12,key:p,spacing:1},t.createElement(m,{item:!0,xs:12,className:g.levelHeader},t.createElement(m,{container:!0,spacing:1},t.createElement(m,{item:!0,xs:!0},t.createElement(er,{levelName:i[p],handleLevelNameChange:u=>d(u.target.value,p),disabled:!1})),e.length>1&&t.createElement(m,{item:!0,className:g.removeButton},t.createElement(ve,{label:"Remove Level",startIcon:t.createElement(Ot,null),onClick:()=>n(p)})))),t.createElement(m,{item:!0,xs:12},t.createElement(Za,{chips:E,onDelete:u=>a(u,p),onDrop:u=>r(u,p),error:o[p],placeholder:"Drag and drop checks here to include them in this level"})),t.createElement(m,{item:!0,xs:12},t.createElement(ar,{levelDescription:s[p],levelNameLabel:i[p],handleLevelDescriptionChange:u=>c(u.target.value,p),disabled:!1})))))},lr=y(e=>({titleInput:{marginBottom:e.spacing(1)},inputBase:{fontSize:e.typography.fontSize},title:{fontWeight:700},container:{padding:"0 12px"}})),or=({programDescription:e,programDescriptionError:a,handleProgramDescriptionChange:r,disabled:l})=>{const n=lr();return t.createElement(m,{className:n.container,item:!0,xs:12},t.createElement(C,{className:n.title,variant:"subtitle2"},"Track description"),t.createElement(C,{variant:"body2"},"Give your track a meaningful description so others can understand how to use it"),t.createElement(R,{fullWidth:!0,placeholder:"Example: Make sure the project has a ReadMe file and is using the latest version of JavaScript",value:e,onChange:r,disabled:l,className:n.titleInput,variant:"outlined",size:"small",margin:"normal",multiline:!0,InputProps:{classes:{input:n.inputBase}},error:a,helperText:a?"Track description must be at least 1 character and less than 250 characters":""}))};var ir=(e=>(e.SetProgramNameError="VALIDATE_NAME",e.SetName="SET_NAME",e))(ir||{});const sr={programName:"",programNameError:!1},cr=(e,a)=>{switch(a.type){case"SET_NAME":return{...e,programName:a.value};case"VALIDATE_NAME":return{...e,programNameError:a.value};default:return e}},mr=(e="")=>{const[a,r]=Ce(cr,{...sr,programName:e}),l=()=>{const i=a.programName.trim().length,s=i>0&&i<=100;return r({type:"VALIDATE_NAME",value:!s}),s},n=i=>{r({type:"SET_NAME",value:i})},o=i=>{n(i.target.value),a.programNameError&&l()};return{programName:a.programName,programNameError:a.programNameError,handleProgramNameChange:o,setProgramName:n,isProgramNameValid:l}};var dr=(e=>(e.SetProgramDescriptionError="VALIDATE_DESCRIPTION",e.SetDescription="SET_DESCRIPTION",e))(dr||{});const pr={programDescription:"",programDescriptionError:!1},ur=(e,a)=>{switch(a.type){case"SET_DESCRIPTION":return{...e,programDescription:a.value};case"VALIDATE_DESCRIPTION":return{...e,programDescriptionError:a.value};default:return e}},gr=(e="")=>{const[a,r]=Ce(ur,{...pr,programDescription:e}),l=()=>{const i=a.programDescription.trim().length,s=i>0&&i<=250;return r({type:"VALIDATE_DESCRIPTION",value:!s}),s},n=i=>{r({type:"SET_DESCRIPTION",value:i})},o=i=>{n(i.target.value),a.programDescriptionError&&l()};return{programDescription:a.programDescription,programDescriptionError:a.programDescriptionError,handleProgramDescriptionChange:o,setProgramDescription:n,isProgramDescriptionValid:l}},hr=(e,a,r,l)=>{const n={};return l&&l.forEach(o=>{var i,s;o&&(n[o.id]={id:o.id,name:(i=o.name)!=null?i:"",description:(s=o.description)!=null?s:""})}),e.map((o,i)=>{const s=o.map(d=>n[d.id]);return{name:a[i],description:r[i],ordinal:i,checks:s}})},Er=e=>e.map(a=>a.checks.map(r=>({id:r.id,label:r.name}))),vr=e=>{var a;return{id:e.id,name:e.name,description:e.description||"",ownerEntityRef:e.ownerEntityRef,documentationURL:e.documentationURL||"",levels:((a=e.levels)==null?void 0:a.map(r=>({ordinal:r.ordinal,name:r.name||"",description:r.description||"",checks:r.checks.map(l=>({id:l.id,name:l.name,description:l.description}))})))||[]}},fr=(e,a)=>{const r=e?Er(e.levels):[[]],l=r.flat().map(o=>o.id),n=a.filter(o=>!l.includes(o.id));return{inputChips:r,used:n}},Cr=({programName:e,programDescription:a,areInputsValid:r,isProgramNameValid:l,isProgramDescriptionValid:n,inputChipsList:o,checkers:i,onSave:s,programId:d,levelNames:c,levelDescriptions:g})=>{const{showModal:E}=ne();return async()=>{if(!(l()&&n()&&r())||!await E({title:"Save Program",message:`Are you sure you want to save program: ${e}?`}))return;const p=d!=null?d:Gt(),u=hr(o,c,g,i);await s({description:a,id:p,levels:u,name:e,ownerEntityRef:"group:default/toast-infra"})}},yr=e=>{const a=me(()=>e?vr(e):null,[e]),[r,l]=k([]),{data:n,isLoading:o}=Me(),i=n==null?void 0:n.edges.map(N=>N.checker),s=me(()=>(i!=null?i:[]).filter(N=>!!N).map(N=>{var S,D;return{id:(S=N.id)!=null?S:"",label:(D=N.name)!=null?D:""}}),[i]),{chips:d,inputChipsList:c,handleDrop:g,handleDelete:E,addInput:p,removeInput:u,inputErrors:h,areInputsValid:v,setInputChipsList:b}=Ht(r);return A(()=>{if(!r.length&&s.length){const{inputChips:N,used:S}=fr(a,s);b(N),l(S)}},[s,b,r.length,a]),{checkers:i,checkersLoading:o,chips:d,inputChipsList:c,handleDrop:g,handleDelete:E,addInput:p,removeInput:u,inputErrors:h,areInputsValid:v}},kr=e=>{const[a,r]=k(e);return{levelNames:a,handleLevelNameChange:(l,n)=>{r(a.map((o,i)=>i===n?l:o))},addLevelName:l=>{r([...a,l])},removeLevelName:l=>{r(a.filter((n,o)=>o!==l))}}},br=e=>{const[a,r]=k(e);return{levelDescriptions:a,handleLevelDescriptionChange:(l,n)=>{r(a.map((o,i)=>i===n?l:o))},addLevelDescription:l=>{r([...a,l])},removeLevelDescription:l=>{r(a.filter((n,o)=>o!==l))}}},Nr=y(e=>({description:{fontSize:e.typography.subtitle1.fontSize},cardContent:{"& *":{fontWeight:700}}})),Ue=({onSave:e,title:a,open:r,handleClose:l})=>{const{selectedProgram:n,isLoading:o,setSelectedProgram:i}=G(),{checkers:s,checkersLoading:d,chips:c,inputChipsList:g,handleDrop:E,handleDelete:p,addInput:u,removeInput:h,inputErrors:v,areInputsValid:b}=yr(n),{programName:N,programNameError:S,handleProgramNameChange:D,isProgramNameValid:H}=mr(n==null?void 0:n.name),{programDescription:$,programDescriptionError:V,handleProgramDescriptionChange:oe,isProgramDescriptionValid:f}=gr(n==null?void 0:n.description),{levelNames:x,handleLevelNameChange:T,addLevelName:ie,removeLevelName:se}=kr(g.map((Z,Ye)=>`Level ${Ye+1}`)),{levelDescriptions:K,handleLevelDescriptionChange:X,addLevelDescription:ce,removeLevelDescription:Y}=br(g.map(()=>"")),_=()=>{u(),ie(`Level ${g.length+1}`),ce("")},Ke=Z=>{h(Z),se(Z),Y(Z)},Xe=Cr({programName:N,programDescription:$,areInputsValid:b,isProgramNameValid:H,isProgramDescriptionValid:f,inputChipsList:g,checkers:s,onSave:e,programId:n==null?void 0:n.id,levelNames:x,levelDescriptions:K}),fe=Nr();return t.createElement(Oe,{handleClose:l,title:a,open:r},t.createElement(m,{container:!0,spacing:3,style:{overflow:"hidden"}},t.createElement(m,{item:!0,xs:12},t.createElement(Ha,{disabled:o,programName:N,programNameError:S,handleProgramNameChange:D})),t.createElement(m,{item:!0,xs:12},t.createElement(or,{disabled:o,programDescription:$,programDescriptionError:V,handleProgramDescriptionChange:oe})),t.createElement(m,{item:!0,xs:12},t.createElement(de,null,t.createElement(Ne,{className:fe.cardContent},t.createElement(m,{container:!0,spacing:4},t.createElement(m,{item:!0,xs:12},t.createElement(C,{className:fe.description},"Add the checks that apply to each level. You can preview the checks to see the rules that apply to each check.")),t.createElement(m,{item:!0,xs:5},t.createElement(Xa,{chips:c,isLoading:d||o})),t.createElement(m,{item:!0,xs:7},t.createElement(nr,{inputChipsList:g,handleDelete:p,handleDrop:E,addInput:_,removeInput:Ke,levelsErrors:v,levelNames:x,handleLevelNameChange:T,levelDescriptions:K,handleLevelDescriptionChange:X})))))),t.createElement(Fe,{onCancel:()=>{i(null),l()},saveButtonText:"Save Track",isLoading:o||d,onSave:Xe})))},xr=()=>{const{setIsLoading:e,setShowAddModal:a,showAddModal:r}=G(),{mutateAsync:l,isLoading:n}=Wt();return A(()=>{e(n)},[e,n]),t.createElement(Ue,{handleClose:()=>a(!1),title:"Create Track",open:r,onSave:async o=>{const i=await l(o);i&&window.open(`/soundcheck/tracks/${i.id}`,"_self")}})},Sr="Error Updating Track";function Lr(){const e=z(q),a=ee(),{showAlert:r}=ae(),l=async n=>{const o=await e.updateProgram(n);if(!o)throw new Error("Failed to update track.");return o};return te([re.UpdateProgram],l,{onSuccess:()=>{a.invalidateQueries({queryKey:[W.GetAllPrograms]})},onError:n=>{let o="Failed to update track.";n instanceof Error&&(o=n.message),r({severity:"error",title:Sr,message:o})}})}const wr=()=>{const{setSelectedProgram:e,setIsLoading:a,selectedProgram:r}=G(),{mutateAsync:l,isLoading:n}=Lr();return A(()=>a(n),[a,n]),t.createElement(Ue,{handleClose:()=>e(null),title:"Edit Track",open:!!r,onSave:async o=>{await l(o)&&e(null)}})},Dr=y(e=>({programsPageContainer:{padding:e.spacing(3)},headerButtons:{display:"flex",gap:e.spacing(1),flexWrap:"nowrap"}})),Pr=()=>{const{selectedProgram:e,showAddModal:a}=G(),[r]=ye(),l=r.get("tracksPerPage"),n=l?parseInt(l,10):10,o=Dr();return t.createElement("div",{className:o.programsPageContainer},t.createElement(Vt,{backend:Bt},t.createElement(qa,{programsPerPage:n}),a&&t.createElement(xr,null),e&&t.createElement(wr,null)))},Ir=()=>t.createElement(kt,null,t.createElement(Pr,null)),Tr=()=>t.createElement(C,null,"Coming Soon..."),Ar=({title:e="Soundcheck"})=>t.createElement(St,null,t.createElement(Lt,null,t.createElement(nt,{themeId:"website"},t.createElement(ot,{backend:"soundcheck",invalidLicenseMessage:"Submitted facts and check results will still be stored, but it will not be possible to view certifications or individual results until a valid license is present."}),t.createElement(lt,{title:e}),t.createElement(wt,null,t.createElement(Je,null,t.createElement(et,{path:"/*",element:t.createElement(J,null,t.createElement(J.Route,{title:"Overview",path:"/"},t.createElement(Tr,null)),t.createElement(J.Route,{title:"Checks",path:"/checks"},t.createElement(Va,null)),t.createElement(J.Route,{title:"Tracks",path:"/tracks"},t.createElement(Ir,null)))}))))));export{Ar as RoutingPage};
|
|
2
|
+
//# sourceMappingURL=index-0a05659f.esm.js.map
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import{createApiRef as Ne,createRouteRef as T,createSubRouteRef as v,createPlugin as Ie,createApiFactory as De,discoveryApiRef as Le,fetchApiRef as Ae,createRoutableExtension as q,createComponentExtension as Fe,useApi as B,errorApiRef as xe,useRouteRef as j}from"@backstage/core-plugin-api";import{GraphQLClient as Oe}from"graphql-request";import l from"graphql-tag";import a,{createContext as V,useState as b,useCallback as E,useContext as K,useRef as Te,useEffect as qe,Fragment as Be}from"react";import{QueryClient as Me,QueryClientProvider as ze,useQuery as _}from"@tanstack/react-query";import{memoize as Ue}from"lodash";import We from"@material-ui/core/styles/makeStyles";import{makeStyles as p,Typography as d,Modal as Ge,Box as J,Button as X,Fade as He,alpha as C,Tooltip as Qe,withStyles as S,Divider as je}from"@material-ui/core";import{MarkdownContent as Y,Link as Z,EmptyState as ee,InfoCard as Ve}from"@backstage/core-components";import{useEntity as te,humanizeEntityRef as Ke}from"@backstage/plugin-catalog-react";import{useAutoUpdatingRelativeTime as _e,SpotifyLicenseBanner as Je}from"@spotify/backstage-plugin-core";import{stringifyEntityRef as re,parseEntityRef as Xe}from"@backstage/catalog-model";import{Alert as Ye,Skeleton as f}from"@material-ui/lab";import{Link as Ze}from"react-router-dom";import P from"classnames";import et from"@material-ui/icons/Schedule";import{DateTime as ae}from"luxon";import tt from"@material-ui/icons/Check";import rt from"@material-ui/icons/Close";import at from"@material-ui/icons/RemoveCircleOutline";import nt from"@material-ui/icons/HelpOutline";var ne=(e=>(e.Medal="MEDAL",e))(ne||{}),h=(e=>(e.Failed="FAILED",e.NotApplicable="NOT_APPLICABLE",e.NotReported="NOT_REPORTED",e.Passed="PASSED",e))(h||{});const it=l`
|
|
2
|
+
fragment CertificationSummary on Certification {
|
|
3
|
+
entityRef
|
|
4
|
+
program {
|
|
5
|
+
id
|
|
6
|
+
name
|
|
7
|
+
}
|
|
8
|
+
highestLevel {
|
|
9
|
+
ordinal
|
|
10
|
+
name
|
|
11
|
+
description
|
|
12
|
+
badge {
|
|
13
|
+
... on BadgeVariantMedal {
|
|
14
|
+
variant
|
|
15
|
+
options {
|
|
16
|
+
level
|
|
17
|
+
color
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`,ot=l`
|
|
24
|
+
fragment check on Check {
|
|
25
|
+
id
|
|
26
|
+
name
|
|
27
|
+
description
|
|
28
|
+
}
|
|
29
|
+
`,ct=l`
|
|
30
|
+
fragment level on Level {
|
|
31
|
+
ordinal
|
|
32
|
+
name
|
|
33
|
+
description
|
|
34
|
+
checks {
|
|
35
|
+
...check
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
${ot}`,st=l`
|
|
39
|
+
fragment CheckResultSummary on CheckResult {
|
|
40
|
+
id
|
|
41
|
+
name
|
|
42
|
+
result
|
|
43
|
+
timestamp
|
|
44
|
+
}
|
|
45
|
+
`,lt=l`
|
|
46
|
+
fragment LevelResultDetails on LevelResult {
|
|
47
|
+
ordinal
|
|
48
|
+
name
|
|
49
|
+
description
|
|
50
|
+
badge {
|
|
51
|
+
... on BadgeVariantMedal {
|
|
52
|
+
variant
|
|
53
|
+
options {
|
|
54
|
+
level
|
|
55
|
+
color
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
certified
|
|
60
|
+
checks {
|
|
61
|
+
...CheckResultSummary
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
${st}`,mt=l`
|
|
65
|
+
fragment CheckResultDetails on CheckResult {
|
|
66
|
+
id
|
|
67
|
+
name
|
|
68
|
+
description
|
|
69
|
+
result
|
|
70
|
+
timestamp
|
|
71
|
+
notes
|
|
72
|
+
}
|
|
73
|
+
`,dt=l`
|
|
74
|
+
fragment OverviewLevelResult on OverviewLevelResult {
|
|
75
|
+
ordinal
|
|
76
|
+
name
|
|
77
|
+
checks {
|
|
78
|
+
check {
|
|
79
|
+
id
|
|
80
|
+
name
|
|
81
|
+
description
|
|
82
|
+
}
|
|
83
|
+
results {
|
|
84
|
+
id
|
|
85
|
+
entityRef
|
|
86
|
+
result
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`,ie=l`
|
|
91
|
+
fragment HighestLevel on LevelResult {
|
|
92
|
+
entityRef
|
|
93
|
+
ordinal
|
|
94
|
+
name
|
|
95
|
+
badge {
|
|
96
|
+
... on BadgeVariantMedal {
|
|
97
|
+
variant
|
|
98
|
+
options {
|
|
99
|
+
color
|
|
100
|
+
level
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
`,ut=l`
|
|
106
|
+
mutation createCheck($input: CheckerInput!) {
|
|
107
|
+
check: createChecker(input: $input) {
|
|
108
|
+
id
|
|
109
|
+
filter
|
|
110
|
+
name
|
|
111
|
+
description
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
`,pt=l`
|
|
115
|
+
mutation createProgram($input: ProgramInput!) {
|
|
116
|
+
program: createProgram(input: $input) {
|
|
117
|
+
id
|
|
118
|
+
ownerEntityRef
|
|
119
|
+
name
|
|
120
|
+
description
|
|
121
|
+
documentationURL
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
`,gt=l`
|
|
125
|
+
mutation deleteChecker($checkerId: String!) {
|
|
126
|
+
deleteChecker(checkerId: $checkerId)
|
|
127
|
+
}
|
|
128
|
+
`,ht=l`
|
|
129
|
+
mutation deleteProgram($programId: String!) {
|
|
130
|
+
programDeleted: deleteProgram(programId: $programId)
|
|
131
|
+
}
|
|
132
|
+
`,ft=l`
|
|
133
|
+
mutation updateCheck($input: CheckerInput!) {
|
|
134
|
+
check: updateChecker(input: $input) {
|
|
135
|
+
id
|
|
136
|
+
filter
|
|
137
|
+
name
|
|
138
|
+
description
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
`,kt=l`
|
|
142
|
+
mutation updateProgram($input: ProgramInput!) {
|
|
143
|
+
program: updateProgram(input: $input) {
|
|
144
|
+
id
|
|
145
|
+
ownerEntityRef
|
|
146
|
+
name
|
|
147
|
+
description
|
|
148
|
+
documentationURL
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
`,yt=l`
|
|
152
|
+
query getAllCertifications($entityRef: String!) {
|
|
153
|
+
certifications(entityRef: $entityRef, includeFilteredChecks: false) {
|
|
154
|
+
...CertificationSummary
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
${it}`,vt=l`
|
|
158
|
+
query getAllPrograms($programIds: [String!], $first: Int, $after: String) {
|
|
159
|
+
programs(programIds: $programIds, first: $first, after: $after) {
|
|
160
|
+
totalCount
|
|
161
|
+
endCursor
|
|
162
|
+
hasNextPage
|
|
163
|
+
edges {
|
|
164
|
+
cursor
|
|
165
|
+
program {
|
|
166
|
+
id
|
|
167
|
+
ownerEntityRef
|
|
168
|
+
name
|
|
169
|
+
description
|
|
170
|
+
documentationURL
|
|
171
|
+
levels {
|
|
172
|
+
...level
|
|
173
|
+
}
|
|
174
|
+
isEditable
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
${ct}`,Et=l`
|
|
180
|
+
query getCertificationDetails($entityRef: String!, $programId: String!) {
|
|
181
|
+
programCertification(
|
|
182
|
+
entityRef: $entityRef
|
|
183
|
+
programId: $programId
|
|
184
|
+
includeFilteredChecks: false
|
|
185
|
+
) {
|
|
186
|
+
program {
|
|
187
|
+
id
|
|
188
|
+
name
|
|
189
|
+
description
|
|
190
|
+
documentationURL
|
|
191
|
+
}
|
|
192
|
+
highestLevel {
|
|
193
|
+
...HighestLevel
|
|
194
|
+
}
|
|
195
|
+
levels {
|
|
196
|
+
...LevelResultDetails
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
${ie}
|
|
201
|
+
${lt}`,Ct=l`
|
|
202
|
+
query getCheckResultDetails($entityRef: String!, $programId: String!, $checkId: String!) {
|
|
203
|
+
checkResult(entityRef: $entityRef, programId: $programId, checkId: $checkId) {
|
|
204
|
+
...CheckResultDetails
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
${mt}`,wt=l`
|
|
208
|
+
query getCheckers($ids: [String!], $first: Int, $after: String, $orderAlphabetical: String, $searchByOwner: String, $searchByName: String) {
|
|
209
|
+
checkers(
|
|
210
|
+
ids: $ids
|
|
211
|
+
first: $first
|
|
212
|
+
after: $after
|
|
213
|
+
orderAlphabetical: $orderAlphabetical
|
|
214
|
+
searchByOwner: $searchByOwner
|
|
215
|
+
searchByName: $searchByName
|
|
216
|
+
) {
|
|
217
|
+
totalCount
|
|
218
|
+
endCursor
|
|
219
|
+
hasNextPage
|
|
220
|
+
edges {
|
|
221
|
+
cursor
|
|
222
|
+
checker {
|
|
223
|
+
id
|
|
224
|
+
ownerEntityRef
|
|
225
|
+
name
|
|
226
|
+
description
|
|
227
|
+
rule
|
|
228
|
+
passedMessage
|
|
229
|
+
failedMessage
|
|
230
|
+
isEditable
|
|
231
|
+
schedule {
|
|
232
|
+
... on Frequency {
|
|
233
|
+
cron
|
|
234
|
+
}
|
|
235
|
+
... on HumanDuration {
|
|
236
|
+
years
|
|
237
|
+
months
|
|
238
|
+
weeks
|
|
239
|
+
days
|
|
240
|
+
hours
|
|
241
|
+
minutes
|
|
242
|
+
seconds
|
|
243
|
+
milliseconds
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
`,Rt=l`
|
|
251
|
+
query getFacetsForOwner($ownerEntityRef: String!) {
|
|
252
|
+
facetsForOwner(ownerEntityRef: $ownerEntityRef) {
|
|
253
|
+
types {
|
|
254
|
+
kind
|
|
255
|
+
type
|
|
256
|
+
count
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
`,$t=l`
|
|
261
|
+
query getProgramOverviewForOwner($ownerEntityRef: String!, $facet: FacetInput) {
|
|
262
|
+
programOverviewForOwner(
|
|
263
|
+
ownerEntityRef: $ownerEntityRef
|
|
264
|
+
facet: $facet
|
|
265
|
+
includeFilteredChecks: false
|
|
266
|
+
) {
|
|
267
|
+
programs {
|
|
268
|
+
program {
|
|
269
|
+
id
|
|
270
|
+
name
|
|
271
|
+
}
|
|
272
|
+
highestLevels {
|
|
273
|
+
...HighestLevel
|
|
274
|
+
}
|
|
275
|
+
levels {
|
|
276
|
+
...OverviewLevelResult
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
entityRefs
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
${ie}
|
|
283
|
+
${dt}`,bt=(e,t,r)=>e();function St(e,t=bt){return{createCheck(r,n){return t(i=>e.request(ut,r,{...n,...i}),"createCheck","mutation")},createProgram(r,n){return t(i=>e.request(pt,r,{...n,...i}),"createProgram","mutation")},deleteChecker(r,n){return t(i=>e.request(gt,r,{...n,...i}),"deleteChecker","mutation")},deleteProgram(r,n){return t(i=>e.request(ht,r,{...n,...i}),"deleteProgram","mutation")},updateCheck(r,n){return t(i=>e.request(ft,r,{...n,...i}),"updateCheck","mutation")},updateProgram(r,n){return t(i=>e.request(kt,r,{...n,...i}),"updateProgram","mutation")},getAllCertifications(r,n){return t(i=>e.request(yt,r,{...n,...i}),"getAllCertifications","query")},getAllPrograms(r,n){return t(i=>e.request(vt,r,{...n,...i}),"getAllPrograms","query")},getCertificationDetails(r,n){return t(i=>e.request(Et,r,{...n,...i}),"getCertificationDetails","query")},getCheckResultDetails(r,n){return t(i=>e.request(Ct,r,{...n,...i}),"getCheckResultDetails","query")},getCheckers(r,n){return t(i=>e.request(wt,r,{...n,...i}),"getCheckers","query")},getFacetsForOwner(r,n){return t(i=>e.request(Rt,r,{...n,...i}),"getFacetsForOwner","query")},getProgramOverviewForOwner(r,n){return t(i=>e.request($t,r,{...n,...i}),"getProgramOverviewForOwner","query")}}}var oe=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},o=(e,t,r)=>(oe(e,t,"read from private field"),r?r.call(e):t.get(e)),w=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},M=(e,t,r,n)=>(oe(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),N,I,m,z,u;const D=Ne({id:"plugin.soundcheck"}),Pt=e=>"response"in e&&"errors"in e.response,Nt=e=>"response"in e&&"message"in e.response;class It{constructor(t){w(this,N,void 0),w(this,I,void 0),w(this,m,void 0),w(this,z,n=>{var i,c,s;return Pt(n)?(s=(c=(i=n.response)==null?void 0:i.errors)==null?void 0:c[0].message)!=null?s:`${n}`:Nt(n)?n.response.message:`${n}`}),w(this,u,async n=>{try{return await n()}catch(i){throw new Error(`Error from Soundcheck backend: ${o(this,z).call(this,i)}`)}}),M(this,N,t.fetchApi),M(this,I,t.discoveryApi);const r=new Oe("/graphql",{fetch:async(n,i)=>{const c=`${await o(this,I).getBaseUrl("soundcheck")}${n}`;return o(this,N).fetch(c,i)}});M(this,m,St(r))}async getAllCertifications(t){return o(this,u).call(this,async()=>{const{certifications:r}=await o(this,m).getAllCertifications({entityRef:t});return r})}async getCertificationDetails(t,r){return o(this,u).call(this,async()=>{const{programCertification:n}=await o(this,m).getCertificationDetails({entityRef:t,programId:r});return n})}async getCheckResultDetails(t,r,n){return o(this,u).call(this,async()=>{const{checkResult:i}=await o(this,m).getCheckResultDetails({entityRef:t,programId:r,checkId:n});return i})}async getFacetsForOwner(t){return o(this,u).call(this,async()=>{const{facetsForOwner:r}=await o(this,m).getFacetsForOwner({ownerEntityRef:t});return r})}async getProgramOverviewForOwner(t,r){return o(this,u).call(this,async()=>{const{programOverviewForOwner:n}=await o(this,m).getProgramOverviewForOwner({ownerEntityRef:t,facet:r});return n})}async getAllPrograms(t,r,n){return o(this,u).call(this,async()=>{const{programs:i}=await o(this,m).getAllPrograms({programIds:t,first:r,after:n});return i})}async createProgram(t){return o(this,u).call(this,async()=>{const{program:r}=await o(this,m).createProgram({input:t});return r})}async updateProgram(t){return o(this,u).call(this,async()=>{const{program:r}=await o(this,m).updateProgram({input:t});return r})}async deleteProgram(t){return o(this,u).call(this,async()=>{const{programDeleted:r}=await o(this,m).deleteProgram({programId:t});return r})}async getCheckers(t,r,n){return o(this,u).call(this,async()=>{const{checkers:i}=await o(this,m).getCheckers({ids:t,first:r,after:n});return i})}async createChecker(t){return o(this,u).call(this,async()=>{const{check:r}=await o(this,m).createCheck({input:t});return r})}async updateChecker(t){return o(this,u).call(this,async()=>{const{check:r}=await o(this,m).updateCheck({input:t});return r})}async deleteChecker(t){return o(this,u).call(this,async()=>await o(this,m).deleteChecker({checkerId:t}))}}N=new WeakMap,I=new WeakMap,m=new WeakMap,z=new WeakMap,u=new WeakMap;const L=T({id:"soundcheck-entity"}),ce=v({id:"soundcheck-entity-certification-track-redirect",parent:L,path:"/:trackId"}),se=v({id:"soundcheck-entity-certification",parent:L,path:"/:trackId/:checkId"}),Dt=T({id:"soundcheck-overview"}),A=T({id:"soundcheck"});v({id:"soundcheck-checks",parent:A,path:"/checks"}),v({id:"soundcheck-tracks",parent:A,path:"/tracks"}),v({id:"soundcheck-track-details",parent:A,path:"/tracks/:trackId"});const R=Ie({id:"soundcheck",apis:[De({api:D,deps:{discoveryApi:Le,fetchApi:Ae},factory:e=>new It(e)})],routes:{entityContent:L}}),Lt=R.provide(q({name:"EntitySoundcheckContent",component:()=>import("./EntitySoundcheckContent-8fdad07c.esm.js").then(e=>e.EntitySoundcheckContent),mountPoint:L})),At=R.provide(Fe({name:"EntitySoundcheckCard",component:{lazy:()=>import("./index-b3600988.esm.js").then(e=>e.EntitySoundcheckCard)}})),Ft=R.provide(q({name:"SoundcheckOverviewPage",component:()=>import("./index-92271e48.esm.js").then(e=>e.OverviewPage),mountPoint:Dt})),xt=R.provide(q({name:"SoundcheckRoutingPage",component:()=>import("./index-0a05659f.esm.js").then(e=>e.RoutingPage),mountPoint:A})),Ot=Ue(e=>new Me({defaultOptions:{queries:{refetchInterval:6e4,refetchIntervalInBackground:!1,refetchOnWindowFocus:"always",retry:2,retryDelay:t=>{const r=450+Math.ceil(Math.random()*100);return Math.min(r*2**t,3e4)},onError:t=>e.post(t)}}})),Tt=e=>{const t=B(xe),r=Ot(t);return a.createElement(ze,{client:r},e.children)};function le(e){const t=B(D),r=re(e);return _(["soundcheck/certifications",r],async()=>t.getAllCertifications(r))}function me(e,t){const r=B(D),n=re(e);return _(["soundcheck/certifications",n,t],async()=>r.getCertificationDetails(n,t),{enabled:!!t})}var de=(e=>(e.GetAllPrograms="soundcheck/programs",e.GetCheckers="soundcheck/checkers",e))(de||{}),ue=(e=>(e.DeleteChecker="soundcheck/deleteChecker",e.CreateChecker="soundcheck/createChecker",e.UpdateChecker="soundcheck/updateChecker",e.DeleteProgram="soundcheck/deleteProgram",e.CreateProgram="soundcheck/createProgram",e.UpdateProgram="soundcheck/updateProgram",e))(ue||{});const qt=p(e=>({root:{padding:e.spacing(3)},icon:{display:"none"},message:{padding:0},type:{fontWeight:700,lineHeight:1.75}})),F=e=>{const{type:t,...r}=qt();return a.createElement(Ye,{severity:e.severity,elevation:1,classes:r,onClose:e.onClose},a.createElement(d,{classes:{root:t}},e.title),e.children)},pe=V({}),Bt=e=>{const[t,r]=b(),n=E(c=>{r(c)},[]),i=E(()=>{r(null)},[]);return a.createElement(pe.Provider,{value:{showAlert:n,clearAlert:i}},t&&a.createElement(F,{severity:t.severity,title:t.title,onClose:i},t.message),e.children)},Mt=()=>K(pe),zt=p(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"}})),ge=V({}),Ut=e=>{const t=zt(),[r,n]=b(!1),[i,c]=b(),s=Te(),g=E(({title:$,message:Se})=>(c({title:$,message:Se}),n(!0),new Promise(Pe=>{s.current=Pe})),[]),y=E(()=>{s.current&&s.current(!0),n(!1)},[]),k=E(()=>{s.current&&s.current(!1),n(!1)},[]);return a.createElement(ge.Provider,{value:{showModal:g}},e.children,i&&a.createElement(Ge,{open:r,onClose:k,"aria-labelledby":"confirmation-modal-title","aria-describedby":"confirmation-modal-description"},a.createElement(J,{className:t.modalContent},a.createElement(d,{id:"confirmation-modal-title",variant:"h6"},i.title),a.createElement(d,{className:t.modalMessage,id:"confirmation-modal-description",variant:"body1"},i.message),a.createElement("div",{className:t.modalButtons},a.createElement(X,{onClick:k,variant:"contained","aria-label":"cancel"},"Cancel"),a.createElement(X,{color:"primary",onClick:y,variant:"contained","aria-label":"confirm"},"Confirm")))))},Wt=()=>K(ge),he=24,Gt=11,U=e=>e==="small"?1:2,Ht=p({root:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",borderWidth:"2px",fontWeight:700,width:({size:e})=>`${he*U(e)}px`,height:({size:e})=>`${he*U(e)}px`,fontSize:({size:e})=>`${Gt*U(e)}px`}}),fe=({className:e,label:t,size:r="small"})=>{const n=Ht({size:r});return a.createElement("span",{className:P(e,n.root),role:"img","aria-label":`${t} badge`},t)},Qt=p(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(",")}}})),W=({className:e,badge:t,size:r="small"})=>{const n=Qt({color:t.options.color,size:r});return a.createElement(fe,{className:P(e,n.root),size:r,label:`L${t.options.level}`})},jt=p({root:{borderColor:"currentColor",borderStyle:"dashed"}}),ke=({className:e,size:t="small"})=>{const r=jt();return a.createElement(fe,{className:P(e,r.root),size:t,label:"NL"})},G=p(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 Vt({description:e,documentationUrl:t}){const r=G();return t?a.createElement("div",{className:r.description},a.createElement(Y,{content:e}),a.createElement(Z,{to:t},"Learn more")):a.createElement("div",{className:r.description},a.createElement(Y,{content:e}))}const ye=({name:e,level:t,badge:r,description:n,documentationUrl:i})=>{const c=G();return a.createElement("div",{className:c.root},r?a.createElement(W,{size:"large",badge:r}):a.createElement(ke,{size:"large"}),a.createElement("div",null,a.createElement(d,{variant:"caption",className:c.level},t!=null?t:"No Level"),a.createElement(d,{className:c.title},e),n&&a.createElement(Vt,{description:n,documentationUrl:i})))},x=({children:e})=>{const[t,r]=b(!1);return qe(()=>{const n=setTimeout(()=>{r(!0)},250);return()=>clearTimeout(n)},[]),a.createElement(He,{in:t,timeout:250},e)},H=({hideDescription:e=!1})=>{const t=G();return a.createElement(x,null,a.createElement("div",{className:t.root},a.createElement(f,{width:44,height:44}),a.createElement("div",null,a.createElement(d,{variant:"caption",className:t.level},a.createElement(f,{width:100})),a.createElement(d,{variant:"h4",className:t.title},a.createElement(f,{width:300})),!e&&a.createElement(d,{variant:"body2"},a.createElement(f,null)))))},ve=p(e=>{const t=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{wrapper:{backgroundColor:t,color:C(e.palette.getContrastText(t),.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:r})=>[`"${r?"badge":"title"} title"`,`"${r?".":"description"} description"`].join(" "),gridTemplateColumns:"auto 1fr"},title:{gridArea:"title",textTransform:"uppercase",fontWeight:"bold",color:C(e.palette.getContrastText(t),.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:C(e.palette.getContrastText(t),.8),fontSize:e.typography.subtitle2.fontSize,marginTop:e.spacing(1)}}}),Kt=e=>{const t=ve({badge:e.badge});return a.createElement("div",{className:t.wrapper},e.badge?a.createElement(W,{className:t.badge,badge:e.badge}):null,a.createElement(d,{className:t.title},e.title),e.description?a.createElement(d,{className:t.description},e.description):null)},_t=()=>{const e=ve({});return a.createElement(x,null,a.createElement("div",{className:e.wrapper},a.createElement(f,{className:e.title}),a.createElement(d,{className:e.description},a.createElement(f,null))))},Jt=p(e=>({root:{display:"inline-flex",alignItems:"center",gap:e.spacing(1)}})),Ee=({timestamp:e,description:t})=>{const r=Jt(),n=ae.fromISO(e).toLocaleString(ae.DATETIME_FULL),i=_e(e),c=t?`${t}: ${i}`:void 0;return a.createElement("div",{className:r.root},a.createElement(Qe,{title:n},a.createElement(d,{variant:"caption","aria-label":c},i)),a.createElement(et,null))},Xt=e=>({[h.Passed]:"Check passed",[h.NotReported]:"Check not reported",[h.Failed]:"Check failed",[h.NotApplicable]:"Check not applicable"})[e],Yt=S(e=>({root:{color:e.palette.success.main}}))(tt),Zt=S(e=>({root:{color:e.palette.error.main}}))(rt),er=S(e=>({root:{color:e.palette.info.main}}))(nt),tr=S(e=>({root:{color:e.palette.text.disabled}}))(at),Ce=({result:e,className:t})=>{const r={className:t,"aria-label":Xt(e),"aria-hidden":!1};return e===h.Passed?a.createElement(Yt,{...r}):e===h.NotReported?a.createElement(er,{...r}):e===h.Failed?a.createElement(Zt,{...r}):e===h.NotApplicable?a.createElement(tr,{...r}):null},we=p(e=>({root:{display:"grid",width:"100%",gridTemplateColumns:"auto 1fr auto",gridColumnGap:e.spacing(1),padding:e.spacing(1),alignItems:"center","&.selected":{backgroundColor:C(e.palette.primary[e.palette.type],.2)},"&:hover, &:active, &:focus":{backgroundColor:C(e.palette.primary[e.palette.type],.3)}}})),rr=({className:e,href:t,children:r})=>t?a.createElement(Ze,{to:t,className:e},r):a.createElement("div",{className:e},r),ar=({result:e,name:t,timestamp:r,selected:n=!1,href:i})=>{const c=we(),s=P(c.root,{selected:n});return a.createElement(rr,{href:i,className:s},a.createElement(Ce,{result:e}),a.createElement(d,{variant:"body2"},t),r?a.createElement(Ee,{timestamp:r}):null)},Q=()=>{const e=we();return a.createElement(x,null,a.createElement("div",{className:e.root},a.createElement(f,{width:24,height:24}),a.createElement(d,{variant:"body2"},a.createElement(f,null)),a.createElement(f,{width:100,height:24})))},nr=()=>{const e=Re();return a.createElement("div",{className:e.root},a.createElement(H,null),new Array(3).fill(null).map((t,r)=>a.createElement(a.Fragment,{key:`skeleton-level-${r}`},a.createElement(_t,null),a.createElement("ul",{className:e.checks},a.createElement(Q,null),a.createElement(Q,null),a.createElement(Q,null)))))},ir=p(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"}}})),or=({checks:e,trackId:t,checkId:r})=>{const n=ir(),i=j(se);return e.length?a.createElement("ul",{className:n.checks},e.map(c=>a.createElement("li",{key:c.id,className:n.checkItem},a.createElement(ar,{...c,selected:c.id===r,href:i({trackId:t,checkId:c.id})})))):a.createElement(d,{variant:"body2",className:n.noChecks},"No applicable checks at this level.")},cr=({level:e,checkId:t,trackId:r})=>{var n;return a.createElement(a.Fragment,null,a.createElement(Kt,{badge:e.badge,title:e.name,description:e.description}),a.createElement(or,{checks:(n=e.checks)!=null?n:[],trackId:r,checkId:t}))},Re=p(e=>({root:{borderRight:`1px solid ${e.palette.divider}`},checks:{padding:0,margin:0,flex:1,listStyle:"none"}})),sr=({trackId:e,checkId:t})=>{var r,n;const i=Re(),{entity:c}=te(),{data:s,isLoading:g,isError:y}=me(c,e);return y?a.createElement("div",{className:i.root},a.createElement(J,{padding:2},a.createElement(F,{severity:"error",title:"Error loading certification"}))):g||!e?a.createElement(nr,null):s?a.createElement("div",{className:i.root},a.createElement(ye,{name:s.program.name,level:(r=s.highestLevel)==null?void 0:r.name,badge:(n=s.highestLevel)==null?void 0:n.badge,description:s.program.description,documentationUrl:s.program.documentationURL}),s==null?void 0:s.levels.map(k=>a.createElement(cr,{key:k.ordinal,level:k,checkId:t,trackId:e}))):null},lr=()=>a.createElement(a.Fragment,null,a.createElement(H,{hideDescription:!0}),a.createElement(H,{hideDescription:!0})),$e=({className:e})=>a.createElement("div",{className:e},a.createElement(ee,{title:"No certifications available",missing:"data",description:"There are no tracks configured that apply to this entity."})),mr=({ownerEntityRef:e})=>e?a.createElement(ee,{missing:"data",title:"Missing entities",description:a.createElement(a.Fragment,null,"Looks like the group"," ",Ke(Xe(e),{defaultKind:"Group"})," ","doesn't own any entities.",a.createElement("br",null),a.createElement("br",null),"Please select another group from the dropdown in the corner of the header.")}):null,be=We(e=>({certificationWrapper:{display:"flex",justifyContent:"space-between",alignItems:"center"},infoCard:{display:"grid",gridRowGap:e.spacing(2)},emptyState:{"& > div":{backgroundColor:e.palette.background.paper}}})),O=({children:e,title:t})=>{const r=be();return a.createElement(Ve,{title:t},a.createElement("div",{className:r.infoCard},a.createElement(Je,{inline:!0,backend:"soundcheck",invalidLicenseMessage:"Submitted check results will still be stored, but it will not be possible to view certifications or individual results until a valid license is present."}),e))},dr=({title:e="Soundcheck"})=>{const{entity:t}=te(),r=be(),{data:n,isError:i,isLoading:c}=le(t),s=j(ce);return i?a.createElement(O,{title:e},a.createElement(F,{severity:"error",title:"Error loading certifications"})):c||!n?a.createElement(O,{title:e},a.createElement(lr,null)):n.length===0?a.createElement(O,{title:e},a.createElement($e,{className:r.emptyState})):a.createElement(O,{title:e},n.map((g,y)=>{var k,$;return a.createElement(Be,{key:g.program.name},a.createElement("div",{className:r.certificationWrapper,"data-testid":"soundcheck-track-row"},a.createElement(ye,{key:g.program.id,name:g.program.name,badge:(k=g.highestLevel)==null?void 0:k.badge,level:($=g.highestLevel)==null?void 0:$.name}),a.createElement(Z,{to:s({trackId:g.program.id})},"View Details")),y<n.length-1?a.createElement(je,null):null)}))};export{F as A,ne as B,sr as C,Lt as E,x as F,W as L,ue as M,ke as N,Ut as P,de as Q,h as R,Tt as S,Ee as a,le as b,ce as c,$e as d,se as e,dr as f,Ce as g,mr as h,Bt as i,Mt as j,R as k,At as l,Ft as m,xt as n,D as s,me as u,Wt as w};
|
|
284
|
+
//# sourceMappingURL=index-40aa00c1.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t,{useState as P,useEffect as v,useMemo as I,useCallback as G,memo as k,Fragment as de}from"react";import{useSearchParams as pe,Routes as me,Route as S}from"react-router-dom";import{HeaderTabs as M,Link as O,EmptyState as ue,Page as ge,Header as he,Content as fe}from"@backstage/core-components";import{useApi as b,identityApiRef as ye,useRouteRef as F,configApiRef as j}from"@backstage/core-plugin-api";import{SpotifyLicenseBanner as Ee}from"@spotify/backstage-plugin-core";import{makeStyles as h,alpha as D,TextField as ve,CircularProgress as ke,Tooltip as K,LinearProgress as be,withStyles as Ce,Grid as C,Typography as E,Button as _}from"@material-ui/core";import we from"@material-ui/lab/Autocomplete";import{stringifyEntityRef as Q,parseEntityRef as $}from"@backstage/catalog-model";import{useQuery as A}from"@tanstack/react-query";import{s as U,R as w,g as Ne,B as Re,L as q,N as J,A as $e,h as xe,S as Te,P as Pe,i as Le}from"./index-40aa00c1.esm.js";import{catalogApiRef as X,humanizeEntityRef as L,entityRouteRef as B}from"@backstage/plugin-catalog-react";import{R as Ie}from"./RefetchingIndicator-0caa936c.esm.js";import{countBy as Y}from"lodash";import{Skeleton as H}from"@material-ui/lab";import{VariableSizeGrid as Se}from"react-window";import{C as Oe,P as Fe}from"./CheckFormContext-6f85a3bf.esm.js";import"graphql-request";import"graphql-tag";import"@material-ui/core/styles/makeStyles";import"classnames";import"@material-ui/icons/Schedule";import"luxon";import"@material-ui/icons/Check";import"@material-ui/icons/Close";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/HelpOutline";import"react-use/lib/useDebounce";function Ae(){const e=b(X);return A(["soundcheck/all-groups"],async()=>{const{items:r}=await e.getEntities({filter:{kind:"Group"}});return r.filter(a=>(a==null?void 0:a.kind)==="Group").map(a=>{var n,l,o,i;return{name:(i=(o=(l=(n=a.spec)==null?void 0:n.profile)==null?void 0:l.displayName)!=null?o:a.metadata.title)!=null?i:a.metadata.name,ref:Q(a)}})})}function Be(e){const r=b(U);return A(["soundcheck/facets-for-owner",e],async()=>r.getFacetsForOwner(e),{enabled:!!e})}function Z(e,r){const a=b(U);return A(["soundcheck/track-overview-for-owner",e,r],async()=>a.getProgramOverviewForOwner(e,r),{enabled:!!e&&!!(r!=null&&r.kind)})}function He(){const e=b(ye),r=b(X);return A(["soundcheck/user-groups-claims"],async()=>{const{ownershipEntityRefs:a}=await e.getBackstageIdentity();return(await r.getEntitiesByRefs({entityRefs:a})).items.filter(n=>(n==null?void 0:n.kind)==="Group").map(n=>{var l,o,i,c;return{name:(c=(i=(o=(l=n.spec)==null?void 0:l.profile)==null?void 0:o.displayName)!=null?i:n.metadata.title)!=null?c:n.metadata.name,ref:Q(n)}})})}const ze=()=>{const[e,r]=pe(),a=Object.fromEntries(e.entries()),[n,l]=P(a);return v(()=>{r(n,{replace:!0})},[n]),[n,l]},We=()=>{const{data:e,isLoading:r,isError:a}=He(),{data:n,isLoading:l,isError:o}=Ae();return{options:I(()=>{const i=[];return e&&i.push(...e.map(({name:c,ref:s})=>({name:c,ref:s,key:"My Groups"}))),n&&i.push(...n.map(({name:c,ref:s})=>({name:c,ref:s,key:"All Groups"}))),i},[e,n]),isLoading:r||l,isError:a||o}},Ve=h(e=>({root:{width:"100%",minWidth:250},textField:{"& $notchedOutline":{borderColor:D(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:{}})),Ge=e=>{const{onChange:r,initialValue:a,setError:n}=e,{options:l,isLoading:o,isError:i}=We(),c=Ve(),[s,d]=P(null);v(()=>{if(!o&&l!=null&&l.length&&!s){const m=a?l.find(p=>p.ref===a):l[0];m&&(d(m),r==null||r(m.ref))}},[o,l,s,r,a]);const u=G((m,p)=>{d(p),r==null||r(p==null?void 0:p.ref)},[r,d]);return v(()=>{n==null||n(i?new Error("Error loading groups"):void 0)},[i,n]),i?null:t.createElement(we,{"aria-label":"Current group",className:c.root,classes:{clearIndicator:c.clearIndicator,popupIndicator:c.popupIndicator},disableClearable:!0,options:l!=null?l:[],loading:o,groupBy:m=>m.key,value:s,freeSolo:!1,onChange:u,getOptionLabel:m=>m.name,renderInput:m=>t.createElement(ve,{...m,variant:"outlined",placeholder:o?"Loading":"Select a group",className:c.textField,InputProps:{...m.InputProps,className:c.input,classes:{notchedOutline:c.notchedOutline},endAdornment:t.createElement(t.Fragment,null,o?t.createElement(ke,{color:"inherit",size:20}):null,m.InputProps.endAdornment)}})})},Me=()=>t.createElement(t.Fragment,null,"Fact Collectors Page"),je=e=>({key:`skeleton${e}`,label:"",id:`skeleton${e}`}),De=()=>{const e=Array.from({length:4},(r,a)=>je(a));return t.createElement(M,{tabs:e})},Ke=h(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)}})),_e=({unfilteredFacets:e,onChange:r,kind:a,type:n})=>{var l,o,i;const c=Ke(),s={types:(l=e==null?void 0:e.types.filter(({count:p})=>p>0))!=null?l:[]},d=G(p=>{var g;r((g=s==null?void 0:s.types[p].kind)!=null?g:"",s==null?void 0:s.types[p].type)},[s==null?void 0:s.types,r]);v(()=>{var p,g,y;const f=(s==null?void 0:s.types)&&s.types.length>=0,x=!a&&f,R=a&&f&&!(s!=null&&s.types.find(({kind:T,type:V})=>a===T&&(!n&&!V||n===V)));(x||R)&&r((g=(p=s==null?void 0:s.types[0])==null?void 0:p.kind)!=null?g:"",(y=s==null?void 0:s.types[0])==null?void 0:y.type)},[a,n,s==null?void 0:s.types,r]);const u=(o=s==null?void 0:s.types.map(({kind:p,type:g,count:y})=>{const f=`${p}|${g!=null?g:""}`;return{key:f,label:`${g!=null?g:p} (${y>50?"50+":y})`,id:f,tabProps:{className:c.tab}}}))!=null?o:[];if(!u.length)return null;const m=(i=s==null?void 0:s.types.findIndex(p=>p.kind===a&&(!p.type&&!n||p.type===n)))!=null?i:-1;return t.createElement(t.Fragment,null,t.createElement(Ie,null),t.createElement(M,{onChange:d,tabs:u,selectedIndex:m>-1?m:void 0}))},Qe=h(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"}})),ee=e=>{var r,a;const n=Qe(e),l=I(()=>Object.entries(e.progress).reduce((i,[,c])=>i+c,0),[e.progress]);if(l===0)return null;const o=(r=e.progress[w.Passed])!=null?r:0;return t.createElement(K,{arrow:!0,title:`Check passing for ${o} of ${l} ${l===1?"entity":"entities"}`,enterDelay:0,placement:"top"},t.createElement(be,{variant:"determinate",value:((a=e.progress[w.Passed])!=null?a:0)/l*100,classes:{root:n.root,bar:n.bar}}))},Ue=h(e=>({headerWrapper:{marginTop:e.spacing(.5)},entityRefName:{fontWeight:"bold"},iconWrapper:{padding:e.spacing(1.5,.5),display:"flex",alignItems:"center",justifyContent:"center"}})),qe=({check:{name:e,description:r},icon:a,entityRef:n})=>{const l=Ue(),o=$(n);return t.createElement(C,{spacing:1},t.createElement(C,{container:!0,direction:"row",spacing:1,wrap:"nowrap"},t.createElement("div",{className:l.iconWrapper},a),t.createElement(E,{variant:"h6",className:l.headerWrapper,noWrap:!0},e)),t.createElement(C,{item:!0,wrap:"nowrap"},t.createElement(E,{variant:"subtitle2",className:l.entityRefName},L(o,{defaultKind:o.kind}))),t.createElement(E,{variant:"caption"},r))},Je=Ce(e=>{const r=e.palette.type==="dark"?e.palette.common.black:e.palette.grey[300];return{tooltip:{backgroundColor:r,color:e.palette.type==="dark"?e.palette.common.white:e.palette.grey[700]},arrow:{color:r}}})(K),Xe=({children:e,check:r,icon:a,entityRef:n})=>t.createElement(Je,{arrow:!0,title:t.createElement(qe,{check:r,icon:a,entityRef:n}),enterDelay:150,placement:"top"},e),Ye=h(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}`}})),te=k(({programId:e,check:r,entityRef:a,result:n,entityRoute:l,isVirtualized:o})=>{const i=Ye();if(typeof a!="string"){const u=t.createElement("div",{className:i.iconWrapper},t.createElement("div",{className:i.icon}));return o?t.createElement("div",{className:`${i.root} ${i.virtualized}`,"aria-hidden":!0},u):t.createElement("td",{className:i.root,"aria-hidden":!0},u)}const c=t.createElement(Ne,{className:i.icon,result:n!=null?n:w.NotReported}),s=t.createElement("div",{className:i.iconWrapper},c),d=n&&n===w.NotApplicable?s:t.createElement(O,{className:i.link,to:`${l($(a))}/soundcheck/${e}/${r.id}`},s);return o?t.createElement("div",{className:`${i.root} ${i.virtualized}`},t.createElement(Xe,{check:r,icon:c,entityRef:a},d)):t.createElement("td",{className:`${i.root}`},d)}),re=8,Ze=16,N={programTitle:70,levelTitle:30,check:42,entityRefFooter:100},z={programTitle:350+Ze*2,checkResult:42},et=e=>e.reduce((r,a)=>r+a.height,0),tt=e=>e*z.checkResult+z.programTitle,rt=e=>e.filter(r=>r!==void 0).map(r=>{const a=$(r);return L(a,{defaultKind:a.kind})}).reduce((r,a)=>r.length>a.length?r:a,""),at=e=>re*e+re,ae="NoLevel",nt=e=>({name:ae,badge:{options:{level:0,color:""},variant:Re.Medal},entityRef:e,ordinal:0}),ne=h(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:`${N.check}px`,lineHeight:`${N.check}px`,borderBottom:`1px solid ${e.palette.divider}`,borderRight:`1px solid ${e.palette.divider}`}})),lt=k(({programId:e,programName:r,check:a,entityRefs:n,results:l,entityRoute:o})=>{const i=ne(),c=I(()=>Y(l.filter(({result:d})=>d!==w.NotApplicable),"result"),[l]),s=new Map(l.map(d=>[d.entityRef,d.result]));return t.createElement("tr",{"data-testid":"track-check-row"},t.createElement("th",{scope:"row",className:i.checkNameCell,"aria-label":`${a.name} check for ${r} track`},t.createElement("div",{className:i.checkNameContent},t.createElement(E,{className:i.checkNameTypography,variant:"subtitle2",component:"p"},a.name),t.createElement(ee,{className:i.checkIndicator,progress:c}))),n.map((d,u)=>t.createElement(te,{key:u,programId:e,check:a,entityRef:d,result:typeof d=="string"?s.get(d):void 0,entityRoute:o})))}),ot=({name:e,progress:r})=>{const a=ne();return t.createElement("div",{className:a.checkNameCell,"aria-label":`${e} check`},t.createElement("div",{className:`${a.checkNameContent} ${a.checkNameCellVirtualized}`},t.createElement(E,{variant:"subtitle2",component:"p",className:a.checkNameTypography},e),t.createElement(ee,{className:a.checkIndicator,progress:r})))},it=h(e=>({virtualized:{borderRight:`1px solid ${e.palette.divider}`,height:`${N.programTitle}px`,display:"flex",justifyContent:"center",alignItems:"center"}})),ct=k(({entityRef:e,highestLevels:r})=>{const a=r.find(n=>n.entityRef===e);return t.createElement(t.Fragment,null,a!=null&&a.badge?t.createElement(q,{badge:a.badge}):t.createElement(J,null))}),st=({highestLevel:e})=>{const r=it();if(!(e!=null&&e.badge))return t.createElement("div",{className:r.virtualized},"\xA0");const a=e.name!==ae;return t.createElement("div",{className:r.virtualized},a?t.createElement(q,{badge:e.badge}):t.createElement(J,null))},le=h(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}`}})),dt=k(({program:e,entityRefs:r,highestLevels:a})=>{const n=le();return t.createElement("tr",{"data-testid":"track-title-row"},t.createElement("th",{scope:"row",className:n.programNameCell},t.createElement("div",{className:n.programNameContent},t.createElement(E,{className:n.programNameTypography,variant:"h5",component:"p"},e.name))),r.map((l,o)=>typeof l!="string"?t.createElement("td",{key:o,"aria-hidden":!0}):t.createElement("td",{key:o,"data-testid":"track-certification-cell"},t.createElement("div",{className:n.badgeCellContent},t.createElement(ct,{entityRef:l,highestLevels:a})))))}),pt=k(({name:e})=>{const r=le();return t.createElement("div",{className:`${r.programNameCell} ${r.programNameCellVirtualized}`},t.createElement("div",{className:r.programNameContent},t.createElement(E,{className:r.programNameTypography,variant:"h5",component:"p"},e)))}),W=h(e=>{const r=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{root:{color:D(e.palette.getContrastText(r),.8),backgroundColor:r},levelContent:{padding:`${e.spacing(.5)}px ${e.spacing(2)}px`,backgroundColor:r},levelTypography:{overflow:"hidden",textOverflow:"ellipsis"},levelHeaderCell:{padding:`${e.spacing(.5)}px ${e.spacing(2)}px`,borderRight:`1px solid ${e.palette.divider}`,height:`${N.levelTitle}px`}}}),mt=k(({level:e,entityRefs:r,programName:a})=>{const n=W();return t.createElement("tr",{className:n.root,"data-testid":"track-level-row"},t.createElement("th",{scope:"row",className:n.root},t.createElement("div",{className:n.levelContent},t.createElement(E,{className:n.levelTypography,variant:"subtitle2",component:"p","aria-label":`${e.name} for ${a} track`},e.name))),r.map((l,o)=>t.createElement("td",{key:o,className:n.root,"aria-hidden":!0})))}),ut=({name:e})=>{const r=W();return t.createElement("div",{className:`${r.levelHeaderCell} ${r.root}`,"aria-label":`${e}`},t.createElement(E,{variant:"subtitle2",component:"p",className:r.levelTypography},e))},gt=()=>{const e=W();return t.createElement("div",{className:`${e.levelHeaderCell} ${e.root}`},"\xA0")},ht=({program:e,highestLevels:r,levels:a,entityRefs:n,entityRoute:l})=>t.createElement("tbody",null,t.createElement(dt,{program:e,entityRefs:n,highestLevels:r}),a.map((o,i)=>t.createElement(de,{key:i},t.createElement(mt,{entityRefs:n,level:o,programName:e.name}),o.checks.map(({check:c,results:s},d)=>t.createElement(lt,{key:d,check:c,programId:e.id,programName:e.name,entityRefs:n,results:s,entityRoute:l}))))),oe=h(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)"}})),ft=({entityRefs:e})=>{const r=F(B),a=oe();return t.createElement("tfoot",{className:a.root,"data-testid":"results-table-footer"},t.createElement("tr",{className:a.row},t.createElement("td",{className:a.cell}),e.map((n,l)=>{if(typeof n!="string")return t.createElement("th",{key:l,className:a.cell,"aria-hidden":!0});const o=$(n);return t.createElement("th",{scope:"col",key:l,className:a.cell},t.createElement("div",{className:a.cellInner},t.createElement(O,{to:r(o)},L(o,{defaultKind:o.kind}))))})))},yt=({entityRef:e})=>{const r=F(B),a=oe(),n=e?$(e):void 0,l=n?t.createElement(O,{to:r(n)},L(n,{defaultKind:n.kind})):t.createElement(t.Fragment,null);return t.createElement("div",{className:a.cell},t.createElement("div",{className:a.cellInner},l))},Et=h(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]}})),ie=()=>{const e=Et(),r=new Array(25).fill(void 0),a=new Array(5).fill(void 0),n=new Array(3).fill(void 0);return t.createElement("table",{className:e.table},t.createElement("tbody",null,t.createElement("tr",null,t.createElement("td",{className:e.programTitle},t.createElement(H,{width:180,height:40})),r.map((l,o)=>t.createElement("td",{key:o}))),n.map((l,o)=>t.createElement(t.Fragment,{key:o},t.createElement("tr",{className:e.header},t.createElement("td",{className:e.title},t.createElement(H,{width:180})),r.map((i,c)=>t.createElement("td",{key:c}))),a.map((i,c)=>t.createElement("tr",{key:c},t.createElement("td",{className:e.title},t.createElement(H,{width:240})),r.map((s,d)=>t.createElement("td",{key:d,className:e.checkResult},t.createElement(H,{width:18,height:18,variant:"rect"})))))))))},vt=h(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:1e3},"& tbody td:first-of-type":{border:`1px solid ${e.palette.divider}`,boxShadow:`1px 0 ${e.palette.background.default}, -1px 0 ${e.palette.background.default}`}}})),kt=k(e=>{const{setError:r,kind:a,type:n,ownerEntityRef:l}=e,o=vt(),i=F(B),{data:c,isLoading:s,isError:d}=Z(l,{kind:a,type:n});if(v(()=>{r==null||r(d?new Error("Error loading track overview"):void 0)},[d,r]),s)return t.createElement(ie,null);if(!c||!l)return null;const{programs:u,entityRefs:m}=c;if(!s&&!u.length)return t.createElement(ue,{missing:"data",title:"Missing tracks",description:t.createElement(t.Fragment,null,"Looks like the group"," ",L($(l),{defaultKind:"Group"})," ","doesn't own any ",n!=null?n:a," 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(O,{to:"https://www.npmjs.com/package/@spotify/backstage-plugin-soundcheck-backend#entity-filter"},"docs"),".")});if(d)return null;const p=m.length>=25?m:[...m,...Array.from({length:25-m.length},()=>{})];return t.createElement("div",{className:o.root},t.createElement("table",{className:o.table,"aria-label":"Check results"},u.map(({program:g,levels:y,highestLevels:f},x)=>t.createElement(ht,{key:x,program:g,entityRefs:p,levels:y,highestLevels:f,entityRoute:i})),t.createElement(ft,{entityRefs:p})))}),bt=e=>t.createElement(pt,{name:e}),Ct=e=>({type:"ProgramHeader",render:()=>bt(e)}),wt=e=>e?t.createElement(ut,{name:e}):t.createElement(gt,null),ce=e=>({type:"LevelHeader",render:()=>wt(e)}),Nt=(e,r)=>t.createElement(ot,{name:e,progress:r}),Rt=(e,r)=>({type:"CheckTitle",render:()=>Nt(e,r)}),$t=(e,r,a,n,l)=>t.createElement(te,{check:r,entityRef:a,entityRoute:l,programId:e,result:n,isVirtualized:!0}),xt=(e,r,a,n,l)=>({type:"CheckResult",render:()=>$t(e,r,a,n,l)}),Tt=e=>t.createElement(yt,{entityRef:e}),se=e=>({type:"EntityHeader",render:()=>Tt(e)}),Pt=e=>t.createElement(st,{highestLevel:e}),Lt=e=>({type:"LevelBadge",render:()=>Pt(e)}),It=e=>r=>{const a=e[r.rowIndex].cells[r.columnIndex];return a?t.createElement("div",{style:r.style},a.render()):t.createElement("div",{style:r.style})},St=(e,r,a)=>{var n;const l=[];for(const{program:i,levels:c,highestLevels:s}of e){l.push({height:N.programTitle,cells:[Ct(i.name),...r.map(d=>{const u=d?s.find(m=>m.entityRef===d)||nt(d):void 0;return Lt(u)})]});for(const d of c){l.push({height:N.levelTitle,cells:[ce(d.name),...r.map(u=>ce(""))]});for(const{check:u,results:m}of d.checks)l.push({height:N.check,cells:[Rt(u.name,Y(m.filter(({result:p})=>p!==w.NotApplicable),"result")),...r.map(p=>{var g,y;return xt(i.id,u,p,(y=(g=m.find(f=>f.entityRef===p))==null?void 0:g.result)!=null?y:w.NotApplicable,a)})]})}}const o=rt(r!=null?r:[]);return l.push({height:at((n=o.length)!=null?n:1),cells:[se(""),...r.map(i=>se(i||""))]}),l},Ot=h(e=>({table:{backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap",textAlign:"left",overflow:"auto"}})),Ft=e=>{const{setError:r,kind:a,type:n,ownerEntityRef:l}=e,o=Ot(),i=F(B),{data:c,isLoading:s,isError:d}=Z(l,{kind:a,type:n});if(v(()=>{r==null||r(d?new Error("Error loading program overview"):void 0)},[d,r]),s)return t.createElement(ie,null);if(!c||!l)return null;const{programs:u,entityRefs:m}=c,p=m.length>=25?m:[...m,...Array.from({length:25-m.length},()=>{})],g=St(u,p,i),y=It(g);return t.createElement(C,{"aria-label":`Check results for ${n!=null?n:a}`,key:`${a}|${n!=null?n:""}`,item:!0,xs:12},t.createElement(Se,{className:o.table,columnCount:p.length+1,columnWidth:f=>f===0?z.programTitle:z.checkResult,rowCount:g.length,rowHeight:f=>g[f].height,height:et(g),width:tt(p.length)},y))},At=({facets:e,ownerEntityRef:r,kind:a,type:n,setError:l})=>{const o=I(()=>{const i=new Map;return e.types.forEach(({kind:c,type:s})=>{const d=`${c}|${s!=null?s:""}`;i.set(d,t.createElement(Ft,{key:d,ownerEntityRef:r,kind:c,type:s,setError:l}))}),i},[e,r,l]);return t.createElement("div",null,o.get(`${a}|${n!=null?n:""}`))},Bt=h(()=>({scrollContainer:{overflow:"auto"}})),Ht=({facets:e,ownerEntityRef:r,hasError:a,kind:n,type:l,setError:o,useVirtualizedResultsTable:i})=>{var c,s;const d=Bt();return a?t.createElement($e,{severity:"error",title:a.message}):e&&((s=(c=e.types)==null?void 0:c.length)!=null?s:0)>0?t.createElement("div",{className:d.scrollContainer},i?t.createElement(At,{facets:e,kind:n,type:l,setError:o,ownerEntityRef:r,hasError:a}):t.createElement(kt,{ownerEntityRef:r,kind:n,type:l,setError:o})):t.createElement(xe,{ownerEntityRef:r})},zt=h(e=>({tableContainer:{padding:e.spacing(3),backgroundColor:"transparent"}})),Wt=({groupSelectorError:e,searchParams:r,setSearchParams:a})=>{var n;const{group:l,kind:o,type:i}=r,[c,s]=P(void 0),[d,u]=P(void 0);v(()=>{((c==null?void 0:c.kind)!==o||(c==null?void 0:c.type)!==i)&&s({kind:o,type:i})},[o,i,c]);const{data:m,isLoading:p}=Be(l),g=(n=b(j).getOptionalBoolean("soundcheck.virtualizeOverviewPage"))!=null?n:!1,y=d||e,f=(R,T)=>{R&&(s({kind:R,type:T}),T?a({...r,kind:R,type:T}):(r!=null&&r.hasOwnProperty("type")&&delete r.type,a({...r,kind:R})))},x=zt();return t.createElement(C,{container:!0,spacing:0},t.createElement(C,{item:!0,xs:12},p?t.createElement(De,null):t.createElement(_e,{unfilteredFacets:m,kind:c==null?void 0:c.kind,type:c==null?void 0:c.type,onChange:f})),t.createElement(C,{item:!0,xs:12,className:x.tableContainer},!p&&t.createElement(Ht,{facets:m,kind:c==null?void 0:c.kind,type:c==null?void 0:c.type,setError:u,hasError:y,ownerEntityRef:l,useVirtualizedResultsTable:g})))},Vt=h(e=>({checkersPageContainer:{padding:e.spacing(3)}})),Gt=({})=>{const e=Vt(),r=()=>{window.open("/soundcheck/checks","_self")};return t.createElement(t.Fragment,null,t.createElement("div",{className:e.checkersPageContainer},"Hello"),t.createElement(_,{variant:"contained",color:"primary",onClick:r},"Checker List"))},Mt=h(e=>({programsPageContainer:{padding:e.spacing(3)}})),jt=({})=>{const e=Mt(),r=()=>{window.open("/soundcheck/tracks","_self")};return t.createElement(t.Fragment,null,t.createElement("div",{className:e.programsPageContainer},"Hello"),";",t.createElement(_,{variant:"contained",color:"primary",onClick:r},"Track List"))},Dt=e=>{var r;const{title:a="Soundcheck"}=e,[n,l]=ze(),{group:o}=n,[i,c]=P(void 0),s=(r=b(j).getOptionalBoolean("soundcheck.noCodeUI"))!=null?r:!1;return t.createElement(Te,null,t.createElement(Pe,null,t.createElement(ge,{themeId:"website"},t.createElement(Ee,{backend:"soundcheck",invalidLicenseMessage:"Submitted check results will still be stored, but it will not be possible to view certifications or individual results until a valid license is present."}),t.createElement(he,{title:a},t.createElement(Ge,{onChange:d=>{d&&l({...n,group:d})},initialValue:o,setError:c})),t.createElement(fe,{noPadding:!0,stretch:!0},t.createElement(Le,null,t.createElement(me,null,t.createElement(S,{path:"/*",element:t.createElement(Wt,{groupSelectorError:i,searchParams:n,setSearchParams:l})}),s&&t.createElement(t.Fragment,null,t.createElement(S,{path:"/checks/:checkId",element:t.createElement(Oe,null,t.createElement(Gt,null))}),t.createElement(S,{path:"/tracks/:trackId",element:t.createElement(Fe,null,t.createElement(jt,null))}),t.createElement(S,{path:"/fact-collectors",element:t.createElement(Me,null)}))))))))};export{Dt as OverviewPage};
|
|
2
|
+
//# sourceMappingURL=index-92271e48.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"react";import{S as o,f as i}from"./index-
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import t from"react";import{S as o,f as i}from"./index-40aa00c1.esm.js";import"@backstage/core-plugin-api";import"graphql-request";import"graphql-tag";import"@tanstack/react-query";import"lodash";import"@material-ui/core/styles/makeStyles";import"@material-ui/core";import"@backstage/core-components";import"@backstage/plugin-catalog-react";import"@spotify/backstage-plugin-core";import"@backstage/catalog-model";import"@material-ui/lab";import"react-router-dom";import"classnames";import"@material-ui/icons/Schedule";import"luxon";import"@material-ui/icons/Check";import"@material-ui/icons/Close";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/HelpOutline";const m=({title:r})=>t.createElement(o,null,t.createElement(i,{title:r}));export{m as EntitySoundcheckCard};
|
|
2
|
+
//# sourceMappingURL=index-b3600988.esm.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -37,14 +38,14 @@ declare const soundcheckPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
|
37
38
|
* Provides an EntityPage tab containing Soundcheck content relevant for the
|
|
38
39
|
* current entity. Expected to be used within {@link @backstage/plugin-catalog#EntityLayout}.
|
|
39
40
|
*/
|
|
40
|
-
declare const EntitySoundcheckContent: () => JSX.Element;
|
|
41
|
+
declare const EntitySoundcheckContent: () => React.JSX.Element;
|
|
41
42
|
/**
|
|
42
43
|
* @public
|
|
43
44
|
*
|
|
44
45
|
* Provides Card to be used on the EntityPage inside the Catalog Plugin.
|
|
45
46
|
* Must be used within {@link @backstage/plugin-catalog#EntityLayout}.
|
|
46
47
|
*/
|
|
47
|
-
declare const EntitySoundcheckCard: ({ title }: EntitySoundcheckCardProps) => JSX.Element;
|
|
48
|
+
declare const EntitySoundcheckCard: ({ title }: EntitySoundcheckCardProps) => React.JSX.Element;
|
|
48
49
|
/**
|
|
49
50
|
* @public
|
|
50
51
|
*
|
|
@@ -52,5 +53,11 @@ declare const EntitySoundcheckCard: ({ title }: EntitySoundcheckCardProps) => JS
|
|
|
52
53
|
* of your Certifications throughout different groups in your Organization.
|
|
53
54
|
*/
|
|
54
55
|
declare const SoundcheckOverviewPage: (props: OverviewPageProps) => JSX.Element;
|
|
56
|
+
/**
|
|
57
|
+
* @public
|
|
58
|
+
*
|
|
59
|
+
* Provides the /soundcheck route on your Backstage instance
|
|
60
|
+
*/
|
|
61
|
+
declare const SoundcheckRoutingPage: (props: OverviewPageProps) => JSX.Element;
|
|
55
62
|
|
|
56
|
-
export { EntitySoundcheckCard, EntitySoundcheckCardProps, EntitySoundcheckContent, OverviewPageProps, SoundcheckOverviewPage, soundcheckPlugin };
|
|
63
|
+
export { EntitySoundcheckCard, EntitySoundcheckCardProps, EntitySoundcheckContent, OverviewPageProps, SoundcheckOverviewPage, SoundcheckRoutingPage, soundcheckPlugin };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{l as f,E as w,m as x,n as O,k as R}from"./esm/index-40aa00c1.esm.js";import"react";import"@backstage/core-plugin-api";import"graphql-request";import"graphql-tag";import"@tanstack/react-query";import"lodash";import"@material-ui/core/styles/makeStyles";import"@material-ui/core";import"@backstage/core-components";import"@backstage/plugin-catalog-react";import"@spotify/backstage-plugin-core";import"@backstage/catalog-model";import"@material-ui/lab";import"react-router-dom";import"classnames";import"@material-ui/icons/Schedule";import"luxon";import"@material-ui/icons/Check";import"@material-ui/icons/Close";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/HelpOutline";export{f as EntitySoundcheckCard,w as EntitySoundcheckContent,x as SoundcheckOverviewPage,O as SoundcheckRoutingPage,R as soundcheckPlugin};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
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.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://backstage.spotify.com/",
|
|
7
7
|
"main": "dist/index.esm.js",
|
|
@@ -26,47 +26,51 @@
|
|
|
26
26
|
"prepare": "yarn generate"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@backstage/catalog-model": "^1.
|
|
30
|
-
"@backstage/core-components": "^0.13.
|
|
31
|
-
"@backstage/core-plugin-api": "^1.5.
|
|
32
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
33
|
-
"@backstage/theme": "^0.
|
|
34
|
-
"@backstage/types": "^1.0
|
|
29
|
+
"@backstage/catalog-model": "^1.4.0",
|
|
30
|
+
"@backstage/core-components": "^0.13.2",
|
|
31
|
+
"@backstage/core-plugin-api": "^1.5.2",
|
|
32
|
+
"@backstage/plugin-catalog-react": "^1.7.0",
|
|
33
|
+
"@backstage/theme": "^0.4.0",
|
|
34
|
+
"@backstage/types": "^1.1.0",
|
|
35
35
|
"@material-ui/core": "^4.12.2",
|
|
36
36
|
"@material-ui/icons": "^4.9.1",
|
|
37
37
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
38
|
-
"@spotify/backstage-plugin-core": "^0.5.
|
|
38
|
+
"@spotify/backstage-plugin-core": "^0.5.3",
|
|
39
39
|
"@tanstack/react-query": "^4.6.1",
|
|
40
40
|
"classnames": "^2.3.2",
|
|
41
|
-
"graphql-request": "
|
|
41
|
+
"graphql-request": "6.1.0",
|
|
42
42
|
"lodash": "^4.17.21",
|
|
43
43
|
"luxon": "^3.1.1",
|
|
44
44
|
"react-confetti": "^6.1.0",
|
|
45
|
+
"react-dnd": "^16.0.1",
|
|
46
|
+
"react-dnd-html5-backend": "^16.0.1",
|
|
47
|
+
"react-hook-form": "^7.19.5",
|
|
45
48
|
"react-use": "^17.2.4",
|
|
46
|
-
"react-window": "^1.8.8"
|
|
49
|
+
"react-window": "^1.8.8",
|
|
50
|
+
"uuid": "^9.0.0"
|
|
47
51
|
},
|
|
48
52
|
"peerDependencies": {
|
|
49
53
|
"react": "^16.13.1 || ^17.0.0",
|
|
50
54
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
51
55
|
},
|
|
52
56
|
"devDependencies": {
|
|
53
|
-
"@backstage/cli": "^0.22.
|
|
54
|
-
"@backstage/core-app-api": "^1.
|
|
55
|
-
"@backstage/dev-utils": "^1.0.
|
|
56
|
-
"@backstage/test-utils": "^1.
|
|
57
|
-
"@graphql-codegen/cli": "^
|
|
58
|
-
"@graphql-codegen/typescript": "^
|
|
59
|
-
"@graphql-codegen/typescript-graphql-request": "^
|
|
60
|
-
"@graphql-codegen/typescript-operations": "^
|
|
61
|
-
"@spotify/backstage-plugin-core-common": "^0.5.
|
|
62
|
-
"@spotify/backstage-plugin-soundcheck-common": "^0.
|
|
57
|
+
"@backstage/cli": "^0.22.8",
|
|
58
|
+
"@backstage/core-app-api": "^1.8.1",
|
|
59
|
+
"@backstage/dev-utils": "^1.0.16",
|
|
60
|
+
"@backstage/test-utils": "^1.4.0",
|
|
61
|
+
"@graphql-codegen/cli": "^4.0.0",
|
|
62
|
+
"@graphql-codegen/typescript": "^4.0.0",
|
|
63
|
+
"@graphql-codegen/typescript-graphql-request": "^5.0.0",
|
|
64
|
+
"@graphql-codegen/typescript-operations": "^4.0.0",
|
|
65
|
+
"@spotify/backstage-plugin-core-common": "^0.5.3",
|
|
66
|
+
"@spotify/backstage-plugin-soundcheck-common": "^0.6.0",
|
|
63
67
|
"@testing-library/jest-dom": "^5.10.1",
|
|
64
68
|
"@testing-library/react": "^12.1.5",
|
|
65
69
|
"@testing-library/react-hooks": "^8.0.1",
|
|
66
70
|
"@testing-library/user-event": "^14.0.0",
|
|
67
71
|
"@types/jest": "^29.4.0",
|
|
68
72
|
"@types/luxon": "^3.0.1",
|
|
69
|
-
"@types/node": "^
|
|
73
|
+
"@types/node": "^18.0.0",
|
|
70
74
|
"@types/react-window": "^1.8.5",
|
|
71
75
|
"cross-fetch": "^3.1.5",
|
|
72
76
|
"msw": "^1.0.0"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import e,{useState as W,useEffect as M}from"react";import{Link as O,useParams as Q,Routes as j,Route as k,Navigate as I}from"react-router-dom";import{makeStyles as p,Typography as f,Box as U,Tab as L,Tabs as T,Paper as V,Divider as Y}from"@material-ui/core";import{SpotifyLicenseBanner as q}from"@spotify/backstage-plugin-core";import{useEntity as u}from"@backstage/plugin-catalog-react";import{R as G}from"./RefetchingIndicator-96188300.esm.js";import{s as H,R as c,A as y,F as P,a as J,u as x,L as K,N as X,b,c as g,d as Z,C as _,e as B,S as ee}from"./index-5d64d93c.esm.js";import{Skeleton as s}from"@material-ui/lab";import{MarkdownContent as F}from"@backstage/core-components";import{stringifyEntityRef as te}from"@backstage/catalog-model";import{useApi as ae,useRouteRef as C,useRouteRefParams as re}from"@backstage/core-plugin-api";import{useQuery as ne}from"@tanstack/react-query";import ie from"react-use/lib/useMeasure";import $ from"react-use/lib/usePrevious";import le from"react-confetti";import"react-use/lib/useDebounce";import"graphql-request";import"graphql-tag";import"lodash";import"@material-ui/core/styles/makeStyles";import"classnames";import"@material-ui/icons/Schedule";import"luxon";import"@material-ui/icons/Check";import"@material-ui/icons/Close";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/HelpOutline";function oe(t,r,a){const n=ae(H),i=te(t);return ne(["soundcheck/check-details",i,r,a],async()=>n.getCheckResultDetails(i,r,a),{enabled:!!r&&!!a})}const ce=p({markdownContent:{"& :last-child":{marginBottom:0}}}),se=({state:t,notes:r})=>{const a=ce(),n={[c.Passed]:"success",[c.Failed]:"error",[c.NotReported]:"info",[c.NotApplicable]:"info"}[t],i={[c.Passed]:"Check passed",[c.Failed]:"Check did not pass",[c.NotReported]:"Check not reported",[c.NotApplicable]:"Check not applicable"}[t];return e.createElement(y,{severity:n,title:i},r?e.createElement(F,{className:a.markdownContent,content:r}):null)},me=()=>{const t=A();return e.createElement(P,null,e.createElement("div",{className:t.root,"data-testid":"check-details-view"},e.createElement("div",{className:t.topBar},e.createElement(f,{variant:"h2",className:t.title},e.createElement(s,{width:300,height:32})),e.createElement(s,{width:100,height:32})),e.createElement(s,{variant:"rect",height:120}),e.createElement("div",{"data-testid":"soundcheck-check-details-description"},e.createElement(f,{variant:"h3"},e.createElement(s,null)),e.createElement(s,null),e.createElement(s,null),e.createElement(s,null))))},A=p(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)}})),de=({programId:t,checkId:r})=>{const a=A(),{entity:n}=u(),{data:i,isLoading:l,isError:o}=oe(n,t,r);if(o)return e.createElement(U,{padding:2},e.createElement(y,{severity:"error",title:"Error loading check details"}));if(l||!t||!r)return e.createElement(me,null);if(!i)return null;const{name:h,description:d,result:v,timestamp:m,notes:E}=i;return e.createElement("div",{className:a.root,"data-testid":"check-details-view"},e.createElement("div",{className:a.topBar},e.createElement(f,{variant:"h2",className:a.title},h),m?e.createElement(J,{timestamp:m,description:"Last updated"}):null),e.createElement(se,{state:v,notes:E}),e.createElement("div",{className:a.description,"data-testid":"soundcheck-check-details-description"},e.createElement(f,{variant:"h3",className:a.subtitle},"Description"),e.createElement(F,{content:d})))},pe=p(()=>({root:{position:"absolute",width:"100%",height:"100%"}})),ue=({programId:t})=>{var r,a;const n=pe(),{entity:i}=u(),{data:l,isLoading:o}=x(i,t),[h,{width:d,height:v}]=ie(),m=o?void 0:(a=(r=l==null?void 0:l.highestLevel)==null?void 0:r.ordinal)!=null?a:-1,E=$(m),R=$(t),[z,S]=W(!1);return M(()=>{typeof E!="undefined"&&typeof m!="undefined"&&t===R&&m>E&&S(!0)},[m,E,t,R]),z?e.createElement("div",{ref:h,className:n.root},e.createElement(le,{width:d,height:v,numberOfPieces:1e3,gravity:1,initialVelocityY:20,recycle:!1,onConfettiComplete:()=>S(!1)})):null},D=p(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)}})),he=({id:t,name:r,badge:a,href:n,selected:i=!1})=>{const l=D();return e.createElement(L,{className:l.root,classes:{wrapper:l.wrapper},value:t,label:e.createElement(e.Fragment,null,a?e.createElement(K,{badge:a,className:l.badge}):e.createElement(X,{className:l.badge}),r),component:O,to:n,selected:i})},w=()=>{const t=D();return e.createElement(L,{className:t.root,classes:{wrapper:t.wrapper},label:e.createElement(s,{width:180})})},Ee=()=>e.createElement(P,null,e.createElement(T,{value:!1,indicatorColor:"primary"},e.createElement(w,null),e.createElement(w,null),e.createElement(w,null)));function fe(t=[],r){const a=t.findIndex(n=>n.program.id===r);return a<0?!1:a}const ge=({programId:t})=>{const{entity:r}=u(),{isLoading:a,data:n}=b(r),i=C(g);if(a||!t)return e.createElement(Ee,null);const l=fe(n,t);return e.createElement(T,{value:l,indicatorColor:"primary","aria-label":"Certifications",variant:"scrollable"},n&&n.map(({program:{id:o,name:h},highestLevel:d})=>e.createElement(he,{key:o,id:o,name:h,badge:d==null?void 0:d.badge,selected:o===t,href:i({programId:o})})))},ve=p({paper:{overflow:"hidden",position:"relative"},view:{display:"grid",gridTemplateColumns:"1fr 2fr"}}),ke=()=>{const{programId:t,checkId:r}=Q(),a=ve(),{entity:n}=u(),{isError:i,isFetched:l,data:o}=b(n);return i?e.createElement(y,{severity:"error",title:"Error loading certifications"}):l&&!(o!=null&&o.length)?e.createElement(Z,null):e.createElement(V,{className:a.paper},e.createElement(G,null),e.createElement(ge,{programId:t}),e.createElement(Y,null),e.createElement("div",{"data-testid":"soundcheck-certification-view",className:a.view},e.createElement(_,{programId:t,checkId:r}),e.createElement(de,{programId:t,checkId:r}),e.createElement(ue,{programId:t})))},ye=p(t=>({root:{"&:not(:first-child)":{marginTop:t.spacing(2)}}})),N=()=>{const t=ye();return e.createElement(e.Fragment,null,e.createElement(q,{backend:"soundcheck",invalidLicenseMessage:"Submitted check results will still be stored, but it will not be possible to view certifications or individual results until a valid license is present.",inline:!0}),e.createElement("div",{className:t.root},e.createElement(ke,null)))},be=()=>{var t;const{entity:r}=u(),a=C(g),{data:n}=b(r),i=(t=n==null?void 0:n[0])==null?void 0:t.program.id;return i?e.createElement(I,{to:a({programId:i}),replace:!0}):null},Ce=()=>{var t,r;const{entity:a}=u(),{programId:n}=re(g),i=C(B),{data:l}=x(a,n),o=(r=(t=l==null?void 0:l.levels[0])==null?void 0:t.checks[0])==null?void 0:r.id;return o?e.createElement(I,{to:i({programId:n,checkId:o}),replace:!0}):null},we=()=>e.createElement(j,null,e.createElement(k,{path:"/",element:e.createElement(e.Fragment,null,e.createElement(N,null),e.createElement(be,null))}),e.createElement(k,{path:g.path,element:e.createElement(e.Fragment,null,e.createElement(N,null),e.createElement(Ce,null))}),e.createElement(k,{path:B.path,element:e.createElement(N,null)})),Ne=()=>e.createElement(ee,null,e.createElement(we,null));export{Ne as EntitySoundcheckContent};
|
|
2
|
-
//# sourceMappingURL=EntitySoundcheckContent-d0819302.esm.js.map
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import{createApiRef as he,createRouteRef as M,createSubRouteRef as W,createPlugin as fe,createApiFactory as ye,discoveryApiRef as ve,fetchApiRef as Ee,createRoutableExtension as G,createComponentExtension as ke,useApi as I,errorApiRef as Ce,useRouteRef as U}from"@backstage/core-plugin-api";import{GraphQLClient as Re}from"graphql-request";import m from"graphql-tag";import t,{useState as we,useEffect as be,Fragment as Se}from"react";import{QueryClient as $e,QueryClientProvider as Ne,useQuery as H}from"@tanstack/react-query";import{memoize as Le}from"lodash";import Fe from"@material-ui/core/styles/makeStyles";import{makeStyles as d,Typography as c,Fade as Ie,alpha as v,Tooltip as De,withStyles as k,Box as Ae,Divider as Oe}from"@material-ui/core";import{MarkdownContent as j,Link as Q,EmptyState as V,InfoCard as xe}from"@backstage/core-components";import{useEntity as _,humanizeEntityRef as Te}from"@backstage/plugin-catalog-react";import{useAutoUpdatingRelativeTime as Pe,SpotifyLicenseBanner as ze}from"@spotify/backstage-plugin-core";import{stringifyEntityRef as K,parseEntityRef as Be}from"@backstage/catalog-model";import{Link as qe}from"react-router-dom";import{Skeleton as u,Alert as Me}from"@material-ui/lab";import C from"classnames";import We from"@material-ui/icons/Schedule";import{DateTime as J}from"luxon";import Ge from"@material-ui/icons/Check";import Ue from"@material-ui/icons/Close";import He from"@material-ui/icons/RemoveCircleOutline";import je from"@material-ui/icons/HelpOutline";var X=(e=>(e.Medal="MEDAL",e))(X||{}),p=(e=>(e.Failed="FAILED",e.NotApplicable="NOT_APPLICABLE",e.NotReported="NOT_REPORTED",e.Passed="PASSED",e))(p||{});const Qe=m`
|
|
2
|
-
fragment CertificationSummary on Certification {
|
|
3
|
-
entityRef
|
|
4
|
-
program {
|
|
5
|
-
id
|
|
6
|
-
name
|
|
7
|
-
}
|
|
8
|
-
highestLevel {
|
|
9
|
-
ordinal
|
|
10
|
-
name
|
|
11
|
-
description
|
|
12
|
-
badge {
|
|
13
|
-
... on BadgeVariantMedal {
|
|
14
|
-
variant
|
|
15
|
-
options {
|
|
16
|
-
level
|
|
17
|
-
color
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
`,Ve=m`
|
|
24
|
-
fragment CheckResultSummary on CheckResult {
|
|
25
|
-
id
|
|
26
|
-
name
|
|
27
|
-
result
|
|
28
|
-
timestamp
|
|
29
|
-
}
|
|
30
|
-
`,_e=m`
|
|
31
|
-
fragment LevelResultDetails on LevelResult {
|
|
32
|
-
ordinal
|
|
33
|
-
name
|
|
34
|
-
description
|
|
35
|
-
badge {
|
|
36
|
-
... on BadgeVariantMedal {
|
|
37
|
-
variant
|
|
38
|
-
options {
|
|
39
|
-
level
|
|
40
|
-
color
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
certified
|
|
45
|
-
checks {
|
|
46
|
-
...CheckResultSummary
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
${Ve}`,Ke=m`
|
|
50
|
-
fragment CheckResultDetails on CheckResult {
|
|
51
|
-
id
|
|
52
|
-
name
|
|
53
|
-
description
|
|
54
|
-
result
|
|
55
|
-
timestamp
|
|
56
|
-
notes
|
|
57
|
-
}
|
|
58
|
-
`,Je=m`
|
|
59
|
-
fragment OverviewLevelResult on OverviewLevelResult {
|
|
60
|
-
ordinal
|
|
61
|
-
name
|
|
62
|
-
checks {
|
|
63
|
-
check {
|
|
64
|
-
id
|
|
65
|
-
name
|
|
66
|
-
description
|
|
67
|
-
}
|
|
68
|
-
results {
|
|
69
|
-
id
|
|
70
|
-
entityRef
|
|
71
|
-
result
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
`,Y=m`
|
|
76
|
-
fragment HighestLevel on LevelResult {
|
|
77
|
-
entityRef
|
|
78
|
-
ordinal
|
|
79
|
-
name
|
|
80
|
-
badge {
|
|
81
|
-
... on BadgeVariantMedal {
|
|
82
|
-
variant
|
|
83
|
-
options {
|
|
84
|
-
color
|
|
85
|
-
level
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
`,Xe=m`
|
|
91
|
-
query getAllCertifications($entityRef: String!) {
|
|
92
|
-
certifications(entityRef: $entityRef, includeFilteredChecks: false) {
|
|
93
|
-
...CertificationSummary
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
${Qe}`,Ye=m`
|
|
97
|
-
query getCertificationDetails($entityRef: String!, $programId: String!) {
|
|
98
|
-
programCertification(
|
|
99
|
-
entityRef: $entityRef
|
|
100
|
-
programId: $programId
|
|
101
|
-
includeFilteredChecks: false
|
|
102
|
-
) {
|
|
103
|
-
program {
|
|
104
|
-
id
|
|
105
|
-
name
|
|
106
|
-
description
|
|
107
|
-
documentationURL
|
|
108
|
-
}
|
|
109
|
-
highestLevel {
|
|
110
|
-
...HighestLevel
|
|
111
|
-
}
|
|
112
|
-
levels {
|
|
113
|
-
...LevelResultDetails
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
${Y}
|
|
118
|
-
${_e}`,Ze=m`
|
|
119
|
-
query getCheckResultDetails($entityRef: String!, $programId: String!, $checkId: String!) {
|
|
120
|
-
checkResult(entityRef: $entityRef, programId: $programId, checkId: $checkId) {
|
|
121
|
-
...CheckResultDetails
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
${Ke}`,et=m`
|
|
125
|
-
query getFacetsForOwner($ownerEntityRef: String!) {
|
|
126
|
-
facetsForOwner(ownerEntityRef: $ownerEntityRef) {
|
|
127
|
-
types {
|
|
128
|
-
value
|
|
129
|
-
count
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
`,tt=m`
|
|
134
|
-
query getProgramOverviewForOwner($ownerEntityRef: String!, $facet: FacetInput) {
|
|
135
|
-
programOverviewForOwner(
|
|
136
|
-
ownerEntityRef: $ownerEntityRef
|
|
137
|
-
facet: $facet
|
|
138
|
-
includeFilteredChecks: false
|
|
139
|
-
) {
|
|
140
|
-
programs {
|
|
141
|
-
program {
|
|
142
|
-
id
|
|
143
|
-
name
|
|
144
|
-
}
|
|
145
|
-
highestLevels {
|
|
146
|
-
...HighestLevel
|
|
147
|
-
}
|
|
148
|
-
levels {
|
|
149
|
-
...OverviewLevelResult
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
entityRefs
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
${Y}
|
|
156
|
-
${Je}`,rt=(e,r,a)=>e();function at(e,r=rt){return{getAllCertifications(a,n){return r(i=>e.request(Xe,a,{...n,...i}),"getAllCertifications","query")},getCertificationDetails(a,n){return r(i=>e.request(Ye,a,{...n,...i}),"getCertificationDetails","query")},getCheckResultDetails(a,n){return r(i=>e.request(Ze,a,{...n,...i}),"getCheckResultDetails","query")},getFacetsForOwner(a,n){return r(i=>e.request(et,a,{...n,...i}),"getFacetsForOwner","query")},getProgramOverviewForOwner(a,n){return r(i=>e.request(tt,a,{...n,...i}),"getProgramOverviewForOwner","query")}}}var Z=(e,r,a)=>{if(!r.has(e))throw TypeError("Cannot "+a)},s=(e,r,a)=>(Z(e,r,"read from private field"),a?a.call(e):r.get(e)),E=(e,r,a)=>{if(r.has(e))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(e):r.set(e,a)},D=(e,r,a,n)=>(Z(e,r,"write to private field"),n?n.call(e,a):r.set(e,a),a),R,w,h,A,f;const b=he({id:"plugin.soundcheck"}),nt=e=>"response"in e&&"errors"in e.response,it=e=>"response"in e&&"message"in e.response;class ot{constructor(r){E(this,R,void 0),E(this,w,void 0),E(this,h,void 0),E(this,A,n=>{var i,o,l;return nt(n)?(l=(o=(i=n.response)==null?void 0:i.errors)==null?void 0:o[0].message)!=null?l:`${n}`:it(n)?n.response.message:`${n}`}),E(this,f,async n=>{try{return await n()}catch(i){throw new Error(`Error from Soundcheck backend: ${s(this,A).call(this,i)}`)}}),D(this,R,r.fetchApi),D(this,w,r.discoveryApi);const a=new Re("/graphql",{fetch:async(n,i)=>{const o=`${await s(this,w).getBaseUrl("soundcheck")}${n}`;return s(this,R).fetch(o,i)}});D(this,h,at(a))}async getAllCertifications(r){return s(this,f).call(this,async()=>{const{certifications:a}=await s(this,h).getAllCertifications({entityRef:r});return a})}async getCertificationDetails(r,a){return s(this,f).call(this,async()=>{const{programCertification:n}=await s(this,h).getCertificationDetails({entityRef:r,programId:a});return n})}async getCheckResultDetails(r,a,n){return s(this,f).call(this,async()=>{const{checkResult:i}=await s(this,h).getCheckResultDetails({entityRef:r,programId:a,checkId:n});return i})}async getFacetsForOwner(r){return s(this,f).call(this,async()=>{const{facetsForOwner:a}=await s(this,h).getFacetsForOwner({ownerEntityRef:r});return a})}async getProgramOverviewForOwner(r,a){return s(this,f).call(this,async()=>{const{programOverviewForOwner:n}=await s(this,h).getProgramOverviewForOwner({ownerEntityRef:r,facet:a});return n})}}R=new WeakMap,w=new WeakMap,h=new WeakMap,A=new WeakMap,f=new WeakMap;const S=M({id:"soundcheck-entity"}),ee=W({id:"soundcheck-entity-certification-program-redirect",parent:S,path:"/:programId"}),te=W({id:"soundcheck-entity-certification",parent:S,path:"/:programId/:checkId"}),lt=M({id:"soundcheck-overview"}),$=fe({id:"soundcheck",apis:[ye({api:b,deps:{discoveryApi:ve,fetchApi:Ee},factory:e=>new ot(e)})],routes:{entityContent:S}}),ct=$.provide(G({name:"EntitySoundcheckContent",component:()=>import("./EntitySoundcheckContent-d0819302.esm.js").then(e=>e.EntitySoundcheckContent),mountPoint:S})),st=$.provide(ke({name:"EntitySoundcheckCard",component:{lazy:()=>import("./index-9d77be51.esm.js").then(e=>e.EntitySoundcheckCard)}})),mt=$.provide(G({name:"SoundcheckOverviewPage",component:()=>import("./index-808077a4.esm.js").then(e=>e.overviewPage),mountPoint:lt})),dt=Le(e=>new $e({defaultOptions:{queries:{refetchInterval:6e4,refetchIntervalInBackground:!1,refetchOnWindowFocus:"always",retry:2,retryDelay:r=>{const a=450+Math.ceil(Math.random()*100);return Math.min(a*2**r,3e4)},onError:r=>e.post(r)}}})),pt=e=>{const r=I(Ce),a=dt(r);return t.createElement(Ne,{client:a},e.children)};function re(e){const r=I(b),a=K(e);return H(["soundcheck/certifications",a],async()=>r.getAllCertifications(a))}function ae(e,r){const a=I(b),n=K(e);return H(["soundcheck/certifications",n,r],async()=>a.getCertificationDetails(n,r),{enabled:!!r})}const ne=24,ut=11,O=e=>e==="small"?1:2,gt=d({root:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",borderWidth:"2px",fontWeight:700,width:({size:e})=>`${ne*O(e)}px`,height:({size:e})=>`${ne*O(e)}px`,fontSize:({size:e})=>`${ut*O(e)}px`}}),ie=({className:e,label:r,size:a="small"})=>{const n=gt({size:a});return t.createElement("span",{className:C(e,n.root),role:"img","aria-label":`${r} badge`},r)},ht=d(e=>({root:{background:({color:r})=>r,color:({color:r})=>e.palette.getContrastText(r),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(",")}}})),x=({className:e,badge:r,size:a="small"})=>{const n=ht({color:r.options.color,size:a});return t.createElement(ie,{className:C(e,n.root),size:a,label:`L${r.options.level}`})},ft=d({root:{borderColor:"currentColor",borderStyle:"dashed"}}),oe=({className:e,size:r="small"})=>{const a=ft();return t.createElement(ie,{className:C(e,a.root),size:r,label:"NL"})},T=d(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)},level:{textTransform:"uppercase",color:e.palette.text.secondary,fontWeight:700,letterSpacing:"1px"}}));function yt({description:e,documentationUrl:r}){const a=T();return r?t.createElement("div",{className:a.description},t.createElement(j,{content:e}),t.createElement(Q,{to:r},"Learn more")):t.createElement("div",{className:a.description},t.createElement(j,{content:e}))}const le=({name:e,level:r,badge:a,description:n,documentationUrl:i})=>{const o=T();return t.createElement("div",{className:o.root},a?t.createElement(x,{size:"large",badge:a}):t.createElement(oe,{size:"large"}),t.createElement("div",null,t.createElement(c,{variant:"caption",className:o.level},r!=null?r:"No Level"),t.createElement(c,{variant:"h4",className:o.title},e),n&&t.createElement(yt,{description:n,documentationUrl:i})))},N=({children:e})=>{const[r,a]=we(!1);return be(()=>{const n=setTimeout(()=>{a(!0)},250);return()=>clearTimeout(n)},[]),t.createElement(Ie,{in:r,timeout:250},e)},P=({hideDescription:e=!1})=>{const r=T();return t.createElement(N,null,t.createElement("div",{className:r.root},t.createElement(u,{width:44,height:44}),t.createElement("div",null,t.createElement(c,{variant:"caption",className:r.level},t.createElement(u,{width:100})),t.createElement(c,{variant:"h4",className:r.title},t.createElement(u,{width:300})),!e&&t.createElement(c,{variant:"body2"},t.createElement(u,null)))))},ce=d(e=>{const r=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{wrapper:{backgroundColor:r,color:v(e.palette.getContrastText(r),.7),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:a})=>[`"${a?"badge":"title"} title"`,`"${a?".":"description"} description"`].join(" "),gridTemplateColumns:"auto 1fr"},title:{gridArea:"title",textTransform:"uppercase",fontWeight:"bold",color:v(e.palette.getContrastText(r),.7),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:v(e.palette.getContrastText(r),.7),fontSize:e.typography.subtitle2.fontSize,marginTop:e.spacing(1)}}}),vt=e=>{const r=ce({badge:e.badge});return t.createElement("div",{className:r.wrapper},e.badge?t.createElement(x,{className:r.badge,badge:e.badge}):null,t.createElement(c,{className:r.title},e.title),e.description?t.createElement(c,{className:r.description},e.description):null)},Et=()=>{const e=ce({});return t.createElement(N,null,t.createElement("div",{className:e.wrapper},t.createElement(u,{className:e.title}),t.createElement(c,{className:e.description},t.createElement(u,null))))},kt=d(e=>({root:{display:"inline-flex",alignItems:"center",gap:e.spacing(1)}})),se=({timestamp:e,description:r})=>{const a=kt(),n=J.fromISO(e).toLocaleString(J.DATETIME_FULL),i=Pe(e),o=r?`${r}: ${i}`:void 0;return t.createElement("div",{className:a.root},t.createElement(De,{title:n},t.createElement(c,{variant:"caption","aria-label":o},i)),t.createElement(We,null))},Ct=e=>({[p.Passed]:"Check passed",[p.NotReported]:"Check not reported",[p.Failed]:"Check failed",[p.NotApplicable]:"Check not applicable"})[e],Rt=k(e=>({root:{color:e.palette.success.main}}))(Ge),wt=k(e=>({root:{color:e.palette.error.main}}))(Ue),bt=k(e=>({root:{color:e.palette.info.main}}))(je),St=k(e=>({root:{color:e.palette.text.disabled}}))(He),me=({result:e,className:r})=>{const a={className:r,"aria-label":Ct(e),"aria-hidden":!1};return e===p.Passed?t.createElement(Rt,{...a}):e===p.NotReported?t.createElement(bt,{...a}):e===p.Failed?t.createElement(wt,{...a}):e===p.NotApplicable?t.createElement(St,{...a}):null},de=d(e=>({root:{display:"grid",width:"100%",gridTemplateColumns:"auto 1fr auto",gridColumnGap:e.spacing(1),padding:e.spacing(1),alignItems:"center","&.selected":{backgroundColor:v(e.palette.primary[e.palette.type],.2)},"&:hover, &:active, &:focus":{backgroundColor:v(e.palette.primary[e.palette.type],.3)}}})),$t=({className:e,href:r,children:a})=>r?t.createElement(qe,{to:r,className:e},a):t.createElement("div",{className:e},a),Nt=({result:e,name:r,timestamp:a,selected:n=!1,href:i})=>{const o=de(),l=C(o.root,{selected:n});return t.createElement($t,{href:i,className:l},t.createElement(me,{result:e}),t.createElement(c,{variant:"body2"},r),a?t.createElement(se,{timestamp:a}):null)},z=()=>{const e=de();return t.createElement(N,null,t.createElement("div",{className:e.root},t.createElement(u,{width:24,height:24}),t.createElement(c,{variant:"body2"},t.createElement(u,null)),t.createElement(u,{width:100,height:24})))},Lt=()=>{const e=pe();return t.createElement("div",{className:e.root},t.createElement(P,null),new Array(3).fill(null).map((r,a)=>t.createElement(t.Fragment,{key:`skeleton-level-${a}`},t.createElement(Et,null),t.createElement("ul",{className:e.checks},t.createElement(z,null),t.createElement(z,null),t.createElement(z,null)))))},Ft=d(e=>({root:{padding:e.spacing(3)},icon:{display:"none"},message:{padding:0},type:{fontWeight:700}})),B=e=>{const{type:r,...a}=Ft();return t.createElement(Me,{severity:e.severity,elevation:1,classes:a},t.createElement(c,{variant:"subtitle1",classes:{root:r}},e.title),e.children)},It=d(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"}}})),Dt=({checks:e,programId:r,checkId:a})=>{const n=It(),i=U(te);return e.length?t.createElement("ul",{className:n.checks},e.map(o=>t.createElement("li",{key:o.id,className:n.checkItem},t.createElement(Nt,{...o,selected:o.id===a,href:i({programId:r,checkId:o.id})})))):t.createElement(c,{variant:"body2",className:n.noChecks},"No applicable checks at this level.")},At=({level:e,checkId:r,programId:a})=>{var n;return t.createElement(t.Fragment,null,t.createElement(vt,{badge:e.badge,title:e.name,description:e.description}),t.createElement(Dt,{checks:(n=e.checks)!=null?n:[],programId:a,checkId:r}))},pe=d(e=>({root:{borderRight:`1px solid ${e.palette.divider}`},checks:{padding:0,margin:0,flex:1,listStyle:"none"}})),Ot=({programId:e,checkId:r})=>{var a,n;const i=pe(),{entity:o}=_(),{data:l,isLoading:g,isError:F}=ae(o,e);return F?t.createElement("div",{className:i.root},t.createElement(Ae,{padding:2},t.createElement(B,{severity:"error",title:"Error loading certification"}))):g||!e?t.createElement(Lt,null):l?t.createElement("div",{className:i.root},t.createElement(le,{name:l.program.name,level:(a=l.highestLevel)==null?void 0:a.name,badge:(n=l.highestLevel)==null?void 0:n.badge,description:l.program.description,documentationUrl:l.program.documentationURL}),l==null?void 0:l.levels.map(y=>t.createElement(At,{key:y.ordinal,level:y,checkId:r,programId:e}))):null},xt=()=>t.createElement(t.Fragment,null,t.createElement(P,{hideDescription:!0}),t.createElement(P,{hideDescription:!0})),ue=({className:e})=>t.createElement("div",{className:e},t.createElement(V,{title:"No certifications available",missing:"data",description:"There are no programs configured that apply to this entity."})),Tt=({ownerEntityRef:e})=>e?t.createElement(V,{missing:"data",title:"Missing entities",description:t.createElement(t.Fragment,null,"Looks like the group"," ",Te(Be(e),{defaultKind:"Group"})," ","doesn't own any entities.",t.createElement("br",null),t.createElement("br",null),"Please select another group from the dropdown in the corner of the header.")}):null,ge=Fe(e=>({certificationWrapper:{display:"flex",justifyContent:"space-between",alignItems:"center"},infoCard:{display:"grid",gridRowGap:e.spacing(2)},emptyState:{"& > div":{backgroundColor:e.palette.background.paper}}})),L=({children:e,title:r})=>{const a=ge();return t.createElement(xe,{title:r},t.createElement("div",{className:a.infoCard},t.createElement(ze,{inline:!0,backend:"soundcheck",invalidLicenseMessage:"Submitted check results will still be stored, but it will not be possible to view certifications or individual results until a valid license is present."}),e))},Pt=({title:e="Soundcheck"})=>{const{entity:r}=_(),a=ge(),{data:n,isError:i,isLoading:o}=re(r),l=U(ee);return i?t.createElement(L,{title:e},t.createElement(B,{severity:"error",title:"Error loading certifications"})):o||!n?t.createElement(L,{title:e},t.createElement(xt,null)):n.length===0?t.createElement(L,{title:e},t.createElement(ue,{className:a.emptyState})):t.createElement(L,{title:e},n.map((g,F)=>{var y,q;return t.createElement(Se,{key:g.program.name},t.createElement("div",{className:a.certificationWrapper,"data-testid":"soundcheck-program-row"},t.createElement(le,{key:g.program.id,name:g.program.name,badge:(y=g.highestLevel)==null?void 0:y.badge,level:(q=g.highestLevel)==null?void 0:q.name}),t.createElement(Q,{to:l({programId:g.program.id})},"View Details")),F<n.length-1?t.createElement(Oe,null):null)}))};export{B as A,X as B,Ot as C,ct as E,N as F,x as L,oe as N,p as R,pt as S,se as a,re as b,ee as c,ue as d,te as e,Pt as f,me as g,Tt as h,$ as i,st as j,mt as k,b as s,ae as u};
|
|
157
|
-
//# sourceMappingURL=index-5d64d93c.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import t,{useState as $,useEffect as k,useMemo as L,useCallback as H,memo as b,Fragment as ie}from"react";import{HeaderTabs as W,Link as I,EmptyState as se,Page as ce,Header as pe,Content as me}from"@backstage/core-components";import{SpotifyLicenseBanner as de}from"@spotify/backstage-plugin-core";import{makeStyles as g,alpha as V,TextField as ue,CircularProgress as ge,Tooltip as G,LinearProgress as he,withStyles as fe,Grid as C,Typography as y}from"@material-ui/core";import{s as M,R as N,g as ye,B as ve,L as j,N as K,A as Ee,h as ke,S as be}from"./index-5d64d93c.esm.js";import Ce from"@material-ui/lab/Autocomplete";import{stringifyEntityRef as D,parseEntityRef as v}from"@backstage/catalog-model";import{useApi as x,identityApiRef as Ne,useRouteRef as P,configApiRef as we}from"@backstage/core-plugin-api";import{useQuery as S}from"@tanstack/react-query";import{catalogApiRef as _,humanizeEntityRef as T,entityRouteRef as A}from"@backstage/plugin-catalog-react";import{useSearchParams as Re}from"react-router-dom";import{R as xe}from"./RefetchingIndicator-96188300.esm.js";import{countBy as Q}from"lodash";import{Skeleton as O}from"@material-ui/lab";import{VariableSizeGrid as $e}from"react-window";import"graphql-request";import"graphql-tag";import"@material-ui/core/styles/makeStyles";import"classnames";import"@material-ui/icons/Schedule";import"luxon";import"@material-ui/icons/Check";import"@material-ui/icons/Close";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/HelpOutline";import"react-use/lib/useDebounce";function Te(e){const r=x(M);return S(["soundcheck/facets-for-owner",e],async()=>r.getFacetsForOwner(e),{enabled:!!e})}function U(e,r){const a=x(M);return S(["soundcheck/program-overview-for-owner",e,r],async()=>a.getProgramOverviewForOwner(e,r),{enabled:!!e&&!!(r!=null&&r.type)})}function Le(){const e=x(Ne),r=x(_);return S(["soundcheck/user-groups-claims"],async()=>{const{ownershipEntityRefs:a}=await e.getBackstageIdentity();return(await r.getEntitiesByRefs({entityRefs:a})).items.filter(n=>(n==null?void 0:n.kind)==="Group").map(n=>{var l,s,o,i;return{name:(i=(o=(s=(l=n.spec)==null?void 0:l.profile)==null?void 0:s.displayName)!=null?o:n.metadata.title)!=null?i:n.metadata.name,ref:D(n)}})})}function Ie(){const e=x(_);return S(["soundcheck/all-groups"],async()=>{const{items:r}=await e.getEntities({filter:{kind:"Group"}});return r.filter(a=>(a==null?void 0:a.kind)==="Group").map(a=>{var n,l,s,o;return{name:(o=(s=(l=(n=a.spec)==null?void 0:n.profile)==null?void 0:l.displayName)!=null?s:a.metadata.title)!=null?o:a.metadata.name,ref:D(a)}})})}const Pe=()=>{const[e,r]=Re(),a=Object.fromEntries(e.entries()),[n,l]=$(a);return k(()=>{r(n,{replace:!0})},[n]),[n,l]},Se=()=>{const{data:e,isLoading:r,isError:a}=Le(),{data:n,isLoading:l,isError:s}=Ie();return{options:L(()=>{const o=[];return e&&o.push(...e.map(({name:i,ref:m})=>({name:i,ref:m,key:"My Groups"}))),n&&o.push(...n.map(({name:i,ref:m})=>({name:i,ref:m,key:"All Groups"}))),o},[e,n]),isLoading:r||l,isError:a||s}},Ae=g(e=>({root:{width:"100%",minWidth:250},textField:{"& $notchedOutline":{borderColor:V(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:{}})),Oe=e=>{const{onChange:r,initialValue:a,setError:n}=e,{options:l,isLoading:s,isError:o}=Se(),i=Ae(),[m,p]=$(null);k(()=>{if(!s&&l!=null&&l.length&&!m){const c=a?l.find(d=>d.ref===a):l[0];c&&(p(c),r==null||r(c.ref))}},[s,l,m,r,a]);const u=H((c,d)=>{p(d),r==null||r(d==null?void 0:d.ref)},[r,p]);return k(()=>{n==null||n(o?new Error("Error loading groups"):void 0)},[o,n]),o?null:t.createElement(Ce,{"aria-label":"Current group",className:i.root,classes:{clearIndicator:i.clearIndicator,popupIndicator:i.popupIndicator},disableClearable:!0,options:l!=null?l:[],loading:s,groupBy:c=>c.key,value:m,freeSolo:!1,onChange:u,getOptionLabel:c=>c.name,renderInput:c=>t.createElement(ue,{...c,variant:"outlined",placeholder:s?"Loading":"Select a group",className:i.textField,InputProps:{...c.InputProps,className:i.input,classes:{notchedOutline:i.notchedOutline},endAdornment:t.createElement(t.Fragment,null,s?t.createElement(ge,{color:"inherit",size:20}):null,c.InputProps.endAdornment)}})})},Be=e=>({key:`skeleton${e}`,label:"",id:`skeleton${e}`}),Fe=()=>{const e=Array.from({length:4},(r,a)=>Be(a));return t.createElement(W,{tabs:e})},ze=g(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)}})),He=({unfilteredFacets:e,onChange:r,type:a})=>{var n,l,s;const o=ze(),i={types:(n=e==null?void 0:e.types.filter(({count:c})=>c>0))!=null?n:[]},m=H(c=>{var d;r((d=i==null?void 0:i.types[c].value)!=null?d:"")},[i==null?void 0:i.types,r]);k(()=>{var c,d;const h=(i==null?void 0:i.types)&&i.types.length>=0,f=!a&&h,E=a&&h&&!(i!=null&&i.types.find(({value:F})=>F===a));(f||E)&&r((d=(c=i==null?void 0:i.types[0])==null?void 0:c.value)!=null?d:"")},[a,i==null?void 0:i.types,r]);const p=(l=i==null?void 0:i.types.map(({value:c,count:d})=>({key:c,label:`${c} (${d>50?"50+":d})`,id:c,tabProps:{className:o.tab}})))!=null?l:[];if(!p.length)return null;const u=(s=i==null?void 0:i.types.findIndex(c=>c.value===a))!=null?s:-1;return t.createElement(t.Fragment,null,t.createElement(xe,null),t.createElement(W,{onChange:m,tabs:p,selectedIndex:u>-1?u:void 0}))},We=g(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"}})),q=e=>{var r,a;const n=We(e),l=L(()=>Object.entries(e.progress).reduce((o,[,i])=>o+i,0),[e.progress]);if(l===0)return null;const s=(r=e.progress[N.Passed])!=null?r:0;return t.createElement(G,{arrow:!0,title:`Check passing for ${s} of ${l} ${l===1?"entity":"entities"}`,enterDelay:0,placement:"top"},t.createElement(he,{variant:"determinate",value:((a=e.progress[N.Passed])!=null?a:0)/l*100,classes:{root:n.root,bar:n.bar}}))},Ve=g(e=>({headerWrapper:{marginTop:e.spacing(.5)},entityRefName:{fontWeight:"bold"},iconWrapper:{padding:e.spacing(1.5,.5),display:"flex",alignItems:"center",justifyContent:"center"}})),Ge=({check:{name:e,description:r},icon:a,entityRef:n})=>{const l=Ve();return t.createElement(C,{spacing:1},t.createElement(C,{container:!0,direction:"row",spacing:1,wrap:"nowrap"},t.createElement("div",{className:l.iconWrapper},a),t.createElement(y,{variant:"h6",className:l.headerWrapper,noWrap:!0},e)),t.createElement(C,{item:!0,wrap:"nowrap"},t.createElement(y,{variant:"subtitle2",className:l.entityRefName},T(v(n),{defaultKind:"component"}))),t.createElement(y,{variant:"caption"},r))},Me=fe(e=>{const r=e.palette.type==="dark"?e.palette.common.black:e.palette.grey[300];return{tooltip:{backgroundColor:r,color:e.palette.type==="dark"?e.palette.common.white:e.palette.grey[700]},arrow:{color:r}}})(G),je=({children:e,check:r,icon:a,entityRef:n})=>t.createElement(Me,{arrow:!0,title:t.createElement(Ge,{check:r,icon:a,entityRef:n}),enterDelay:150,placement:"top"},e),Ke=g(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}`}})),J=b(({programId:e,check:r,entityRef:a,result:n,entityRoute:l,isVirtualized:s})=>{const o=Ke();if(typeof a!="string"){const u=t.createElement("div",{className:o.iconWrapper},t.createElement("div",{className:o.icon}));return s?t.createElement("div",{className:`${o.root} ${o.virtualized}`,"aria-hidden":!0},u):t.createElement("td",{className:o.root,"aria-hidden":!0},u)}const i=t.createElement(ye,{className:o.icon,result:n!=null?n:N.NotReported}),m=t.createElement("div",{className:o.iconWrapper},i),p=n&&n===N.NotApplicable?m:t.createElement(I,{className:o.link,to:`${l(v(a))}/soundcheck/${e}/${r.id}`},m);return s?t.createElement("div",{className:`${o.root} ${o.virtualized}`},t.createElement(je,{check:r,icon:i,entityRef:a},p)):t.createElement("td",{className:`${o.root}`},p)}),X=8,De=16,w={programTitle:70,levelTitle:30,check:42,entityRefFooter:100},B={programTitle:350+De*2,checkResult:42},_e=e=>e.reduce((r,a)=>r+a.height,0),Qe=e=>e*B.checkResult+B.programTitle,Ue=e=>e.filter(r=>r!==void 0).map(r=>T(v(r),{defaultKind:"component"})).reduce((r,a)=>r.length>a.length?r:a,""),qe=e=>X*e+X,Y="NoLevel",Je=e=>({name:Y,badge:{options:{level:0,color:""},variant:ve.Medal},entityRef:e,ordinal:0}),Z=g(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:`${w.check}px`,lineHeight:`${w.check}px`,borderBottom:`1px solid ${e.palette.divider}`,borderRight:`1px solid ${e.palette.divider}`}})),Xe=b(({programId:e,programName:r,check:a,entityRefs:n,results:l,entityRoute:s})=>{const o=Z(),i=L(()=>Q(l.filter(({result:p})=>p!==N.NotApplicable),"result"),[l]),m=new Map(l.map(p=>[p.entityRef,p.result]));return t.createElement("tr",{"data-testid":"program-check-row"},t.createElement("th",{scope:"row",className:o.checkNameCell,"aria-label":`${a.name} check for ${r} program`},t.createElement("div",{className:o.checkNameContent},t.createElement(y,{className:o.checkNameTypography,variant:"subtitle2",component:"p"},a.name),t.createElement(q,{className:o.checkIndicator,progress:i}))),n.map((p,u)=>t.createElement(J,{key:u,programId:e,check:a,entityRef:p,result:typeof p=="string"?m.get(p):void 0,entityRoute:s})))}),Ye=({name:e,progress:r})=>{const a=Z();return t.createElement("div",{className:a.checkNameCell,"aria-label":`${e} check`},t.createElement("div",{className:`${a.checkNameContent} ${a.checkNameCellVirtualized}`},t.createElement(y,{variant:"subtitle2",component:"p",className:a.checkNameTypography},e),t.createElement(q,{className:a.checkIndicator,progress:r})))},Ze=g(e=>({virtualized:{borderRight:`1px solid ${e.palette.divider}`,height:`${w.programTitle}px`,display:"flex",justifyContent:"center",alignItems:"center"}})),et=b(({entityRef:e,highestLevels:r})=>{const a=r.find(n=>n.entityRef===e);return t.createElement(t.Fragment,null,a!=null&&a.badge?t.createElement(j,{badge:a.badge}):t.createElement(K,null))}),tt=({highestLevel:e})=>{const r=Ze();if(!(e!=null&&e.badge))return t.createElement("div",{className:r.virtualized},"\xA0");const a=e.name!==Y;return t.createElement("div",{className:r.virtualized},a?t.createElement(j,{badge:e.badge}):t.createElement(K,null))},ee=g(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}`}})),rt=b(({program:e,entityRefs:r,highestLevels:a})=>{const n=ee();return t.createElement("tr",{"data-testid":"program-title-row"},t.createElement("th",{scope:"row",className:n.programNameCell},t.createElement("div",{className:n.programNameContent},t.createElement(y,{className:n.programNameTypography,variant:"h5",component:"p"},e.name))),r.map((l,s)=>typeof l!="string"?t.createElement("td",{key:s,"aria-hidden":!0}):t.createElement("td",{key:s,"data-testid":"program-certification-cell"},t.createElement("div",{className:n.badgeCellContent},t.createElement(et,{entityRef:l,highestLevels:a})))))}),at=b(({name:e})=>{const r=ee();return t.createElement("div",{className:`${r.programNameCell} ${r.programNameCellVirtualized}`},t.createElement("div",{className:r.programNameContent},t.createElement(y,{className:r.programNameTypography,variant:"h5",component:"p"},e)))}),z=g(e=>{const r=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{root:{color:V(e.palette.getContrastText(r),.7),backgroundColor:r},levelContent:{padding:`${e.spacing(.5)}px ${e.spacing(2)}px`,backgroundColor:r},levelTypography:{overflow:"hidden",textOverflow:"ellipsis"},levelHeaderCell:{padding:`${e.spacing(.5)}px ${e.spacing(2)}px`,borderRight:`1px solid ${e.palette.divider}`,height:`${w.levelTitle}px`}}}),nt=b(({level:e,entityRefs:r,programName:a})=>{const n=z();return t.createElement("tr",{className:n.root,"data-testid":"program-level-row"},t.createElement("th",{scope:"row",className:n.root},t.createElement("div",{className:n.levelContent},t.createElement(y,{className:n.levelTypography,variant:"subtitle2",component:"p","aria-label":`${e.name} for ${a} program`},e.name))),r.map((l,s)=>t.createElement("td",{key:s,className:n.root,"aria-hidden":!0})))}),lt=({name:e})=>{const r=z();return t.createElement("div",{className:`${r.levelHeaderCell} ${r.root}`,"aria-label":`${e}`},t.createElement(y,{variant:"subtitle2",component:"p",className:r.levelTypography},e))},ot=()=>{const e=z();return t.createElement("div",{className:`${e.levelHeaderCell} ${e.root}`},"\xA0")},it=({program:e,highestLevels:r,levels:a,entityRefs:n,entityRoute:l})=>t.createElement("tbody",null,t.createElement(rt,{program:e,entityRefs:n,highestLevels:r}),a.map((s,o)=>t.createElement(ie,{key:o},t.createElement(nt,{entityRefs:n,level:s,programName:e.name}),s.checks.map(({check:i,results:m},p)=>t.createElement(Xe,{key:p,check:i,programId:e.id,programName:e.name,entityRefs:n,results:m,entityRoute:l}))))),te=g(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)"}})),st=({entityRefs:e})=>{const r=P(A),a=te();return t.createElement("tfoot",{className:a.root,"data-testid":"results-table-footer"},t.createElement("tr",{className:a.row},t.createElement("td",{className:a.cell}),e.map((n,l)=>typeof n!="string"?t.createElement("th",{key:l,className:a.cell,"aria-hidden":!0}):t.createElement("th",{scope:"col",key:l,className:a.cell},t.createElement("div",{className:a.cellInner},t.createElement(I,{to:r(v(n))},T(v(n),{defaultKind:"component"})))))))},ct=({entityRef:e})=>{const r=P(A),a=te(),n=e?t.createElement(I,{to:r(v(e))},T(v(e),{defaultKind:"component"})):t.createElement(t.Fragment,null);return t.createElement("div",{className:a.cell},t.createElement("div",{className:a.cellInner},n))},pt=g(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]}})),re=()=>{const e=pt(),r=new Array(25).fill(void 0),a=new Array(5).fill(void 0),n=new Array(3).fill(void 0);return t.createElement("table",{className:e.table},t.createElement("tbody",null,t.createElement("tr",null,t.createElement("td",{className:e.programTitle},t.createElement(O,{width:180,height:40})),r.map((l,s)=>t.createElement("td",{key:s}))),n.map((l,s)=>t.createElement(t.Fragment,{key:s},t.createElement("tr",{className:e.header},t.createElement("td",{className:e.title},t.createElement(O,{width:180})),r.map((o,i)=>t.createElement("td",{key:i}))),a.map((o,i)=>t.createElement("tr",{key:i},t.createElement("td",{className:e.title},t.createElement(O,{width:240})),r.map((m,p)=>t.createElement("td",{key:p,className:e.checkResult},t.createElement(O,{width:18,height:18,variant:"rect"})))))))))},mt=g(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:1e3},"& tbody td:first-of-type":{border:`1px solid ${e.palette.divider}`,boxShadow:`1px 0 ${e.palette.background.default}, -1px 0 ${e.palette.background.default}`}}})),dt=b(e=>{const{setError:r,type:a,ownerEntityRef:n}=e,l=mt(),s=P(A),{data:o,isLoading:i,isError:m}=U(n,{type:a});if(k(()=>{r==null||r(m?new Error("Error loading program overview"):void 0)},[m,r]),i)return t.createElement(re,null);if(!o||!n)return null;const{programs:p,entityRefs:u}=o;if(!i&&!p.length)return t.createElement(se,{missing:"data",title:"Missing programs",description:t.createElement(t.Fragment,null,"Looks like the group"," ",T(v(n),{defaultKind:"Group"})," ","doesn't own any ",a," components that have Soundcheck programs set up.",t.createElement("br",null),t.createElement("br",null),"If you're an administrator, you can learn more about configuring and filtering programs in the"," ",t.createElement(I,{to:"https://www.npmjs.com/package/@spotify/backstage-plugin-soundcheck-backend#entity-filter"},"docs"),".")});if(m)return null;const c=u.length>=25?u:[...u,...Array.from({length:25-u.length},()=>{})];return t.createElement("div",{className:l.root},t.createElement("table",{className:l.table,"aria-label":"Check results"},p.map(({program:d,levels:h,highestLevels:f},E)=>t.createElement(it,{key:E,program:d,entityRefs:c,levels:h,highestLevels:f,entityRoute:s})),t.createElement(st,{entityRefs:c})))}),ut=e=>t.createElement(at,{name:e}),gt=e=>({type:"ProgramHeader",render:()=>ut(e)}),ht=e=>e?t.createElement(lt,{name:e}):t.createElement(ot,null),ae=e=>({type:"LevelHeader",render:()=>ht(e)}),ft=(e,r)=>t.createElement(Ye,{name:e,progress:r}),yt=(e,r)=>({type:"CheckTitle",render:()=>ft(e,r)}),vt=(e,r,a,n,l)=>t.createElement(J,{check:r,entityRef:a,entityRoute:l,programId:e,result:n,isVirtualized:!0}),Et=(e,r,a,n,l)=>({type:"CheckResult",render:()=>vt(e,r,a,n,l)}),kt=e=>t.createElement(ct,{entityRef:e}),ne=e=>({type:"EntityHeader",render:()=>kt(e)}),bt=e=>t.createElement(tt,{highestLevel:e}),Ct=e=>({type:"LevelBadge",render:()=>bt(e)}),Nt=e=>r=>{const a=e[r.rowIndex].cells[r.columnIndex];return a?t.createElement("div",{style:r.style},a.render()):t.createElement("div",{style:r.style})},wt=(e,r,a)=>{var n;const l=[];for(const{program:o,levels:i,highestLevels:m}of e){l.push({height:w.programTitle,cells:[gt(o.name),...r.map(p=>{const u=p?m.find(c=>c.entityRef===p)||Je(p):void 0;return Ct(u)})]});for(const p of i){l.push({height:w.levelTitle,cells:[ae(p.name),...r.map(u=>ae(""))]});for(const{check:u,results:c}of p.checks)l.push({height:w.check,cells:[yt(u.name,Q(c.filter(({result:d})=>d!==N.NotApplicable),"result")),...r.map(d=>{var h,f;return Et(o.id,u,d,(f=(h=c.find(E=>E.entityRef===d))==null?void 0:h.result)!=null?f:N.NotApplicable,a)})]})}}const s=Ue(r!=null?r:[]);return l.push({height:qe((n=s.length)!=null?n:1),cells:[ne(""),...r.map(o=>ne(o||""))]}),l},Rt=g(e=>({table:{backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap",textAlign:"left",overflow:"auto"}})),xt=e=>{const{setError:r,type:a,ownerEntityRef:n}=e,l=Rt(),s=P(A),{data:o,isLoading:i,isError:m}=U(n,{type:a});if(k(()=>{r==null||r(m?new Error("Error loading program overview"):void 0)},[m,r]),i)return t.createElement(re,null);if(!o||!n)return null;const{programs:p,entityRefs:u}=o,c=u.length>=25?u:[...u,...Array.from({length:25-u.length},()=>{})],d=wt(p,c,s),h=Nt(d);return t.createElement(C,{"aria-label":`Check results for ${a}`,key:a,item:!0,xs:12},t.createElement($e,{className:l.table,columnCount:c.length+1,columnWidth:f=>f===0?B.programTitle:B.checkResult,rowCount:d.length,rowHeight:f=>d[f].height,height:_e(d),width:Qe(c.length)},h))},$t=({facets:e,ownerEntityRef:r,type:a,setError:n})=>{const l=L(()=>{const s=new Map;return e.types.forEach(({value:o})=>{s.set(o,t.createElement(xt,{key:o,ownerEntityRef:r,type:o,setError:n}))}),s},[e,r,n]);return t.createElement("div",null,l.get(a))},Tt=g(()=>({scrollContainer:{overflow:"auto"}})),Lt=({facets:e,ownerEntityRef:r,hasError:a,type:n,setError:l,useVirtualizedResultsTable:s})=>{var o,i;const m=Tt();return a?t.createElement(Ee,{severity:"error",title:a.message}):e&&((i=(o=e.types)==null?void 0:o.length)!=null?i:0)>0?t.createElement("div",{className:m.scrollContainer},s?t.createElement($t,{facets:e,type:n,setError:l,ownerEntityRef:r,hasError:a}):t.createElement(dt,{ownerEntityRef:r,type:n,setError:l})):t.createElement(ke,{ownerEntityRef:r})},It=g(e=>({tableContainer:{padding:e.spacing(3),backgroundColor:"transparent"}})),Pt=({title:e="Soundcheck"})=>{var r;const[a,n]=Pe(),{group:l,type:s}=a,[o,i]=$(void 0),[m,p]=$(void 0),[u,c]=$(void 0);k(()=>{o!==s&&i(s)},[s,o]);const{data:d,isLoading:h}=Te(l),f=(r=x(we).getOptionalBoolean("soundcheck.virtualizeOverviewPage"))!=null?r:!1,E=m||u,F=R=>{R&&n({...a,group:R})},le=R=>{R&&(i(R),n({...a,type:R}))},oe=It();return t.createElement(ce,{themeId:"website"},t.createElement(de,{backend:"soundcheck",invalidLicenseMessage:"Submitted check results will still be stored, but it will not be possible to view certifications or individual results until a valid license is present."}),t.createElement(pe,{title:e},t.createElement(Oe,{onChange:F,initialValue:l,setError:p})),t.createElement(me,{noPadding:!0,stretch:!0},t.createElement(C,{container:!0,spacing:0},t.createElement(C,{item:!0,xs:12},h?t.createElement(Fe,null):t.createElement(He,{unfilteredFacets:d,type:o,onChange:le})),t.createElement(C,{item:!0,xs:12,className:oe.tableContainer},!h&&t.createElement(Lt,{facets:d,type:o,setError:c,hasError:E,ownerEntityRef:l,useVirtualizedResultsTable:f})))))},St=e=>{const{title:r}=e;return t.createElement(be,null,t.createElement(Pt,{title:r}))};export{St as overviewPage};
|
|
2
|
-
//# sourceMappingURL=index-808077a4.esm.js.map
|