@spotify/backstage-plugin-soundcheck 0.4.0 → 0.4.2
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 +38 -0
- package/README.md +15 -2
- package/config.d.ts +4 -0
- package/dist/esm/EntitySoundcheckContent-ec837784.esm.js +2 -0
- package/dist/esm/RefetchingIndicator-4f009bca.esm.js +2 -0
- package/dist/esm/index-7b7b98c2.esm.js +2 -0
- package/dist/esm/index-ab8d0702.esm.js +217 -0
- package/dist/esm/index-b2b00eb3.esm.js +2 -0
- package/dist/index.d.ts +25 -3
- package/dist/index.esm.js +1 -1
- package/package.json +15 -13
- package/dist/esm/index/CertificationSidebar-276909f2.esm.js +0 -2
- package/dist/esm/index/EntitySoundcheckContent-931d8ed8.esm.js +0 -2
- package/dist/esm/index/RefetchingIndicator-b6c3da0a.esm.js +0 -2
- package/dist/esm/index/SoundcheckQueryClientProvider-04f7e1dc.esm.js +0 -2
- package/dist/esm/index/index-0f37ee61.esm.js +0 -2
- package/dist/esm/index/index-41e242ce.esm.js +0 -2
- package/dist/esm/index/index-d6a5b7f6.esm.js +0 -161
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @spotify/backstage-plugin-soundcheck
|
|
2
2
|
|
|
3
|
+
## 0.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Upgraded to Backstage `v1.14.0`
|
|
8
|
+
- Implemented numerous enhancements to ensure compliance with accessibility standards.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @spotify/backstage-plugin-core@0.5.2
|
|
11
|
+
|
|
12
|
+
## 0.4.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Upgraded Backstage to `v1.13.0`.
|
|
17
|
+
- Removed extra scrollbars from the Soundcheck overview page.
|
|
18
|
+
- Added "No Level" badges to the tables on the Soundcheck overview page.
|
|
19
|
+
- Added tooltips to checks in the overview page results table.
|
|
20
|
+
- Removed extra scrollbars when there are no entities on the overview page.
|
|
21
|
+
Improvements to the loading of the overview page table.
|
|
22
|
+
- Added a message in the checks list of a level to indicate to a user when the level has no checks enabled.
|
|
23
|
+
- Resolved browser warnings on the overview page.
|
|
24
|
+
- The overview page can now accept a custom title. Set this in your `App.tsx` file as a property of the `SoundcheckOverviewPage`:
|
|
25
|
+
|
|
26
|
+
```jsx
|
|
27
|
+
<SoundcheckOverviewPage title="My Custom Title" />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- A program's `documentationURL` is now displayed as a "Learn More" link below the program description.
|
|
31
|
+
- The Soundcheck entity card can now accept a custom title. Set this in your `EntityPage.tsx` file as a property of the `EntitySoundcheckCard`:
|
|
32
|
+
|
|
33
|
+
```jsx
|
|
34
|
+
<EntitySoundcheckCard title="My Custom Title" />
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- Updated styling to resolve misaligned borders for the tables on the overview page.
|
|
38
|
+
- Updated dependencies
|
|
39
|
+
- @spotify/backstage-plugin-core@0.5.1
|
|
40
|
+
|
|
3
41
|
## 0.4.0
|
|
4
42
|
|
|
5
43
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -82,7 +82,17 @@ const serviceEntityPage = (
|
|
|
82
82
|
|
|
83
83
|
### 3. Install Soundcheck Overview Page
|
|
84
84
|
|
|
85
|
-
Add a new Route element with the path `/soundcheck` and element of `<SoundcheckOverviewPage />`.
|
|
85
|
+
Add a new Route element with the path `/soundcheck` and element of `<SoundcheckOverviewPage />`.
|
|
86
|
+
|
|
87
|
+
`<SoundcheckOverviewPage />` supports the following props:
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
{
|
|
91
|
+
title: string; // OPTIONAL - Defaults to 'Soundcheck' when excluded
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The route should look something like this:
|
|
86
96
|
|
|
87
97
|
```tsx
|
|
88
98
|
// packages/app/src/App.tsx
|
|
@@ -92,7 +102,10 @@ const routes = (
|
|
|
92
102
|
<FlatRoutes>
|
|
93
103
|
{/* existing routes... */}
|
|
94
104
|
|
|
95
|
-
<Route
|
|
105
|
+
<Route
|
|
106
|
+
path="/soundcheck"
|
|
107
|
+
element={<SoundcheckOverviewPage title="My Optional Title" />}
|
|
108
|
+
/>
|
|
96
109
|
</FlatRoutes>
|
|
97
110
|
);
|
|
98
111
|
```
|
package/config.d.ts
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{useState as $,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-4f009bca.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-ab8d0702.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 A 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=D();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))))},D=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=D(),{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=A(m),R=A(t),[W,S]=$(!1);return M(()=>{typeof E!="undefined"&&typeof m!="undefined"&&t===R&&m>E&&S(!0)},[m,E,t,R]),W?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},z=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=z();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=z();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-ec837784.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t,{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-ab8d0702.esm.js";import"@backstage/plugin-catalog-react";import"react-router-dom";const p=a(e=>({indicator:{position:"absolute",width:"100%",zIndex:e.zIndex.speedDial}})),l=()=>{const e=c(),i=p(),[r,o]=n(!!e);return s(()=>{o(!!e)},250,[e]),r?t.createElement(d,null,t.createElement("div",{className:i.indicator},t.createElement(m,{variant:"indeterminate","data-testid":"refetching-indicator"}))):null};export{l as R};
|
|
2
|
+
//# sourceMappingURL=RefetchingIndicator-4f009bca.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t from"react";import{S as o,f as i}from"./index-ab8d0702.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"react-router-dom";import"@material-ui/lab";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-7b7b98c2.esm.js.map
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import{createApiRef as Se,createRouteRef as H,createSubRouteRef as k,createPlugin as $e,createApiFactory as Ie,discoveryApiRef as Ne,fetchApiRef as De,createRoutableExtension as Q,createComponentExtension as Le,useApi as P,errorApiRef as Fe,useRouteRef as j}from"@backstage/core-plugin-api";import{GraphQLClient as Ae}from"graphql-request";import s from"graphql-tag";import t,{createContext as Pe,useState as O,useRef as Oe,useCallback as x,useContext as xe,useEffect as Te,Fragment as qe}from"react";import{QueryClient as ze,QueryClientProvider as Me,useQuery as V}from"@tanstack/react-query";import{memoize as Be}from"lodash";import We from"@material-ui/core/styles/makeStyles";import{makeStyles as p,Modal as Ge,Box as K,Typography as m,Button as _,Fade as Ue,alpha as E,Tooltip as He,withStyles as b,Divider as Qe}from"@material-ui/core";import{MarkdownContent as J,Link as X,EmptyState as Y,InfoCard as je}from"@backstage/core-components";import{useEntity as Z,humanizeEntityRef as Ve}from"@backstage/plugin-catalog-react";import{useAutoUpdatingRelativeTime as Ke,SpotifyLicenseBanner as _e}from"@spotify/backstage-plugin-core";import{stringifyEntityRef as ee,parseEntityRef as Je}from"@backstage/catalog-model";import{Link as Xe}from"react-router-dom";import{Skeleton as f,Alert as Ye}from"@material-ui/lab";import R from"classnames";import Ze from"@material-ui/icons/Schedule";import{DateTime as te}from"luxon";import et from"@material-ui/icons/Check";import tt from"@material-ui/icons/Close";import rt from"@material-ui/icons/RemoveCircleOutline";import at from"@material-ui/icons/HelpOutline";var re=(e=>(e.Medal="MEDAL",e))(re||{}),h=(e=>(e.Failed="FAILED",e.NotApplicable="NOT_APPLICABLE",e.NotReported="NOT_REPORTED",e.Passed="PASSED",e))(h||{});const nt=s`
|
|
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
|
+
`,it=s`
|
|
24
|
+
fragment check on Check {
|
|
25
|
+
id
|
|
26
|
+
name
|
|
27
|
+
description
|
|
28
|
+
}
|
|
29
|
+
`,ot=s`
|
|
30
|
+
fragment CheckResultSummary on CheckResult {
|
|
31
|
+
id
|
|
32
|
+
name
|
|
33
|
+
result
|
|
34
|
+
timestamp
|
|
35
|
+
}
|
|
36
|
+
`,ct=s`
|
|
37
|
+
fragment LevelResultDetails on LevelResult {
|
|
38
|
+
ordinal
|
|
39
|
+
name
|
|
40
|
+
description
|
|
41
|
+
badge {
|
|
42
|
+
... on BadgeVariantMedal {
|
|
43
|
+
variant
|
|
44
|
+
options {
|
|
45
|
+
level
|
|
46
|
+
color
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
certified
|
|
51
|
+
checks {
|
|
52
|
+
...CheckResultSummary
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
${ot}`,lt=s`
|
|
56
|
+
fragment CheckResultDetails on CheckResult {
|
|
57
|
+
id
|
|
58
|
+
name
|
|
59
|
+
description
|
|
60
|
+
result
|
|
61
|
+
timestamp
|
|
62
|
+
notes
|
|
63
|
+
}
|
|
64
|
+
`,st=s`
|
|
65
|
+
fragment OverviewLevelResult on OverviewLevelResult {
|
|
66
|
+
ordinal
|
|
67
|
+
name
|
|
68
|
+
checks {
|
|
69
|
+
check {
|
|
70
|
+
id
|
|
71
|
+
name
|
|
72
|
+
description
|
|
73
|
+
}
|
|
74
|
+
results {
|
|
75
|
+
id
|
|
76
|
+
entityRef
|
|
77
|
+
result
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`,ae=s`
|
|
82
|
+
fragment HighestLevel on LevelResult {
|
|
83
|
+
entityRef
|
|
84
|
+
ordinal
|
|
85
|
+
name
|
|
86
|
+
badge {
|
|
87
|
+
... on BadgeVariantMedal {
|
|
88
|
+
variant
|
|
89
|
+
options {
|
|
90
|
+
color
|
|
91
|
+
level
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`,mt=s`
|
|
97
|
+
mutation deleteChecker($checkerId: String!) {
|
|
98
|
+
deleteChecker(checkerId: $checkerId)
|
|
99
|
+
}
|
|
100
|
+
`,dt=s`
|
|
101
|
+
mutation deleteProgram($programId: String!) {
|
|
102
|
+
programDeleted: deleteProgram(programId: $programId)
|
|
103
|
+
}
|
|
104
|
+
`,pt=s`
|
|
105
|
+
query getAllCertifications($entityRef: String!) {
|
|
106
|
+
certifications(entityRef: $entityRef, includeFilteredChecks: false) {
|
|
107
|
+
...CertificationSummary
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
${nt}`,ut=s`
|
|
111
|
+
query getAllPrograms($programIds: [String!]) {
|
|
112
|
+
programs(programIds: $programIds) {
|
|
113
|
+
id
|
|
114
|
+
ownerEntityRef
|
|
115
|
+
name
|
|
116
|
+
description
|
|
117
|
+
documentationURL
|
|
118
|
+
levels {
|
|
119
|
+
ordinal
|
|
120
|
+
name
|
|
121
|
+
description
|
|
122
|
+
checks {
|
|
123
|
+
...check
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
${it}`,gt=s`
|
|
129
|
+
query getCertificationDetails($entityRef: String!, $programId: String!) {
|
|
130
|
+
programCertification(
|
|
131
|
+
entityRef: $entityRef
|
|
132
|
+
programId: $programId
|
|
133
|
+
includeFilteredChecks: false
|
|
134
|
+
) {
|
|
135
|
+
program {
|
|
136
|
+
id
|
|
137
|
+
name
|
|
138
|
+
description
|
|
139
|
+
documentationURL
|
|
140
|
+
}
|
|
141
|
+
highestLevel {
|
|
142
|
+
...HighestLevel
|
|
143
|
+
}
|
|
144
|
+
levels {
|
|
145
|
+
...LevelResultDetails
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
${ae}
|
|
150
|
+
${ct}`,ht=s`
|
|
151
|
+
query getCheckResultDetails($entityRef: String!, $programId: String!, $checkId: String!) {
|
|
152
|
+
checkResult(entityRef: $entityRef, programId: $programId, checkId: $checkId) {
|
|
153
|
+
...CheckResultDetails
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
${lt}`,ft=s`
|
|
157
|
+
query getCheckers($ids: [String!]) {
|
|
158
|
+
checkers(ids: $ids) {
|
|
159
|
+
id
|
|
160
|
+
ownerEntityRef
|
|
161
|
+
name
|
|
162
|
+
description
|
|
163
|
+
rule
|
|
164
|
+
passedMessage
|
|
165
|
+
failedMessage
|
|
166
|
+
isEditable
|
|
167
|
+
schedule {
|
|
168
|
+
... on Frequency {
|
|
169
|
+
cron
|
|
170
|
+
}
|
|
171
|
+
... on HumanDuration {
|
|
172
|
+
years
|
|
173
|
+
months
|
|
174
|
+
weeks
|
|
175
|
+
days
|
|
176
|
+
hours
|
|
177
|
+
minutes
|
|
178
|
+
seconds
|
|
179
|
+
milliseconds
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
`,yt=s`
|
|
185
|
+
query getFacetsForOwner($ownerEntityRef: String!) {
|
|
186
|
+
facetsForOwner(ownerEntityRef: $ownerEntityRef) {
|
|
187
|
+
types {
|
|
188
|
+
value
|
|
189
|
+
count
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
`,vt=s`
|
|
194
|
+
query getProgramOverviewForOwner($ownerEntityRef: String!, $facet: FacetInput) {
|
|
195
|
+
programOverviewForOwner(
|
|
196
|
+
ownerEntityRef: $ownerEntityRef
|
|
197
|
+
facet: $facet
|
|
198
|
+
includeFilteredChecks: false
|
|
199
|
+
) {
|
|
200
|
+
programs {
|
|
201
|
+
program {
|
|
202
|
+
id
|
|
203
|
+
name
|
|
204
|
+
}
|
|
205
|
+
highestLevels {
|
|
206
|
+
...HighestLevel
|
|
207
|
+
}
|
|
208
|
+
levels {
|
|
209
|
+
...OverviewLevelResult
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
entityRefs
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
${ae}
|
|
216
|
+
${st}`,kt=(e,r,a)=>e();function Et(e,r=kt){return{deleteChecker(a,n){return r(i=>e.request(mt,a,{...n,...i}),"deleteChecker","mutation")},deleteProgram(a,n){return r(i=>e.request(dt,a,{...n,...i}),"deleteProgram","mutation")},getAllCertifications(a,n){return r(i=>e.request(pt,a,{...n,...i}),"getAllCertifications","query")},getAllPrograms(a,n){return r(i=>e.request(ut,a,{...n,...i}),"getAllPrograms","query")},getCertificationDetails(a,n){return r(i=>e.request(gt,a,{...n,...i}),"getCertificationDetails","query")},getCheckResultDetails(a,n){return r(i=>e.request(ht,a,{...n,...i}),"getCheckResultDetails","query")},getCheckers(a,n){return r(i=>e.request(ft,a,{...n,...i}),"getCheckers","query")},getFacetsForOwner(a,n){return r(i=>e.request(yt,a,{...n,...i}),"getFacetsForOwner","query")},getProgramOverviewForOwner(a,n){return r(i=>e.request(vt,a,{...n,...i}),"getProgramOverviewForOwner","query")}}}var ne=(e,r,a)=>{if(!r.has(e))throw TypeError("Cannot "+a)},l=(e,r,a)=>(ne(e,r,"read from private field"),a?a.call(e):r.get(e)),C=(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)},T=(e,r,a,n)=>(ne(e,r,"write to private field"),n?n.call(e,a):r.set(e,a),a),S,$,d,q,u;const I=Se({id:"plugin.soundcheck"}),Ct=e=>"response"in e&&"errors"in e.response,wt=e=>"response"in e&&"message"in e.response;class bt{constructor(r){C(this,S,void 0),C(this,$,void 0),C(this,d,void 0),C(this,q,n=>{var i,o,c;return Ct(n)?(c=(o=(i=n.response)==null?void 0:i.errors)==null?void 0:o[0].message)!=null?c:`${n}`:wt(n)?n.response.message:`${n}`}),C(this,u,async n=>{try{return await n()}catch(i){throw new Error(`Error from Soundcheck backend: ${l(this,q).call(this,i)}`)}}),T(this,S,r.fetchApi),T(this,$,r.discoveryApi);const a=new Ae("/graphql",{fetch:async(n,i)=>{const o=`${await l(this,$).getBaseUrl("soundcheck")}${n}`;return l(this,S).fetch(o,i)}});T(this,d,Et(a))}async getAllCertifications(r){return l(this,u).call(this,async()=>{const{certifications:a}=await l(this,d).getAllCertifications({entityRef:r});return a})}async getCertificationDetails(r,a){return l(this,u).call(this,async()=>{const{programCertification:n}=await l(this,d).getCertificationDetails({entityRef:r,programId:a});return n})}async getCheckResultDetails(r,a,n){return l(this,u).call(this,async()=>{const{checkResult:i}=await l(this,d).getCheckResultDetails({entityRef:r,programId:a,checkId:n});return i})}async getFacetsForOwner(r){return l(this,u).call(this,async()=>{const{facetsForOwner:a}=await l(this,d).getFacetsForOwner({ownerEntityRef:r});return a})}async getProgramOverviewForOwner(r,a){return l(this,u).call(this,async()=>{const{programOverviewForOwner:n}=await l(this,d).getProgramOverviewForOwner({ownerEntityRef:r,facet:a});return n})}async getAllPrograms(r){return l(this,u).call(this,async()=>{const{programs:a}=await l(this,d).getAllPrograms({programIds:r});return a})}async deleteProgram(r){return l(this,u).call(this,async()=>{const{programDeleted:a}=await l(this,d).deleteProgram({programId:r});return a})}async getCheckers(r){return l(this,u).call(this,async()=>{const{checkers:a}=await l(this,d).getCheckers({ids:r});return a})}async deleteChecker(r){return l(this,u).call(this,async()=>await l(this,d).deleteChecker({checkerId:r}))}}S=new WeakMap,$=new WeakMap,d=new WeakMap,q=new WeakMap,u=new WeakMap;const N=H({id:"soundcheck-entity"}),ie=k({id:"soundcheck-entity-certification-program-redirect",parent:N,path:"/:programId"}),oe=k({id:"soundcheck-entity-certification",parent:N,path:"/:programId/:checkId"}),D=H({id:"soundcheck-overview"});k({id:"soundcheck-checks",parent:D,path:"/checks"}),k({id:"soundcheck-programs",parent:D,path:"/programs"}),k({id:"soundcheck-program-details",parent:D,path:"/program/:programId"});const L=$e({id:"soundcheck",apis:[Ie({api:I,deps:{discoveryApi:Ne,fetchApi:De},factory:e=>new bt(e)})],routes:{entityContent:N}}),Rt=L.provide(Q({name:"EntitySoundcheckContent",component:()=>import("./EntitySoundcheckContent-ec837784.esm.js").then(e=>e.EntitySoundcheckContent),mountPoint:N})),St=L.provide(Le({name:"EntitySoundcheckCard",component:{lazy:()=>import("./index-7b7b98c2.esm.js").then(e=>e.EntitySoundcheckCard)}})),$t=L.provide(Q({name:"SoundcheckOverviewPage",component:()=>import("./index-b2b00eb3.esm.js").then(e=>e.OverviewPage),mountPoint:D})),It=Be(e=>new ze({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)}}})),Nt=e=>{const r=P(Fe),a=It(r);return t.createElement(Me,{client:a},e.children)};function ce(e){const r=P(I),a=ee(e);return V(["soundcheck/certifications",a],async()=>r.getAllCertifications(a))}function le(e,r){const a=P(I),n=ee(e);return V(["soundcheck/certifications",n,r],async()=>a.getCertificationDetails(n,r),{enabled:!!r})}var se=(e=>(e.GetAllPrograms="soundcheck/programs",e.GetCheckers="soundcheck/checkers",e))(se||{}),me=(e=>(e.DeleteChecker="soundcheck/deleteChecker",e.DeleteProgram="soundcheck/deleteProgram",e))(me||{});const Dt=p(()=>({modalContent:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",backgroundColor:"white"}})),de=Pe({}),Lt=e=>{const r=Dt(),[a,n]=O(!1),[i,o]=O(),c=Oe(),g=x(({title:w,message:be})=>(o({title:w,message:be}),n(!0),new Promise(Re=>{c.current=Re})),[]),v=x(()=>{c.current&&c.current(!0),n(!1)},[]),y=x(()=>{c.current&&c.current(!1),n(!1)},[]);return t.createElement(de.Provider,{value:{showModal:g}},e.children,i&&t.createElement(Ge,{open:a,onClose:y,"aria-labelledby":"confirmation-modal-title","aria-describedby":"confirmation-modal-description"},t.createElement(K,{className:r.modalContent},t.createElement(m,{id:"confirmation-modal-title",variant:"h1"},i.title),t.createElement(m,{id:"confirmation-modal-description",variant:"body1"},i.message),t.createElement(_,{color:"secondary",onClick:y,variant:"contained","aria-label":"cancel"},"Cancel"),t.createElement(_,{color:"primary",onClick:v,variant:"contained","aria-label":"confirm"},"Confirm"))))},Ft=()=>xe(de),pe=24,At=11,z=e=>e==="small"?1:2,Pt=p({root:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",borderWidth:"2px",fontWeight:700,width:({size:e})=>`${pe*z(e)}px`,height:({size:e})=>`${pe*z(e)}px`,fontSize:({size:e})=>`${At*z(e)}px`}}),ue=({className:e,label:r,size:a="small"})=>{const n=Pt({size:a});return t.createElement("span",{className:R(e,n.root),role:"img","aria-label":`${r} badge`},r)},Ot=p(e=>({root:{background:({color:r})=>r,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(",")}}})),M=({className:e,badge:r,size:a="small"})=>{const n=Ot({color:r.options.color,size:a});return t.createElement(ue,{className:R(e,n.root),size:a,label:`L${r.options.level}`})},xt=p({root:{borderColor:"currentColor",borderStyle:"dashed"}}),ge=({className:e,size:r="small"})=>{const a=xt();return t.createElement(ue,{className:R(e,a.root),size:r,label:"NL"})},B=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 Tt({description:e,documentationUrl:r}){const a=B();return r?t.createElement("div",{className:a.description},t.createElement(J,{content:e}),t.createElement(X,{to:r},"Learn more")):t.createElement("div",{className:a.description},t.createElement(J,{content:e}))}const he=({name:e,level:r,badge:a,description:n,documentationUrl:i})=>{const o=B();return t.createElement("div",{className:o.root},a?t.createElement(M,{size:"large",badge:a}):t.createElement(ge,{size:"large"}),t.createElement("div",null,t.createElement(m,{variant:"caption",className:o.level},r!=null?r:"No Level"),t.createElement(m,{className:o.title},e),n&&t.createElement(Tt,{description:n,documentationUrl:i})))},F=({children:e})=>{const[r,a]=O(!1);return Te(()=>{const n=setTimeout(()=>{a(!0)},250);return()=>clearTimeout(n)},[]),t.createElement(Ue,{in:r,timeout:250},e)},W=({hideDescription:e=!1})=>{const r=B();return t.createElement(F,null,t.createElement("div",{className:r.root},t.createElement(f,{width:44,height:44}),t.createElement("div",null,t.createElement(m,{variant:"caption",className:r.level},t.createElement(f,{width:100})),t.createElement(m,{variant:"h4",className:r.title},t.createElement(f,{width:300})),!e&&t.createElement(m,{variant:"body2"},t.createElement(f,null)))))},fe=p(e=>{const r=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{wrapper:{backgroundColor:r,color:E(e.palette.getContrastText(r),.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:a})=>[`"${a?"badge":"title"} title"`,`"${a?".":"description"} description"`].join(" "),gridTemplateColumns:"auto 1fr"},title:{gridArea:"title",textTransform:"uppercase",fontWeight:"bold",color:E(e.palette.getContrastText(r),.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:E(e.palette.getContrastText(r),.8),fontSize:e.typography.subtitle2.fontSize,marginTop:e.spacing(1)}}}),qt=e=>{const r=fe({badge:e.badge});return t.createElement("div",{className:r.wrapper},e.badge?t.createElement(M,{className:r.badge,badge:e.badge}):null,t.createElement(m,{className:r.title},e.title),e.description?t.createElement(m,{className:r.description},e.description):null)},zt=()=>{const e=fe({});return t.createElement(F,null,t.createElement("div",{className:e.wrapper},t.createElement(f,{className:e.title}),t.createElement(m,{className:e.description},t.createElement(f,null))))},Mt=p(e=>({root:{display:"inline-flex",alignItems:"center",gap:e.spacing(1)}})),ye=({timestamp:e,description:r})=>{const a=Mt(),n=te.fromISO(e).toLocaleString(te.DATETIME_FULL),i=Ke(e),o=r?`${r}: ${i}`:void 0;return t.createElement("div",{className:a.root},t.createElement(He,{title:n},t.createElement(m,{variant:"caption","aria-label":o},i)),t.createElement(Ze,null))},Bt=e=>({[h.Passed]:"Check passed",[h.NotReported]:"Check not reported",[h.Failed]:"Check failed",[h.NotApplicable]:"Check not applicable"})[e],Wt=b(e=>({root:{color:e.palette.success.main}}))(et),Gt=b(e=>({root:{color:e.palette.error.main}}))(tt),Ut=b(e=>({root:{color:e.palette.info.main}}))(at),Ht=b(e=>({root:{color:e.palette.text.disabled}}))(rt),ve=({result:e,className:r})=>{const a={className:r,"aria-label":Bt(e),"aria-hidden":!1};return e===h.Passed?t.createElement(Wt,{...a}):e===h.NotReported?t.createElement(Ut,{...a}):e===h.Failed?t.createElement(Gt,{...a}):e===h.NotApplicable?t.createElement(Ht,{...a}):null},ke=p(e=>({root:{display:"grid",width:"100%",gridTemplateColumns:"auto 1fr auto",gridColumnGap:e.spacing(1),padding:e.spacing(1),alignItems:"center","&.selected":{backgroundColor:E(e.palette.primary[e.palette.type],.2)},"&:hover, &:active, &:focus":{backgroundColor:E(e.palette.primary[e.palette.type],.3)}}})),Qt=({className:e,href:r,children:a})=>r?t.createElement(Xe,{to:r,className:e},a):t.createElement("div",{className:e},a),jt=({result:e,name:r,timestamp:a,selected:n=!1,href:i})=>{const o=ke(),c=R(o.root,{selected:n});return t.createElement(Qt,{href:i,className:c},t.createElement(ve,{result:e}),t.createElement(m,{variant:"body2"},r),a?t.createElement(ye,{timestamp:a}):null)},G=()=>{const e=ke();return t.createElement(F,null,t.createElement("div",{className:e.root},t.createElement(f,{width:24,height:24}),t.createElement(m,{variant:"body2"},t.createElement(f,null)),t.createElement(f,{width:100,height:24})))},Vt=()=>{const e=Ee();return t.createElement("div",{className:e.root},t.createElement(W,null),new Array(3).fill(null).map((r,a)=>t.createElement(t.Fragment,{key:`skeleton-level-${a}`},t.createElement(zt,null),t.createElement("ul",{className:e.checks},t.createElement(G,null),t.createElement(G,null),t.createElement(G,null)))))},Kt=p(e=>({root:{padding:e.spacing(3)},icon:{display:"none"},message:{padding:0},type:{fontWeight:700,lineHeight:1.75}})),U=e=>{const{type:r,...a}=Kt();return t.createElement(Ye,{severity:e.severity,elevation:1,classes:a,onClose:e.onClose},t.createElement(m,{classes:{root:r}},e.title),e.children)},_t=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"}}})),Jt=({checks:e,programId:r,checkId:a})=>{const n=_t(),i=j(oe);return e.length?t.createElement("ul",{className:n.checks},e.map(o=>t.createElement("li",{key:o.id,className:n.checkItem},t.createElement(jt,{...o,selected:o.id===a,href:i({programId:r,checkId:o.id})})))):t.createElement(m,{variant:"body2",className:n.noChecks},"No applicable checks at this level.")},Xt=({level:e,checkId:r,programId:a})=>{var n;return t.createElement(t.Fragment,null,t.createElement(qt,{badge:e.badge,title:e.name,description:e.description}),t.createElement(Jt,{checks:(n=e.checks)!=null?n:[],programId:a,checkId:r}))},Ee=p(e=>({root:{borderRight:`1px solid ${e.palette.divider}`},checks:{padding:0,margin:0,flex:1,listStyle:"none"}})),Yt=({programId:e,checkId:r})=>{var a,n;const i=Ee(),{entity:o}=Z(),{data:c,isLoading:g,isError:v}=le(o,e);return v?t.createElement("div",{className:i.root},t.createElement(K,{padding:2},t.createElement(U,{severity:"error",title:"Error loading certification"}))):g||!e?t.createElement(Vt,null):c?t.createElement("div",{className:i.root},t.createElement(he,{name:c.program.name,level:(a=c.highestLevel)==null?void 0:a.name,badge:(n=c.highestLevel)==null?void 0:n.badge,description:c.program.description,documentationUrl:c.program.documentationURL}),c==null?void 0:c.levels.map(y=>t.createElement(Xt,{key:y.ordinal,level:y,checkId:r,programId:e}))):null},Zt=()=>t.createElement(t.Fragment,null,t.createElement(W,{hideDescription:!0}),t.createElement(W,{hideDescription:!0})),Ce=({className:e})=>t.createElement("div",{className:e},t.createElement(Y,{title:"No certifications available",missing:"data",description:"There are no programs configured that apply to this entity."})),er=({ownerEntityRef:e})=>e?t.createElement(Y,{missing:"data",title:"Missing entities",description:t.createElement(t.Fragment,null,"Looks like the group"," ",Ve(Je(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,we=We(e=>({certificationWrapper:{display:"flex",justifyContent:"space-between",alignItems:"center"},infoCard:{display:"grid",gridRowGap:e.spacing(2)},emptyState:{"& > div":{backgroundColor:e.palette.background.paper}}})),A=({children:e,title:r})=>{const a=we();return t.createElement(je,{title:r},t.createElement("div",{className:a.infoCard},t.createElement(_e,{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))},tr=({title:e="Soundcheck"})=>{const{entity:r}=Z(),a=we(),{data:n,isError:i,isLoading:o}=ce(r),c=j(ie);return i?t.createElement(A,{title:e},t.createElement(U,{severity:"error",title:"Error loading certifications"})):o||!n?t.createElement(A,{title:e},t.createElement(Zt,null)):n.length===0?t.createElement(A,{title:e},t.createElement(Ce,{className:a.emptyState})):t.createElement(A,{title:e},n.map((g,v)=>{var y,w;return t.createElement(qe,{key:g.program.name},t.createElement("div",{className:a.certificationWrapper,"data-testid":"soundcheck-program-row"},t.createElement(he,{key:g.program.id,name:g.program.name,badge:(y=g.highestLevel)==null?void 0:y.badge,level:(w=g.highestLevel)==null?void 0:w.name}),t.createElement(X,{to:c({programId:g.program.id})},"View Details")),v<n.length-1?t.createElement(Qe,null):null)}))};export{U as A,re as B,Yt as C,Rt as E,F,M as L,me as M,ge as N,se as Q,h as R,Nt as S,ye as a,ce as b,ie as c,Ce as d,oe as e,tr as f,ve as g,er as h,Lt as i,L as j,Ft as k,St as l,$t as m,I as s,le as u};
|
|
217
|
+
//# sourceMappingURL=index-ab8d0702.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t,{useState as k,useEffect as R,useCallback as C,useMemo as I,createContext as He,useContext as Fe,useReducer as Ve,memo as S,Fragment as ze}from"react";import{useSearchParams as qe,Routes as Me,Route as B}from"react-router-dom";import{ContentHeader as X,HeaderTabs as Z,Link as O,EmptyState as We,Page as je,Header as Ge,Content as Ke}from"@backstage/core-components";import{useApi as N,identityApiRef as _e,useRouteRef as H,configApiRef as ee}from"@backstage/core-plugin-api";import{SpotifyLicenseBanner as Ue}from"@spotify/backstage-plugin-core";import{stringifyEntityRef as te,parseEntityRef as x}from"@backstage/catalog-model";import{useQuery as T,useQueryClient as re,useMutation as ne}from"@tanstack/react-query";import{s as P,Q as F,A as ae,M as oe,k as G,B as le,R as m,g as Je,L as ie,N as se,h as Qe,S as Ye,i as Xe}from"./index-ab8d0702.esm.js";import{catalogApiRef as ce,humanizeEntityRef as A,entityRouteRef as V}from"@backstage/plugin-catalog-react";import{makeStyles as E,alpha as de,TextField as K,CircularProgress as me,IconButton as pe,Menu as Ze,MenuItem as z,ListItemIcon as q,ListItemText as M,styled as _,Accordion as et,AccordionSummary as tt,AccordionDetails as rt,Grid as u,Typography as w,Button as L,Chip as ue,InputAdornment as nt,Card as at,CardContent as ot,Tooltip as he,LinearProgress as lt,withStyles as it}from"@material-ui/core";import st from"@material-ui/lab/Autocomplete";import ct from"@material-ui/icons/ArrowDropDown";import dt from"@material-ui/icons/MoreVert";import mt from"@material-ui/icons/ControlPointDuplicate";import pt from"@material-ui/icons/Delete";import ut from"@material-ui/icons/Edit";import ge from"@material-ui/icons/Visibility";import{DateTime as fe}from"luxon";import{createStyles as ht}from"@material-ui/core/styles";import ye from"@material-ui/icons/Add";import{useDrag as gt,useDrop as ft,DndProvider as yt}from"react-dnd";import Ee from"@material-ui/icons/DragIndicator";import Et from"@material-ui/icons/Close";import vt from"@material-ui/icons/Remove";import{HTML5Backend as wt}from"react-dnd-html5-backend";import{R as kt}from"./RefetchingIndicator-4f009bca.esm.js";import{countBy as ve}from"lodash";import{Skeleton as W}from"@material-ui/lab";import{VariableSizeGrid as bt}from"react-window";import"graphql-request";import"graphql-tag";import"@material-ui/core/styles/makeStyles";import"classnames";import"@material-ui/icons/Schedule";import"@material-ui/icons/Check";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/HelpOutline";import"react-use/lib/useDebounce";function Ct(){const e=N(ce);return T(["soundcheck/all-groups"],async()=>{const{items:r}=await e.getEntities({filter:{kind:"Group"}});return r.filter(n=>(n==null?void 0:n.kind)==="Group").map(n=>{var a,o,i,l;return{name:(l=(i=(o=(a=n.spec)==null?void 0:a.profile)==null?void 0:o.displayName)!=null?i:n.metadata.title)!=null?l:n.metadata.name,ref:te(n)}})})}function Nt(e){const r=N(P);return T(["soundcheck/facets-for-owner",e],async()=>r.getFacetsForOwner(e),{enabled:!!e})}function Rt(e){const r=N(P);return T([F.GetAllPrograms,e],async()=>r.getAllPrograms(e))}function we(e,r){const n=N(P);return T(["soundcheck/program-overview-for-owner",e,r],async()=>n.getProgramOverviewForOwner(e,r),{enabled:!!e&&!!(r!=null&&r.type)})}function xt(){const e=N(_e),r=N(ce);return T(["soundcheck/user-groups-claims"],async()=>{const{ownershipEntityRefs:n}=await e.getBackstageIdentity();return(await r.getEntitiesByRefs({entityRefs:n})).items.filter(a=>(a==null?void 0:a.kind)==="Group").map(a=>{var o,i,l,s;return{name:(s=(l=(i=(o=a.spec)==null?void 0:o.profile)==null?void 0:i.displayName)!=null?l:a.metadata.title)!=null?s:a.metadata.name,ref:te(a)}})})}function ke(e){const r=N(P);return T([F.GetCheckers,e],async()=>r.getCheckers(e))}const St=e=>{const[r,n]=k(void 0),[a,o]=k([[]]),[i,l]=k([!1]);R(()=>{r===void 0&&e!=null&&e.length&&n(e)},[e,r]);const s=C((h,y)=>{o(f=>{const v=[...f];return v[y]=[...v[y],h],v}),n(f=>f==null?void 0:f.filter(v=>v.id!==h.id)),l(f=>{if(f[y]){const v=[...f];return v[y]=!1,v}return f})},[]),d=C((h,y)=>{o(f=>{const v=[...f];return v[y]=v[y].filter(b=>b.id!==h.id),v}),n(f=>[...f!=null?f:[],h])},[]),c=C(()=>{o(h=>[...h,[]]),l(h=>[...h,!1])},[]),g=C(h=>{a.length>1&&o(y=>{const f=[...y],v=f.splice(h,1)[0];return n(b=>[...b!=null?b:[],...v]),f})},[a]),p=C(()=>{const h=a.map(y=>y.length===0);return l(h),!h.some(y=>y)},[a]);return{chips:r,inputChipsList:a,handleDrop:s,handleDelete:d,addInput:c,removeInput:g,inputErrors:i,setInputErrors:l,areInputsValid:p}},$t=()=>{const[e,r]=qe(),n=Object.fromEntries(e.entries()),[a,o]=k(n);return R(()=>{r(a,{replace:!0})},[a]),[a,o]},Tt=()=>{const{data:e,isLoading:r,isError:n}=xt(),{data:a,isLoading:o,isError:i}=Ct();return{options:I(()=>{const l=[];return e&&l.push(...e.map(({name:s,ref:d})=>({name:s,ref:d,key:"My Groups"}))),a&&l.push(...a.map(({name:s,ref:d})=>({name:s,ref:d,key:"All Groups"}))),l},[e,a]),isLoading:r||o,isError:n||i}},Pt=E(e=>({root:{width:"100%",minWidth:250},textField:{"& $notchedOutline":{borderColor:de(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:{}})),It=e=>{const{onChange:r,initialValue:n,setError:a}=e,{options:o,isLoading:i,isError:l}=Tt(),s=Pt(),[d,c]=k(null);R(()=>{if(!i&&o!=null&&o.length&&!d){const p=n?o.find(h=>h.ref===n):o[0];p&&(c(p),r==null||r(p.ref))}},[i,o,d,r,n]);const g=C((p,h)=>{c(h),r==null||r(h==null?void 0:h.ref)},[r,c]);return R(()=>{a==null||a(l?new Error("Error loading groups"):void 0)},[l,a]),l?null:t.createElement(st,{"aria-label":"Current group",className:s.root,classes:{clearIndicator:s.clearIndicator,popupIndicator:s.popupIndicator},disableClearable:!0,options:o!=null?o:[],loading:i,groupBy:p=>p.key,value:d,freeSolo:!1,onChange:g,getOptionLabel:p=>p.name,renderInput:p=>t.createElement(K,{...p,variant:"outlined",placeholder:i?"Loading":"Select a group",className:s.textField,InputProps:{...p.InputProps,className:s.input,classes:{notchedOutline:s.notchedOutline},endAdornment:t.createElement(t.Fragment,null,i?t.createElement(me,{color:"inherit",size:20}):null,p.InputProps.endAdornment)}})})},At="#DFE0F4",Lt="#4275CA",Dt=({handleEdit:e,handleDuplicate:r,handleDelete:n,handleView:a})=>{const[o,i]=k(null),l=!!o,s=c=>{i(c.currentTarget)},d=()=>{i(null)};return t.createElement(t.Fragment,null,t.createElement(pe,{"aria-label":"summary-accordion-actions",id:"summary-accordion-action-menu-button","aria-controls":l?"summary-accordion-action-menu":void 0,"aria-expanded":l?"true":void 0,"aria-haspopup":"true",onClick:s},t.createElement(dt,null)),t.createElement(Ze,{id:"summary-accordion-action-menu",anchorEl:o,open:l,onClose:d,getContentAnchorEl:null,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},MenuListProps:{"aria-labelledby":"summary-accordion-action-menu-button"}},t.createElement(z,{onClick:c=>{a(c),d()}},t.createElement(q,null,t.createElement(ge,{fontSize:"small"})),t.createElement(M,null,"View")),e&&t.createElement(z,{onClick:c=>{e(c),d()}},t.createElement(q,null,t.createElement(ut,{fontSize:"small"})),t.createElement(M,null,"Edit")),t.createElement(z,{onClick:c=>{r(c),d()}},t.createElement(q,null,t.createElement(mt,{fontSize:"small"})),t.createElement(M,null,"Duplicate")),n&&t.createElement(z,{onClick:c=>{n(c),d()}},t.createElement(q,null,t.createElement(pt,{fontSize:"small"})),t.createElement(M,null,"Delete"))))},Bt=_(e=>t.createElement(et,{...e}))(({theme:e})=>({border:`1px solid ${e.palette.divider}`,"&:not(:last-child)":{borderBottom:0},"&:before":{display:"none"}})),Ot=_(e=>t.createElement(tt,{expandIcon:t.createElement(ct,null),...e}))(()=>({flexDirection:"row-reverse",backgroundColor:At})),Ht=_(rt)(({theme:e})=>({padding:e.spacing(2)})),be=({title:e,description:r,metadata:n,handleDuplicate:a,handleDelete:o,handleEdit:i,handleView:l,children:s})=>{const[d,c]=k(!1),g=()=>{c(p=>!p)};return t.createElement(Bt,{expanded:d},t.createElement(Ot,{"aria-controls":`${e}-panel-content`,id:`${e}-summary-accordion`,IconButtonProps:{onClick:g}},t.createElement(u,{container:!0,spacing:0},t.createElement(u,{item:!0,xs:12,sm:!0,container:!0,direction:"column",spacing:0,onClick:g},t.createElement(w,null,e),t.createElement(w,null,r),t.createElement(u,{container:!0,direction:"row",spacing:2},n==null?void 0:n.map(p=>t.createElement(u,{item:!0,key:p.title},t.createElement(w,null,p.title,": ",p.data))))),t.createElement(u,{item:!0},t.createElement(Dt,{handleDelete:o,handleEdit:i,handleDuplicate:a,handleView:l})))),t.createElement(Ht,null,s))},Ce=He({}),Ft=e=>{const[r,n]=k(),a=C(i=>{n(i)},[]),o=C(()=>{n(null)},[]);return t.createElement(Ce.Provider,{value:{showAlert:a,clearAlert:o}},r&&t.createElement(ae,{severity:r.severity,title:r.title,onClose:o},r.message),e.children)},U=()=>Fe(Ce),Vt="Error Deleting Check";function zt(){const e=N(P),r=re(),{showAlert:n}=U(),a=async o=>{const i=await e.deleteChecker(o);if(!i)throw new Error(`Failed to delete check ${o}`);return i};return ne([oe.DeleteChecker],a,{onSuccess:()=>{r.invalidateQueries({queryKey:[F.GetCheckers]})},onError:(o,i)=>{let l=`Failed to delete check ${i}`;o instanceof Error&&(l=o.message),n({severity:"error",title:Vt,message:l})}})}const qt=({checker:{id:e,ownerEntityRef:r,name:n,description:a,isEditable:o},children:i})=>{const{showModal:l}=G(),{mutate:s}=zt(),d=C(async()=>{await l({title:"Delete Check",message:`Are you sure you want to delete the check '${n}'?`})&&s(e)},[l,n,s,e]);return t.createElement(be,{title:n!=null?n:e,description:a,metadata:[{title:"ID",data:e},{title:"Owner",data:r!=null?r:""}],children:i,handleView:()=>{},handleEdit:o?()=>{}:void 0,handleDuplicate:()=>{},handleDelete:d})},Mt=E(e=>({headerButtons:{display:"flex",gap:e.spacing(1),flexWrap:"nowrap"}})),Wt=({setShowAddCheckView:e,checkers:r})=>{const n=Mt();return t.createElement(u,{container:!0,direction:"row"},t.createElement(X,{title:"Checks"},t.createElement("div",{className:n.headerButtons},t.createElement(L,{variant:"contained",color:"primary",onClick:()=>e(!0)},"Add New Check"))),t.createElement(u,{container:!0,item:!0,direction:"column",spacing:2,xs:9},r.map(a=>t.createElement(u,{item:!0,key:a.id},t.createElement(qt,{checker:a},t.createElement(u,{container:!0,direction:"row"}))))))},Ne=({setShowAddView:e,saveButtonText:r,onSave:n,isLoading:a})=>t.createElement(u,{item:!0,container:!0,spacing:0},t.createElement(u,{container:!0,item:!0,xs:11,spacing:0},t.createElement(L,{variant:"contained",color:"primary",disabled:a,onClick:()=>{n()}},r)),t.createElement(u,{item:!0,xs:1},t.createElement(L,{variant:"contained",color:"primary",onClick:()=>e(!1)},"Cancel"))),jt=[{factRef:"test1:default/fact1",entityRef:"component:default/test-entity-1",data:{value:"test"},timestamp:fe.now().toString()},{factRef:"test1:default/fact1",entityRef:"component:default/test-entity-2",data:{value:"foo"},timestamp:fe.now().toString()}];le.Medal,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Failed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Failed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Failed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported,m.Passed,m.NotReported;var Gt=(e=>(e[e.SelectFacts=0]="SelectFacts",e[e.DefineRule=1]="DefineRule",e))(Gt||{});const Kt=({setShowAddCheckView:e})=>{const[r,n]=k(0);return t.createElement(u,{container:!0,spacing:6},t.createElement(Ne,{setShowAddView:e,saveButtonText:"Save new check",isLoading:!1,onSave:()=>{}}),t.createElement(u,{item:!0,container:!0,direction:"row",xs:12},t.createElement(u,{container:!0,item:!0,direction:"column",xs:6},t.createElement(w,null,"Title"),t.createElement(w,null,"Id?"),t.createElement(w,null,"Description?"),t.createElement(w,null,"Facts this check is based on (AKA the rule definition portion)"),t.createElement(w,{onClick:()=>n(0)},"+ Add Fact")),t.createElement(u,{item:!0,direction:"column",xs:6},r===0&&t.createElement(w,null,JSON.stringify(jt,null,2)),r===1&&t.createElement(w,null,"Define rule window"))))},_t=E(e=>({checksPageContainer:{padding:e.spacing(3)}})),Ut=()=>{const e=_t(),{data:r}=ke(),[n,a]=k(!1);return t.createElement("div",{className:e.checksPageContainer},n?t.createElement(Kt,{setShowAddCheckView:a}):t.createElement(Wt,{setShowAddCheckView:a,checkers:r!=null?r:[]}))};E(()=>ht({boldText:{fontWeight:"bold"}}));const Jt="Error Deleting Program";function Qt(){const e=N(P),r=re(),{showAlert:n}=U(),a=async o=>{const i=await e.deleteProgram(o);if(!i)throw new Error(`Failed to delete program ${o}`);return i};return ne([oe.DeleteProgram],a,{onSuccess:()=>{r.invalidateQueries({queryKey:[F.GetAllPrograms]})},onError:(o,i)=>{let l=`Failed to delete program ${i}`;o instanceof Error&&(l=o.message),n({severity:"error",title:Jt,message:l})}})}const Yt=({summary:{name:e,id:r,ownerEntityRef:n,description:a},children:o})=>{const{showModal:i}=G(),{mutate:l}=Qt(),{showAlert:s}=U(),d=C(async()=>{await i({title:"Delete Program",message:`Are you sure you want to delete program with id: ${r}?`})&&l(r)},[i,r,l]);return t.createElement(be,{title:e,description:a,metadata:[{title:"ID",data:r},{title:"Owner",data:n}],children:o,handleView:()=>s({title:"Alert Title",message:"Alert message",severity:"error"}),handleEdit:()=>{},handleDuplicate:()=>{},handleDelete:d})},Xt=E(e=>({headerButtons:{display:"flex",gap:e.spacing(1),flexWrap:"nowrap"}})),Zt=({setShowAddProgramView:e})=>{const r=Xt(),{data:n}=Rt();return t.createElement(u,{container:!0,direction:"row"},t.createElement(X,{title:"Programs"},t.createElement("div",{className:r.headerButtons},t.createElement(L,{variant:"contained",color:"primary",onClick:()=>e(!0)},"Add new program"))),t.createElement(u,{container:!0,item:!0,direction:"column",spacing:2,xs:9},n==null?void 0:n.map(a=>t.createElement(u,{item:!0,key:a.id},t.createElement(Yt,{summary:a},t.createElement(u,{container:!0,direction:"row"}))))),t.createElement(u,{item:!0,container:!0,direction:"column",xs:3},"Filters go here"))},er=E(e=>({titleInput:{marginBottom:e.spacing(3)},inputBase:{fontSize:e.typography.h4.fontSize,fontWeight:700}})),tr=({programName:e,programNameError:r,handleProgramNameChange:n})=>{const a=er();return t.createElement(K,{fullWidth:!0,placeholder:"Untitled program",value:e,onChange:n,className:a.titleInput,InputProps:{disableUnderline:!0,classes:{input:a.inputBase}},error:r,helperText:r?"Program name must be at least 1 character and less than 100 characters":""})},rr=E(e=>({button:{border:"none",fontWeight:700,fontSize:e.typography.subtitle2.fontSize,lineHeight:"19px",color:Lt,textTransform:"none"}})),J=({label:e,...r})=>{const n=rr();return t.createElement(L,{className:n.button,...r},e)},nr=E(e=>({chip:{width:"100%",justifyContent:"space-between",background:e.palette.common.white,border:`1px solid ${e.palette.grey[300]}`,borderRadius:4}})),ar=({label:e,id:r})=>{const[n,a]=gt(()=>({type:"chip",item:{id:r,label:e},collect:i=>({isDragging:i.isDragging()})})),o=nr();return t.createElement(ue,{ref:a,label:e,className:o.chip,icon:t.createElement(Ee,{"data-testid":"drag-indicator-icon"}),onDelete:()=>{},deleteIcon:t.createElement(ge,{"data-testid":"visibility-icon"})})},or=({searchTerm:e,setSearchTerm:r,showClear:n=!0,placeholder:a="Search...",...o})=>t.createElement(K,{...o,fullWidth:!0,placeholder:a,value:e,onChange:i=>{r(i.target.value)},InputProps:{endAdornment:n&&e?t.createElement(nt,{position:"end"},t.createElement(pe,{edge:"end",onClick:()=>{r("")}},t.createElement(Et,null))):null}}),Re=E(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%"}})),lr=()=>{const e=Re();return t.createElement(u,{container:!0,className:e.loadingContainer},t.createElement(me,null))},ir=({chips:e})=>t.createElement(t.Fragment,null,e.map(r=>t.createElement(ar,{key:r.id,id:r.id,label:r.label}))),sr=()=>t.createElement(w,{variant:"body1",color:"textSecondary"},"There are no matches."),cr=({chips:e=[],isLoading:r})=>{const n=Re(),[a,o]=k(""),i=I(()=>e.filter(d=>d.label.toLowerCase().includes(a.toLowerCase())),[e,a]),l=e.length>0||a,s=()=>{if(r)return t.createElement(lr,null);if(i.length>0)return t.createElement(ir,{chips:i});if(l)return t.createElement(sr,null)};return t.createElement(u,{container:!0},t.createElement(u,{item:!0,xs:12,className:n.columnHeader},t.createElement(w,{variant:"subtitle1",className:n.subtitle},"Checks"),t.createElement(J,{label:"Add Check",startIcon:t.createElement(ye,null)})),t.createElement(u,{item:!0,xs:12},t.createElement(or,{searchTerm:a,disabled:r,setSearchTerm:o,placeholder:"Search checks...",variant:"outlined",size:"small"})),t.createElement(u,{item:!0,className:n.chipContainer,xs:12},s()))},dr=E(e=>({input:{background:e.palette.common.white,border:`1px solid ${e.palette.grey[600]}`,borderRadius:4,padding:e.spacing(1),minHeight:80},error:{border:"1px solid red"},chip:{width:"100%",justifyContent:"space-between",background:e.palette.common.white,border:`1px solid ${e.palette.grey[300]}`,borderRadius:4},chipContainer:{display:"flex",flexDirection:"column"}})),mr=({chips:e,onDelete:r,onDrop:n,error:a=!1})=>{const[{isOver:o},i]=ft(()=>({accept:"chip",drop:s=>{n(s)},collect:s=>({isOver:s.isOver()})})),l=dr();return t.createElement("div",{ref:i,style:{backgroundColor:o?"white":"#f0f0f0"},className:`${l.input} ${a?l.error:""}`,"data-testid":"droppable-input"},t.createElement("div",{className:l.chipContainer},e.map(s=>t.createElement(ue,{key:s.id,label:s.label,className:l.chip,icon:t.createElement(Ee,null),onDelete:()=>r(s)}))))},pr=E(e=>({columnHeader:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(2)},subtitle:{fontSize:e.typography.h6.fontSize},levelHeader:{display:"flex",justifyContent:"space-between",alignItems:"center"}})),ur=({inputChipsList:e,handleDelete:r,handleDrop:n,addInput:a,removeInput:o,levelsErrors:i})=>{const l=pr();return t.createElement(u,{container:!0},t.createElement(u,{item:!0,xs:12,className:l.columnHeader},t.createElement(w,{variant:"subtitle1",className:l.subtitle},"Levels"),t.createElement(J,{label:"Add Level",startIcon:t.createElement(ye,null),onClick:a})),e.map((s,d)=>t.createElement(u,{container:!0,item:!0,xs:12,key:d,spacing:1},t.createElement(u,{item:!0,xs:12,className:l.levelHeader},t.createElement(w,{variant:"subtitle1"},"Level ",d+1),e.length>1&&t.createElement(J,{label:"Remove Level",startIcon:t.createElement(vt,null),onClick:()=>o(d)})),t.createElement(u,{item:!0,xs:12},t.createElement(mr,{chips:s,onDelete:c=>r(c,d),onDrop:c=>n(c,d),error:i[d]})))))};var hr=(e=>(e.SetProgramNameError="VALIDATE_NAME",e.SetName="SET_NAME",e))(hr||{});const gr={programName:"",programNameError:!1},fr=(e,r)=>{switch(r.type){case"SET_NAME":return{...e,programName:r.value};case"VALIDATE_NAME":return{...e,programNameError:r.value};default:return e}},yr=(e="")=>{const[r,n]=Ve(fr,{...gr,programName:e}),a=()=>{const i=r.programName.trim().length,l=i>0&&i<=100;return n({type:"VALIDATE_NAME",value:!l}),l},o=i=>{n({type:"SET_NAME",value:i.target.value}),r.programNameError&&a()};return{programName:r.programName,programNameError:r.programNameError,handleProgramNameChange:o,isProgramNameValid:a}},Er=E(e=>({description:{fontSize:e.typography.subtitle1.fontSize},cardContent:{"& *":{fontWeight:700}}})),vr=({setShowAddProgramView:e})=>{const{programName:r,programNameError:n,handleProgramNameChange:a,isProgramNameValid:o}=yr(),{showModal:i}=G(),{data:l,isLoading:s}=ke(),d=(l!=null?l:[]).filter(D=>!!D).map(D=>({id:D.id,label:D.name})),{chips:c,inputChipsList:g,handleDrop:p,handleDelete:h,addInput:y,removeInput:f,inputErrors:v,areInputsValid:b}=St(d),Oe=async()=>{o()&&b()&&await i({title:"Save Program",message:`Are you sure you want to save program: ${r}?`})&&JSON.stringify({programName:r,checks:[...g]},null,2)},Y=Er();return t.createElement(u,{container:!0,spacing:3},t.createElement(Ne,{setShowAddView:e,saveButtonText:"Save new program",isLoading:s,onSave:Oe}),t.createElement(u,{item:!0,xs:12},t.createElement(tr,{programName:r,programNameError:n,handleProgramNameChange:a})),t.createElement(u,{item:!0,xs:12},t.createElement(at,null,t.createElement(ot,{className:Y.cardContent},t.createElement(u,{container:!0,spacing:8},t.createElement(u,{item:!0,xs:12},t.createElement(w,{className:Y.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(u,{item:!0,xs:4},t.createElement(ur,{inputChipsList:g,handleDelete:h,handleDrop:p,addInput:y,removeInput:f,levelsErrors:v})),t.createElement(u,{item:!0,xs:4},t.createElement(cr,{chips:c,isLoading:s})),t.createElement(u,{item:!0,xs:4}))))))},wr=E(e=>({programsPageContainer:{padding:e.spacing(3)},headerButtons:{display:"flex",gap:e.spacing(1),flexWrap:"nowrap"}})),kr=({})=>{const e=wr(),[r,n]=k(!1);return t.createElement("div",{className:e.programsPageContainer},r?t.createElement(yt,{backend:wt},t.createElement(vr,{setShowAddProgramView:n})):t.createElement(Zt,{setShowAddProgramView:n}))},br=()=>t.createElement(t.Fragment,null,"Fact Collectors Page"),Cr=e=>({key:`skeleton${e}`,label:"",id:`skeleton${e}`}),Nr=()=>{const e=Array.from({length:4},(r,n)=>Cr(n));return t.createElement(Z,{tabs:e})},Rr=E(e=>({root:{borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`},tab:{textTransform:"uppercase",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)}})),xr=({unfilteredFacets:e,onChange:r,type:n})=>{var a,o,i;const l=Rr(),s={types:(a=e==null?void 0:e.types.filter(({count:p})=>p>0))!=null?a:[]},d=C(p=>{var h;r((h=s==null?void 0:s.types[p].value)!=null?h:"")},[s==null?void 0:s.types,r]);R(()=>{var p,h;const y=(s==null?void 0:s.types)&&s.types.length>=0,f=!n&&y,v=n&&y&&!(s!=null&&s.types.find(({value:b})=>b===n));(f||v)&&r((h=(p=s==null?void 0:s.types[0])==null?void 0:p.value)!=null?h:"")},[n,s==null?void 0:s.types,r]);const c=(o=s==null?void 0:s.types.map(({value:p,count:h})=>({key:p,label:`${p} (${h>50?"50+":h})`,id:p,tabProps:{className:l.tab}})))!=null?o:[];if(!c.length)return null;const g=(i=s==null?void 0:s.types.findIndex(p=>p.value===n))!=null?i:-1;return t.createElement(t.Fragment,null,t.createElement(kt,null),t.createElement(Z,{onChange:d,tabs:c,selectedIndex:g>-1?g:void 0}))},Sr=E(e=>({root:{height:"8px",minWidth:"64px",marginLeft:e.spacing(2),borderRadius:"100vh",backgroundColor:e.palette.background.default},bar:{backgroundColor:e.palette.success.main,transition:"none"}})),xe=e=>{var r,n;const a=Sr(e),o=I(()=>Object.entries(e.progress).reduce((l,[,s])=>l+s,0),[e.progress]);if(o===0)return null;const i=(r=e.progress[m.Passed])!=null?r:0;return t.createElement(he,{arrow:!0,title:`Check passing for ${i} of ${o} ${o===1?"entity":"entities"}`,enterDelay:0,placement:"top"},t.createElement(lt,{variant:"determinate",value:((n=e.progress[m.Passed])!=null?n:0)/o*100,classes:{root:a.root,bar:a.bar}}))},$r=E(e=>({headerWrapper:{marginTop:e.spacing(.5)},entityRefName:{fontWeight:"bold"},iconWrapper:{padding:e.spacing(1.5,.5),display:"flex",alignItems:"center",justifyContent:"center"}})),Tr=({check:{name:e,description:r},icon:n,entityRef:a})=>{const o=$r();return t.createElement(u,{spacing:1},t.createElement(u,{container:!0,direction:"row",spacing:1,wrap:"nowrap"},t.createElement("div",{className:o.iconWrapper},n),t.createElement(w,{variant:"h6",className:o.headerWrapper,noWrap:!0},e)),t.createElement(u,{item:!0,wrap:"nowrap"},t.createElement(w,{variant:"subtitle2",className:o.entityRefName},A(x(a),{defaultKind:"component"}))),t.createElement(w,{variant:"caption"},r))},Pr=it(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}}})(he),Ir=({children:e,check:r,icon:n,entityRef:a})=>t.createElement(Pr,{arrow:!0,title:t.createElement(Tr,{check:r,icon:n,entityRef:a}),enterDelay:150,placement:"top"},e),Ar=E(e=>({root:{padding:0},iconWrapper:{padding:e.spacing(1.5),display:"flex",alignItems:"center",justifyContent:"center"},link:{"&:hover $iconWrapper, &:active $iconWrapper, &:focus $iconWrapper":{backgroundColor:e.palette.infoBackground}},icon:{width:"17px",height:"17px"},virtualized:{borderBottom:`1px solid ${e.palette.divider}`,borderRight:`1px solid ${e.palette.divider}`}})),Se=S(({programId:e,check:r,entityRef:n,result:a,entityRoute:o,isVirtualized:i})=>{const l=Ar();if(typeof n!="string"){const g=t.createElement("div",{className:l.iconWrapper},t.createElement("div",{className:l.icon}));return i?t.createElement("div",{className:`${l.root} ${l.virtualized}`,"aria-hidden":!0},g):t.createElement("td",{className:l.root,"aria-hidden":!0},g)}const s=t.createElement(Je,{className:l.icon,result:a!=null?a:m.NotReported}),d=t.createElement("div",{className:l.iconWrapper},s),c=a&&a===m.NotApplicable?d:t.createElement(O,{className:l.link,to:`${o(x(n))}/soundcheck/${e}/${r.id}`},d);return i?t.createElement("div",{className:`${l.root} ${l.virtualized}`},t.createElement(Ir,{check:r,icon:s,entityRef:n},c)):t.createElement("td",{className:`${l.root}`},c)}),$e=8,Lr=16,$={programTitle:70,levelTitle:30,check:42,entityRefFooter:100},j={programTitle:350+Lr*2,checkResult:42},Dr=e=>e.reduce((r,n)=>r+n.height,0),Br=e=>e*j.checkResult+j.programTitle,Or=e=>e.filter(r=>r!==void 0).map(r=>A(x(r),{defaultKind:"component"})).reduce((r,n)=>r.length>n.length?r:n,""),Hr=e=>$e*e+$e,Te="NoLevel",Fr=e=>({name:Te,badge:{options:{level:0,color:""},variant:le.Medal},entityRef:e,ordinal:0}),Pe=E(e=>({checkNameCell:{padding:0,backgroundColor:e.palette.background.paper},checkNameContent:{padding:`0 ${e.spacing(2)}px`,display:"flex",justifyContent:"space-between",alignItems:"center"},checkNameTypography:{overflow:"hidden",textOverflow:"ellipsis"},checkIndicator:{flexBasis:e.spacing(8)},checkNameCellVirtualized:{height:`${$.check}px`,lineHeight:`${$.check}px`,borderBottom:`1px solid ${e.palette.divider}`,borderRight:`1px solid ${e.palette.divider}`}})),Vr=S(({programId:e,programName:r,check:n,entityRefs:a,results:o,entityRoute:i})=>{const l=Pe(),s=I(()=>ve(o.filter(({result:c})=>c!==m.NotApplicable),"result"),[o]),d=new Map(o.map(c=>[c.entityRef,c.result]));return t.createElement("tr",{"data-testid":"program-check-row"},t.createElement("th",{scope:"row",className:l.checkNameCell,"aria-label":`${n.name} check for ${r} program`},t.createElement("div",{className:l.checkNameContent},t.createElement(w,{className:l.checkNameTypography,variant:"subtitle2",component:"p"},n.name),t.createElement(xe,{className:l.checkIndicator,progress:s}))),a.map((c,g)=>t.createElement(Se,{key:g,programId:e,check:n,entityRef:c,result:typeof c=="string"?d.get(c):void 0,entityRoute:i})))}),zr=({name:e,progress:r})=>{const n=Pe();return t.createElement("div",{className:n.checkNameCell,"aria-label":`${e} check`},t.createElement("div",{className:`${n.checkNameContent} ${n.checkNameCellVirtualized}`},t.createElement(w,{variant:"subtitle2",component:"p",className:n.checkNameTypography},e),t.createElement(xe,{className:n.checkIndicator,progress:r})))},qr=E(e=>({virtualized:{borderRight:`1px solid ${e.palette.divider}`,height:`${$.programTitle}px`,display:"flex",justifyContent:"center",alignItems:"center"}})),Mr=S(({entityRef:e,highestLevels:r})=>{const n=r.find(a=>a.entityRef===e);return t.createElement(t.Fragment,null,n!=null&&n.badge?t.createElement(ie,{badge:n.badge}):t.createElement(se,null))}),Wr=({highestLevel:e})=>{const r=qr();if(!(e!=null&&e.badge))return t.createElement("div",{className:r.virtualized},"\xA0");const n=e.name!==Te;return t.createElement("div",{className:r.virtualized},n?t.createElement(ie,{badge:e.badge}):t.createElement(se,null))},Ie=E(e=>({programNameCell:{padding:0,position:"sticky",backgroundColor:e.palette.background.paper},programNameContent:{padding:e.spacing(2)},programNameTypography:{overflow:"hidden",textOverflow:"ellipsis"},badgeCellContent:{display:"flex",justifyContent:"center",alignItems:"center"},programNameCellVirtualized:{borderRight:`1px solid ${e.palette.divider}`}})),jr=S(({program:e,entityRefs:r,highestLevels:n})=>{const a=Ie();return t.createElement("tr",{"data-testid":"program-title-row"},t.createElement("th",{scope:"row",className:a.programNameCell},t.createElement("div",{className:a.programNameContent},t.createElement(w,{className:a.programNameTypography,variant:"h5",component:"p"},e.name))),r.map((o,i)=>typeof o!="string"?t.createElement("td",{key:i,"aria-hidden":!0}):t.createElement("td",{key:i,"data-testid":"program-certification-cell"},t.createElement("div",{className:a.badgeCellContent},t.createElement(Mr,{entityRef:o,highestLevels:n})))))}),Gr=S(({name:e})=>{const r=Ie();return t.createElement("div",{className:`${r.programNameCell} ${r.programNameCellVirtualized}`},t.createElement("div",{className:r.programNameContent},t.createElement(w,{className:r.programNameTypography,variant:"h5",component:"p"},e)))}),Q=E(e=>{const r=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{root:{color:de(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:`${$.levelTitle}px`}}}),Kr=S(({level:e,entityRefs:r,programName:n})=>{const a=Q();return t.createElement("tr",{className:a.root,"data-testid":"program-level-row"},t.createElement("th",{scope:"row",className:a.root},t.createElement("div",{className:a.levelContent},t.createElement(w,{className:a.levelTypography,variant:"subtitle2",component:"p","aria-label":`${e.name} for ${n} program`},e.name))),r.map((o,i)=>t.createElement("td",{key:i,className:a.root,"aria-hidden":!0})))}),_r=({name:e})=>{const r=Q();return t.createElement("div",{className:`${r.levelHeaderCell} ${r.root}`,"aria-label":`${e}`},t.createElement(w,{variant:"subtitle2",component:"p",className:r.levelTypography},e))},Ur=()=>{const e=Q();return t.createElement("div",{className:`${e.levelHeaderCell} ${e.root}`},"\xA0")},Jr=({program:e,highestLevels:r,levels:n,entityRefs:a,entityRoute:o})=>t.createElement("tbody",null,t.createElement(jr,{program:e,entityRefs:a,highestLevels:r}),n.map((i,l)=>t.createElement(ze,{key:l},t.createElement(Kr,{entityRefs:a,level:i,programName:e.name}),i.checks.map(({check:s,results:d},c)=>t.createElement(Vr,{key:c,check:s,programId:e.id,programName:e.name,entityRefs:a,results:d,entityRoute:o}))))),Ae=E(e=>({root:{position:"sticky",bottom:"-1px",backgroundColor:e.palette.background.default,boxShadow:`0 -1px ${e.palette.divider}`,"& td$cell, & th$cell":{border:0,padding:e.spacing(1)},"& td$cell":{backgroundColor:e.palette.background.default}},row:{boxShadow:`1px 0 ${e.palette.background.default}, -1px 0 ${e.palette.background.default}`},cell:{verticalAlign:"top"},cellInner:{textOrientation:"mixed",writingMode:"vertical-lr",transform:"rotate(-20deg)",transformOrigin:`100% ${e.spacing(1)}px`,wordBreak:"keep-all",fontWeight:"bold",overflow:"hidden",textOverflow:"ellipsis",maxHeight:"max(15vh, 175px)"}})),Qr=({entityRefs:e})=>{const r=H(V),n=Ae();return t.createElement("tfoot",{className:n.root,"data-testid":"results-table-footer"},t.createElement("tr",{className:n.row},t.createElement("td",{className:n.cell}),e.map((a,o)=>typeof a!="string"?t.createElement("th",{key:o,className:n.cell,"aria-hidden":!0}):t.createElement("th",{scope:"col",key:o,className:n.cell},t.createElement("div",{className:n.cellInner},t.createElement(O,{to:r(x(a))},A(x(a),{defaultKind:"component"})))))))},Yr=({entityRef:e})=>{const r=H(V),n=Ae(),a=e?t.createElement(O,{to:r(x(e))},A(x(e),{defaultKind:"component"})):t.createElement(t.Fragment,null);return t.createElement("div",{className:n.cell},t.createElement("div",{className:n.cellInner},a))},Xr=E(e=>({table:{backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap","& th, & td":{border:`1px solid ${e.palette.divider}`,borderCollapse:"collapse"},paddingBottom:e.spacing(2)},programTitle:{padding:e.spacing(2)},checkResult:{padding:e.spacing(1.5)},title:{padding:`${e.spacing(1)}px ${e.spacing(2)}px`},header:{backgroundColor:e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100]}})),Le=()=>{const e=Xr(),r=new Array(25).fill(void 0),n=new Array(5).fill(void 0),a=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(W,{width:180,height:40})),r.map((o,i)=>t.createElement("td",{key:i}))),a.map((o,i)=>t.createElement(t.Fragment,{key:i},t.createElement("tr",{className:e.header},t.createElement("td",{className:e.title},t.createElement(W,{width:180})),r.map((l,s)=>t.createElement("td",{key:s}))),n.map((l,s)=>t.createElement("tr",{key:s},t.createElement("td",{className:e.title},t.createElement(W,{width:240})),r.map((d,c)=>t.createElement("td",{key:c,className:e.checkResult},t.createElement(W,{width:18,height:18,variant:"rect"})))))))))},Zr=E(e=>({root:{width:"100%"},table:{overflow:"auto",backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap",textAlign:"left","& th, & td":{border:`1px solid ${e.palette.divider}`,borderCollapse:"collapse"},"& th:first-of-type":{position:"sticky",left:0,zIndex:1,maxWidth:"60ch"},"& tfoot":{bottom:0,zIndex: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}`}}})),en=S(e=>{const{setError:r,type:n,ownerEntityRef:a}=e,o=Zr(),i=H(V),{data:l,isLoading:s,isError:d}=we(a,{type:n});if(R(()=>{r==null||r(d?new Error("Error loading program overview"):void 0)},[d,r]),s)return t.createElement(Le,null);if(!l||!a)return null;const{programs:c,entityRefs:g}=l;if(!s&&!c.length)return t.createElement(We,{missing:"data",title:"Missing programs",description:t.createElement(t.Fragment,null,"Looks like the group"," ",A(x(a),{defaultKind:"Group"})," ","doesn't own any ",n," 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(O,{to:"https://www.npmjs.com/package/@spotify/backstage-plugin-soundcheck-backend#entity-filter"},"docs"),".")});if(d)return null;const p=g.length>=25?g:[...g,...Array.from({length:25-g.length},()=>{})];return t.createElement("div",{className:o.root},t.createElement("table",{className:o.table,"aria-label":"Check results"},c.map(({program:h,levels:y,highestLevels:f},v)=>t.createElement(Jr,{key:v,program:h,entityRefs:p,levels:y,highestLevels:f,entityRoute:i})),t.createElement(Qr,{entityRefs:p})))}),tn=e=>t.createElement(Gr,{name:e}),rn=e=>({type:"ProgramHeader",render:()=>tn(e)}),nn=e=>e?t.createElement(_r,{name:e}):t.createElement(Ur,null),De=e=>({type:"LevelHeader",render:()=>nn(e)}),an=(e,r)=>t.createElement(zr,{name:e,progress:r}),on=(e,r)=>({type:"CheckTitle",render:()=>an(e,r)}),ln=(e,r,n,a,o)=>t.createElement(Se,{check:r,entityRef:n,entityRoute:o,programId:e,result:a,isVirtualized:!0}),sn=(e,r,n,a,o)=>({type:"CheckResult",render:()=>ln(e,r,n,a,o)}),cn=e=>t.createElement(Yr,{entityRef:e}),Be=e=>({type:"EntityHeader",render:()=>cn(e)}),dn=e=>t.createElement(Wr,{highestLevel:e}),mn=e=>({type:"LevelBadge",render:()=>dn(e)}),pn=e=>r=>{const n=e[r.rowIndex].cells[r.columnIndex];return n?t.createElement("div",{style:r.style},n.render()):t.createElement("div",{style:r.style})},un=(e,r,n)=>{var a;const o=[];for(const{program:l,levels:s,highestLevels:d}of e){o.push({height:$.programTitle,cells:[rn(l.name),...r.map(c=>{const g=c?d.find(p=>p.entityRef===c)||Fr(c):void 0;return mn(g)})]});for(const c of s){o.push({height:$.levelTitle,cells:[De(c.name),...r.map(g=>De(""))]});for(const{check:g,results:p}of c.checks)o.push({height:$.check,cells:[on(g.name,ve(p.filter(({result:h})=>h!==m.NotApplicable),"result")),...r.map(h=>{var y,f;return sn(l.id,g,h,(f=(y=p.find(v=>v.entityRef===h))==null?void 0:y.result)!=null?f:m.NotApplicable,n)})]})}}const i=Or(r!=null?r:[]);return o.push({height:Hr((a=i.length)!=null?a:1),cells:[Be(""),...r.map(l=>Be(l||""))]}),o},hn=E(e=>({table:{backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap",textAlign:"left",overflow:"auto"}})),gn=e=>{const{setError:r,type:n,ownerEntityRef:a}=e,o=hn(),i=H(V),{data:l,isLoading:s,isError:d}=we(a,{type:n});if(R(()=>{r==null||r(d?new Error("Error loading program overview"):void 0)},[d,r]),s)return t.createElement(Le,null);if(!l||!a)return null;const{programs:c,entityRefs:g}=l,p=g.length>=25?g:[...g,...Array.from({length:25-g.length},()=>{})],h=un(c,p,i),y=pn(h);return t.createElement(u,{"aria-label":`Check results for ${n}`,key:n,item:!0,xs:12},t.createElement(bt,{className:o.table,columnCount:p.length+1,columnWidth:f=>f===0?j.programTitle:j.checkResult,rowCount:h.length,rowHeight:f=>h[f].height,height:Dr(h),width:Br(p.length)},y))},fn=({facets:e,ownerEntityRef:r,type:n,setError:a})=>{const o=I(()=>{const i=new Map;return e.types.forEach(({value:l})=>{i.set(l,t.createElement(gn,{key:l,ownerEntityRef:r,type:l,setError:a}))}),i},[e,r,a]);return t.createElement("div",null,o.get(n))},yn=E(()=>({scrollContainer:{overflow:"auto"}})),En=({facets:e,ownerEntityRef:r,hasError:n,type:a,setError:o,useVirtualizedResultsTable:i})=>{var l,s;const d=yn();return n?t.createElement(ae,{severity:"error",title:n.message}):e&&((s=(l=e.types)==null?void 0:l.length)!=null?s:0)>0?t.createElement("div",{className:d.scrollContainer},i?t.createElement(fn,{facets:e,type:a,setError:o,ownerEntityRef:r,hasError:n}):t.createElement(en,{ownerEntityRef:r,type:a,setError:o})):t.createElement(Qe,{ownerEntityRef:r})},vn=E(e=>({tableContainer:{padding:e.spacing(3),backgroundColor:"transparent"}})),wn=({groupSelectorError:e,searchParams:r,setSearchParams:n})=>{var a;const{group:o,type:i}=r,[l,s]=k(void 0),[d,c]=k(void 0);R(()=>{l!==i&&s(i)},[i,l]);const{data:g,isLoading:p}=Nt(o),h=(a=N(ee).getOptionalBoolean("soundcheck.virtualizeOverviewPage"))!=null?a:!1,y=d||e,f=b=>{b&&(s(b),n({...r,type:b}))},v=vn();return t.createElement(u,{container:!0,spacing:0},t.createElement(u,{item:!0,xs:12},p?t.createElement(Nr,null):t.createElement(xr,{unfilteredFacets:g,type:l,onChange:f})),t.createElement(u,{item:!0,xs:12,className:v.tableContainer},!p&&t.createElement(En,{facets:g,type:l,setError:c,hasError:y,ownerEntityRef:o,useVirtualizedResultsTable:h})))},kn=e=>{var r;const{title:n="Soundcheck"}=e,[a,o]=$t(),{group:i}=a,[l,s]=k(void 0),d=(r=N(ee).getOptionalBoolean("soundcheck.noCodeUI"))!=null?r:!1;return t.createElement(Ye,null,t.createElement(Xe,null,t.createElement(je,{themeId:"website"},t.createElement(Ue,{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(Ge,{title:n},t.createElement(It,{onChange:c=>{c&&o({...a,group:c})},initialValue:i,setError:s})),t.createElement(Ke,{noPadding:!0,stretch:!0},t.createElement(Ft,null,t.createElement(Me,null,t.createElement(B,{path:"/*",element:t.createElement(wn,{groupSelectorError:l,searchParams:a,setSearchParams:o})}),d&&t.createElement(t.Fragment,null,t.createElement(B,{path:"/checks",element:t.createElement(Ut,null)}),t.createElement(B,{path:"/programs",element:t.createElement(kr,{ownerEntityRef:i})}),t.createElement(B,{path:"/fact-collectors",element:t.createElement(br,null)}))))))))};export{kn as OverviewPage};
|
|
2
|
+
//# sourceMappingURL=index-b2b00eb3.esm.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Props for the EntitySoundcheckCard.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
interface EntitySoundcheckCardProps {
|
|
9
|
+
/**
|
|
10
|
+
* The title of the entity card. Defaults to 'SoundCheck'.
|
|
11
|
+
*/
|
|
12
|
+
title?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Props for the OverviewPageProps.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
interface OverviewPageProps {
|
|
20
|
+
/**
|
|
21
|
+
* The title of the Overview Page. Defaults to 'SoundCheck'.
|
|
22
|
+
*/
|
|
23
|
+
title?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
4
26
|
/**
|
|
5
27
|
* @public
|
|
6
28
|
*
|
|
@@ -22,13 +44,13 @@ declare const EntitySoundcheckContent: () => JSX.Element;
|
|
|
22
44
|
* Provides Card to be used on the EntityPage inside the Catalog Plugin.
|
|
23
45
|
* Must be used within {@link @backstage/plugin-catalog#EntityLayout}.
|
|
24
46
|
*/
|
|
25
|
-
declare const EntitySoundcheckCard: () => JSX.Element;
|
|
47
|
+
declare const EntitySoundcheckCard: ({ title }: EntitySoundcheckCardProps) => JSX.Element;
|
|
26
48
|
/**
|
|
27
49
|
* @public
|
|
28
50
|
*
|
|
29
51
|
* Provides the /soundcheck route on your Backstage instance to get an overview
|
|
30
52
|
* of your Certifications throughout different groups in your Organization.
|
|
31
53
|
*/
|
|
32
|
-
declare const SoundcheckOverviewPage: () => JSX.Element;
|
|
54
|
+
declare const SoundcheckOverviewPage: (props: OverviewPageProps) => JSX.Element;
|
|
33
55
|
|
|
34
|
-
export { EntitySoundcheckCard, EntitySoundcheckContent, SoundcheckOverviewPage, soundcheckPlugin };
|
|
56
|
+
export { EntitySoundcheckCard, EntitySoundcheckCardProps, EntitySoundcheckContent, OverviewPageProps, SoundcheckOverviewPage, soundcheckPlugin };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{l as f,E as j,m as w,j as x}from"./esm/index-ab8d0702.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"react-router-dom";import"@material-ui/lab";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,j as EntitySoundcheckContent,w as SoundcheckOverviewPage,x 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.
|
|
4
|
+
"version": "0.4.2",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://backstage.spotify.com/",
|
|
7
7
|
"main": "dist/index.esm.js",
|
|
@@ -26,22 +26,24 @@
|
|
|
26
26
|
"prepare": "yarn generate"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@backstage/catalog-model": "^1.
|
|
30
|
-
"@backstage/core-components": "^0.
|
|
31
|
-
"@backstage/core-plugin-api": "^1.5.
|
|
32
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
33
|
-
"@backstage/theme": "^0.
|
|
29
|
+
"@backstage/catalog-model": "^1.3.0",
|
|
30
|
+
"@backstage/core-components": "^0.13.1",
|
|
31
|
+
"@backstage/core-plugin-api": "^1.5.1",
|
|
32
|
+
"@backstage/plugin-catalog-react": "^1.6.0",
|
|
33
|
+
"@backstage/theme": "^0.3.0",
|
|
34
34
|
"@backstage/types": "^1.0.2",
|
|
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.2",
|
|
39
39
|
"@tanstack/react-query": "^4.6.1",
|
|
40
40
|
"classnames": "^2.3.2",
|
|
41
41
|
"graphql-request": "5.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",
|
|
45
47
|
"react-use": "^17.2.4",
|
|
46
48
|
"react-window": "^1.8.8"
|
|
47
49
|
},
|
|
@@ -50,16 +52,16 @@
|
|
|
50
52
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
51
53
|
},
|
|
52
54
|
"devDependencies": {
|
|
53
|
-
"@backstage/cli": "^0.22.
|
|
54
|
-
"@backstage/core-app-api": "^1.
|
|
55
|
-
"@backstage/dev-utils": "^1.0.
|
|
56
|
-
"@backstage/test-utils": "^1.
|
|
55
|
+
"@backstage/cli": "^0.22.7",
|
|
56
|
+
"@backstage/core-app-api": "^1.8.0",
|
|
57
|
+
"@backstage/dev-utils": "^1.0.15",
|
|
58
|
+
"@backstage/test-utils": "^1.3.1",
|
|
57
59
|
"@graphql-codegen/cli": "^3.0.0",
|
|
58
60
|
"@graphql-codegen/typescript": "^3.0.0",
|
|
59
61
|
"@graphql-codegen/typescript-graphql-request": "^4.5.5",
|
|
60
62
|
"@graphql-codegen/typescript-operations": "^3.0.0",
|
|
61
|
-
"@spotify/backstage-plugin-core-common": "^0.5.
|
|
62
|
-
"@spotify/backstage-plugin-soundcheck-common": "^0.
|
|
63
|
+
"@spotify/backstage-plugin-core-common": "^0.5.2",
|
|
64
|
+
"@spotify/backstage-plugin-soundcheck-common": "^0.5.0",
|
|
63
65
|
"@testing-library/jest-dom": "^5.10.1",
|
|
64
66
|
"@testing-library/react": "^12.1.5",
|
|
65
67
|
"@testing-library/react-hooks": "^8.0.1",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{stringifyEntityRef as y}from"@backstage/catalog-model";import{useApi as v,useRouteRef as U}from"@backstage/core-plugin-api";import{useQuery as b}from"@tanstack/react-query";import{s as k,a as $}from"./index-d6a5b7f6.esm.js";import t from"react";import{makeStyles as d,Tooltip as D,Typography as i,alpha as p,Box as F}from"@material-ui/core";import{useEntity as G}from"@backstage/plugin-catalog-react";import{Link as H}from"react-router-dom";import{useAutoUpdatingRelativeTime as M}from"@spotify/backstage-plugin-core";import W from"@material-ui/icons/Schedule";import{DateTime as N}from"luxon";import j from"classnames";import{C as O,L as S,N as P,F as E,A as Q}from"./SoundcheckQueryClientProvider-04f7e1dc.esm.js";import{Skeleton as c}from"@material-ui/lab";import{MarkdownContent as C,Link as _}from"@backstage/core-components";function q(e){const a=v(k),r=y(e);return b(["soundcheck/certifications",r],async()=>a.getAllCertifications(r))}function T(e,a){const r=v(k),n=y(e);return b(["soundcheck/certifications",n,a],async()=>r.getCertificationDetails(n,a),{enabled:!!a})}const J=d(e=>({root:{display:"inline-flex",alignItems:"center",gap:e.spacing(1)}})),x=({timestamp:e,description:a})=>{const r=J(),n=N.fromISO(e).toLocaleString(N.DATETIME_FULL),l=M(e),o=a?`${a}: ${l}`:void 0;return t.createElement("div",{className:r.root},t.createElement(D,{title:n},t.createElement(i,{variant:"caption","aria-label":o},l)),t.createElement(W,null))},L=d(e=>({root:{display:"grid",width:"100%",gridTemplateColumns:"auto 1fr auto",gridColumnGap:e.spacing(1),padding:e.spacing(1),alignItems:"center","&.selected":{backgroundColor:p(e.palette.primary[e.palette.type],.2)},"&:hover, &:active, &:focus":{backgroundColor:p(e.palette.primary[e.palette.type],.3)}}})),K=({className:e,href:a,children:r})=>a?t.createElement(H,{to:a,className:e},r):t.createElement("div",{className:e},r),V=({result:e,name:a,timestamp:r,selected:n=!1,href:l})=>{const o=L(),u=j(o.root,{selected:n});return t.createElement(K,{href:l,className:u},t.createElement(O,{result:e}),t.createElement(i,{variant:"body2"},a),r?t.createElement(x,{timestamp:r}):null)},A=d(e=>{const a=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{wrapper:{backgroundColor:a,color:p(e.palette.getContrastText(a),.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:r})=>[`"${r?"badge":"title"} title"`,`"${r?".":"description"} description"`].join(" "),gridTemplateColumns:"auto 1fr"},title:{gridArea:"title",textTransform:"uppercase",fontWeight:"bold",color:p(e.palette.getContrastText(a),.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:p(e.palette.getContrastText(a),.7),fontSize:e.typography.subtitle2.fontSize,marginTop:e.spacing(1)}}}),X=e=>{const a=A({badge:e.badge});return t.createElement("div",{className:a.wrapper},e.badge?t.createElement(S,{className:a.badge,badge:e.badge}):null,t.createElement(i,{className:a.title},e.title),e.description?t.createElement(i,{className:a.description},e.description):null)},f=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 Y({description:e,documentationUrl:a}){const r=f();return a?t.createElement("div",{className:r.description},t.createElement(C,{content:e}),t.createElement(_,{to:a},"Learn more")):t.createElement("div",{className:r.description},t.createElement(C,{content:e}))}const I=({name:e,level:a,badge:r,description:n,documentationUrl:l})=>{const o=f();return t.createElement("div",{className:o.root},r?t.createElement(S,{size:"large",badge:r}):t.createElement(P,{size:"large"}),t.createElement("div",null,t.createElement(i,{variant:"caption",className:o.level},a!=null?a:"No Level"),t.createElement(i,{variant:"h4",className:o.title},e),n&&t.createElement(Y,{description:n,documentationUrl:l})))},R=({hideDescription:e=!1})=>{const a=f();return t.createElement(E,null,t.createElement("div",{className:a.root},t.createElement(c,{width:44,height:44}),t.createElement("div",null,t.createElement(i,{variant:"caption",className:a.level},t.createElement(c,{width:100})),t.createElement(i,{variant:"h4",className:a.title},t.createElement(c,{width:300})),!e&&t.createElement(i,{variant:"body2"},t.createElement(c,null)))))},Z=()=>{const e=A({});return t.createElement(E,null,t.createElement("div",{className:e.wrapper},t.createElement(c,{className:e.title}),t.createElement(i,{className:e.description},t.createElement(c,null))))},h=()=>{const e=L();return t.createElement(E,null,t.createElement("div",{className:e.root},t.createElement(c,{width:24,height:24}),t.createElement(i,{variant:"body2"},t.createElement(c,null)),t.createElement(c,{width:100,height:24})))},ee=()=>{const e=w();return t.createElement("div",{className:e.root},t.createElement(R,null),new Array(3).fill(null).map((a,r)=>t.createElement(t.Fragment,{key:`skeleton-level-${r}`},t.createElement(Z,null),t.createElement("ul",{className:e.checks},t.createElement(h,null),t.createElement(h,null),t.createElement(h,null)))))},w=d(e=>({root:{borderRight:`1px solid ${e.palette.divider}`},checks:{padding:0,margin:0,flex:1,listStyle:"none"},checkItem:{borderBottom:`1px solid ${e.palette.divider}`,"&:last-of-type":{borderBottom:"0"}}})),te=({programId:e,checkId:a})=>{var r,n;const l=w(),{entity:o}=G(),u=U($),{data:s,isLoading:z,isError:B}=T(o,e);return B?t.createElement("div",{className:l.root},t.createElement(F,{padding:2},t.createElement(Q,{severity:"error",title:"Error loading certification"}))):z||!e?t.createElement(ee,null):s?t.createElement("div",{className:l.root},t.createElement(I,{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(m=>t.createElement(t.Fragment,{key:m.ordinal},t.createElement(X,{key:m.ordinal,badge:m.badge,title:m.name,description:m.description}),t.createElement("ul",{className:l.checks},m.checks.map(g=>t.createElement("li",{key:g.id,className:l.checkItem},t.createElement(V,{...g,selected:g.id===a,href:u({programId:e,checkId:g.id})}))))))):null};export{te as C,x as R,q as a,R as b,I as c,T as u};
|
|
2
|
-
//# sourceMappingURL=CertificationSidebar-276909f2.esm.js.map
|
|
@@ -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-b6c3da0a.esm.js";import{R as H,u as P,a as y,C as J}from"./CertificationSidebar-276909f2.esm.js";import{Skeleton as c}from"@material-ui/lab";import{MarkdownContent as x}from"@backstage/core-components";import{stringifyEntityRef as K}from"@backstage/catalog-model";import{useApi as X,useRouteRef as b,useRouteRefParams as Z}from"@backstage/core-plugin-api";import{useQuery as _}from"@tanstack/react-query";import{s as ee,R as s,c as g,a as B}from"./index-d6a5b7f6.esm.js";import{A as C,F,L as te,N as ae,a as re,S as ne}from"./SoundcheckQueryClientProvider-04f7e1dc.esm.js";import ie from"react-use/lib/useMeasure";import $ from"react-use/lib/usePrevious";import le from"react-confetti";import"react-use/lib/useDebounce";import"@material-ui/icons/Schedule";import"luxon";import"classnames";import"graphql-request";import"graphql-tag";import"@material-ui/icons/Check";import"@material-ui/icons/Close";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/HelpOutline";import"lodash";function oe(t,r,a){const n=X(ee),i=K(t);return _(["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={[s.Passed]:"success",[s.Failed]:"error",[s.NotReported]:"info",[s.NotApplicable]:"info"}[t],i={[s.Passed]:"Check passed",[s.Failed]:"Check did not pass",[s.NotReported]:"Check not reported",[s.NotApplicable]:"Check not applicable"}[t];return e.createElement(C,{severity:n,title:i},r?e.createElement(x,{className:a.markdownContent,content:r}):null)},me=()=>{const t=A();return e.createElement(F,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(c,{width:300,height:32})),e.createElement(c,{width:100,height:32})),e.createElement(c,{variant:"rect",height:120}),e.createElement("div",{"data-testid":"soundcheck-check-details-description"},e.createElement(f,{variant:"h3"},e.createElement(c,null)),e.createElement(c,null),e.createElement(c,null),e.createElement(c,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(C,{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(H,{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(x,{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}=P(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(te,{badge:a,className:l.badge}):e.createElement(ae,{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(c,{width:180})})},Ee=()=>e.createElement(F,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}=y(r),i=b(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}=y(n);return i?e.createElement(C,{severity:"error",title:"Error loading certifications"}):l&&!(o!=null&&o.length)?e.createElement(re,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(J,{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=b(g),{data:n}=y(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}=Z(g),i=b(B),{data:l}=P(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(ne,null,e.createElement(we,null));export{Ne as EntitySoundcheckContent};
|
|
2
|
-
//# sourceMappingURL=EntitySoundcheckContent-931d8ed8.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
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"./index-d6a5b7f6.esm.js";import"@backstage/plugin-catalog-react";import"react-router-dom";import{F as d}from"./SoundcheckQueryClientProvider-04f7e1dc.esm.js";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-b6c3da0a.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import r,{useState as u,useEffect as f}from"react";import{Fade as h,withStyles as s,makeStyles as i,Typography as b}from"@material-ui/core";import g from"@material-ui/icons/Check";import y from"@material-ui/icons/Close";import E from"@material-ui/icons/RemoveCircleOutline";import N from"@material-ui/icons/HelpOutline";import{R as a}from"./index-d6a5b7f6.esm.js";import l from"classnames";import{Alert as x}from"@material-ui/lab";import{EmptyState as m}from"@backstage/core-components";import{humanizeEntityRef as C}from"@backstage/plugin-catalog-react";import{parseEntityRef as v}from"@backstage/catalog-model";import{QueryClient as k,QueryClientProvider as z}from"@tanstack/react-query";import{memoize as $}from"lodash";import{useApi as S,errorApiRef as w}from"@backstage/core-plugin-api";const R=({children:e})=>{const[t,o]=u(!1);return f(()=>{const n=setTimeout(()=>{o(!0)},250);return()=>clearTimeout(n)},[]),r.createElement(h,{in:t,timeout:250},e)},A=e=>({[a.Passed]:"Check passed",[a.NotReported]:"Check not reported",[a.Failed]:"Check failed",[a.NotApplicable]:"Check not applicable"})[e],F=s(e=>({root:{color:e.palette.success.main}}))(g),T=s(e=>({root:{color:e.palette.error.main}}))(y),I=s(e=>({root:{color:e.palette.info.main}}))(N),L=s(e=>({root:{color:e.palette.text.disabled}}))(E),P=({result:e,className:t})=>{const o={className:t,"aria-label":A(e),"aria-hidden":!1};return e===a.Passed?r.createElement(F,{...o}):e===a.NotReported?r.createElement(I,{...o}):e===a.Failed?r.createElement(T,{...o}):e===a.NotApplicable?r.createElement(L,{...o}):null},p=24,B=11,c=e=>e==="small"?1:2,M=i({root:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",borderWidth:"2px",fontWeight:700,width:({size:e})=>`${p*c(e)}px`,height:({size:e})=>`${p*c(e)}px`,fontSize:({size:e})=>`${B*c(e)}px`}}),d=({className:e,label:t,size:o="small"})=>{const n=M({size:o});return r.createElement("span",{className:l(e,n.root),role:"img","aria-label":`${t} badge`},t)},W=i(e=>({root:{background:({color:t})=>t,color:({color:t})=>e.palette.getContrastText(t),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(",")}}})),Q=({className:e,badge:t,size:o="small"})=>{const n=W({color:t.options.color,size:o});return r.createElement(d,{className:l(e,n.root),size:o,label:`L${t.options.level}`})},j=i({root:{borderColor:"currentColor",borderStyle:"dashed"}}),O=({className:e,size:t="small"})=>{const o=j();return r.createElement(d,{className:l(e,o.root),size:t,label:"NL"})},q=i(e=>({root:{padding:e.spacing(3)},icon:{display:"none"},message:{padding:0},type:{fontWeight:700}})),D=e=>{const{type:t,...o}=q();return r.createElement(x,{severity:e.severity,elevation:1,classes:o},r.createElement(b,{variant:"subtitle1",classes:{root:t}},e.title),e.children)},G=({className:e})=>r.createElement("div",{className:e},r.createElement(m,{title:"No certifications available",missing:"data",description:"There are no programs configured that apply to this entity."})),K=({ownerEntityRef:e})=>e?r.createElement(m,{missing:"data",title:"Missing entities",description:r.createElement(r.Fragment,null,"Looks like the group"," ",C(v(e),{defaultKind:"Group"})," ","doesn't own any entities.",r.createElement("br",null),r.createElement("br",null),"Please select another group from the dropdown in the corner of the header.")}):null,H=$(e=>new k({defaultOptions:{queries:{refetchInterval:6e4,refetchIntervalInBackground:!1,refetchOnWindowFocus:"always",retry:2,retryDelay:t=>{const o=450+Math.ceil(Math.random()*100);return Math.min(o*2**t,3e4)},onError:t=>e.post(t)}}})),J=e=>{const t=S(w),o=H(t);return r.createElement(z,{client:o},e.children)};export{D as A,P as C,R as F,Q as L,O as N,J as S,G as a,K as b};
|
|
2
|
-
//# sourceMappingURL=SoundcheckQueryClientProvider-04f7e1dc.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import e,{Fragment as f}from"react";import{A as g,a as E,S as v}from"./SoundcheckQueryClientProvider-04f7e1dc.esm.js";import y from"@material-ui/core/styles/makeStyles";import{Divider as h}from"@material-ui/core";import{useRouteRef as k}from"@backstage/core-plugin-api";import{Link as C,InfoCard as S}from"@backstage/core-components";import{useEntity as b}from"@backstage/plugin-catalog-react";import{SpotifyLicenseBanner as w}from"@spotify/backstage-plugin-core";import{c as L}from"./index-d6a5b7f6.esm.js";import{b as m,a as R,c as D}from"./CertificationSidebar-276909f2.esm.js";import"@backstage/catalog-model";import"@tanstack/react-query";import"react-router-dom";import"@material-ui/lab";import"@material-ui/icons/Check";import"@material-ui/icons/Close";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/HelpOutline";import"classnames";import"lodash";import"graphql-request";import"graphql-tag";import"@material-ui/icons/Schedule";import"luxon";const N=()=>e.createElement(e.Fragment,null,e.createElement(m,{hideDescription:!0}),e.createElement(m,{hideDescription:!0})),c=y(t=>({certificationWrapper:{display:"flex",justifyContent:"space-between",alignItems:"center"},infoCard:{display:"grid",gridRowGap:t.spacing(2)},emptyState:{"& > div":{backgroundColor:t.palette.background.paper}}})),a=({children:t})=>{const i=c();return e.createElement(S,{title:"Soundcheck"},e.createElement("div",{className:i.infoCard},e.createElement(w,{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."}),t))},A=()=>{const{entity:t}=b(),i=c(),{data:n,isError:s,isLoading:p}=R(t),d=k(L);return s?e.createElement(a,null,e.createElement(g,{severity:"error",title:"Error loading certifications"})):p||!n?e.createElement(a,null,e.createElement(N,null)):n.length===0?e.createElement(a,null,e.createElement(E,{className:i.emptyState})):e.createElement(a,null,n.map((r,u)=>{var o,l;return e.createElement(f,{key:r.program.name},e.createElement("div",{className:i.certificationWrapper,"data-testid":"soundcheck-program-row"},e.createElement(D,{key:r.program.id,name:r.program.name,badge:(o=r.highestLevel)==null?void 0:o.badge,level:(l=r.highestLevel)==null?void 0:l.name}),e.createElement(C,{to:d({programId:r.program.id})},"View Details")),u<n.length-1?e.createElement(h,null):null)}))},I=()=>e.createElement(v,null,e.createElement(A,null));export{I as EntitySoundcheckCard};
|
|
2
|
-
//# sourceMappingURL=index-0f37ee61.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import t,{useState as x,useEffect as C,useMemo as O,useCallback as H,memo as b,Fragment as ee}from"react";import{HeaderTabs as B,Link as T,EmptyState as te,Page as re,Header as ae,Content as le}from"@backstage/core-components";import{SpotifyLicenseBanner as ne}from"@spotify/backstage-plugin-core";import{makeStyles as g,alpha as W,TextField as oe,CircularProgress as ie,Tooltip as se,LinearProgress as ce,Typography as N,Grid as I}from"@material-ui/core";import{C as pe,L as G,S as de,b as me,A as ue}from"./SoundcheckQueryClientProvider-04f7e1dc.esm.js";import ge from"@material-ui/lab/Autocomplete";import{stringifyEntityRef as V,parseEntityRef as w}from"@backstage/catalog-model";import{useApi as $,identityApiRef as he,useRouteRef as L}from"@backstage/core-plugin-api";import{useQuery as P}from"@tanstack/react-query";import{s as j,R as k}from"./index-d6a5b7f6.esm.js";import{catalogApiRef as M,entityRouteRef as S,humanizeEntityRef as z}from"@backstage/plugin-catalog-react";import{useSearchParams as fe}from"react-router-dom";import{Skeleton as y}from"@material-ui/lab";import{R as ye}from"./RefetchingIndicator-b6c3da0a.esm.js";import{countBy as K}from"lodash";import{VariableSizeGrid as ve}from"react-window";import"@material-ui/icons/Check";import"@material-ui/icons/Close";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/HelpOutline";import"classnames";import"graphql-request";import"graphql-tag";import"react-use/lib/useDebounce";function Ee(e){const r=$(j);return P(["soundcheck/facets-for-owner",e],async()=>r.getFacetsForOwner(e),{enabled:!!e})}function Q(e,r){const a=$(j);return P(["soundcheck/program-overview-for-owner",e,r],async()=>a.getProgramOverviewForOwner(e,r),{enabled:!!e&&!!(r!=null&&r.type)})}function be(){const e=$(he),r=$(M);return P(["soundcheck/user-groups-claims"],async()=>{const{ownershipEntityRefs:a}=await e.getBackstageIdentity();return(await r.getEntitiesByRefs({entityRefs:a})).items.filter(l=>(l==null?void 0:l.kind)==="Group").map(l=>{var n,s,i,o;return{name:(o=(i=(s=(n=l.spec)==null?void 0:n.profile)==null?void 0:s.displayName)!=null?i:l.metadata.title)!=null?o:l.metadata.name,ref:V(l)}})})}function ke(){const e=$(M);return P(["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 l,n,s,i;return{name:(i=(s=(n=(l=a.spec)==null?void 0:l.profile)==null?void 0:n.displayName)!=null?s:a.metadata.title)!=null?i:a.metadata.name,ref:V(a)}})})}const Ce=()=>{const[e,r]=fe(),a=Object.fromEntries(e.entries()),[l,n]=x(a);return C(()=>{r(l,{replace:!0})},[l,r]),[l,n]},Ne=()=>{const{data:e,isLoading:r,isError:a}=be(),{data:l,isLoading:n,isError:s}=ke();return{options:O(()=>{const i=[];return e&&i.push(...e.map(({name:o,ref:d})=>({name:o,ref:d,key:"My Groups"}))),l&&i.push(...l.map(({name:o,ref:d})=>({name:o,ref:d,key:"All Groups"}))),i},[e,l]),isLoading:r||n,isError:a||s}},we=g(e=>({root:{width:"100%",minWidth:250},textField:{"& $notchedOutline":{borderColor:W(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:{}})),Re=e=>{const{onChange:r,initialValue:a,setError:l}=e,{options:n,isLoading:s,isError:i}=Ne(),o=we(),[d,c]=x(null);C(()=>{if(!s&&n!=null&&n.length&&!d){const p=a?n.find(m=>m.ref===a):n[0];p&&(c(p),r==null||r(p.ref))}},[s,n,d,r,a]);const u=H((p,m)=>{c(m),r==null||r(m==null?void 0:m.ref)},[r,c]);return C(()=>{l==null||l(i?new Error("Error loading groups"):void 0)},[i,l]),i?null:t.createElement(ge,{"aria-label":"Current group",className:o.root,classes:{clearIndicator:o.clearIndicator,popupIndicator:o.popupIndicator},disableClearable:!0,options:n!=null?n:[],loading:s,groupBy:p=>p.key,value:d,freeSolo:!1,onChange:u,getOptionLabel:p=>p.name,renderInput:p=>t.createElement(oe,{...p,variant:"outlined",placeholder:s?"Loading":"Select a group",className:o.textField,InputProps:{...p.InputProps,className:o.input,classes:{notchedOutline:o.notchedOutline},endAdornment:t.createElement(t.Fragment,null,s?t.createElement(ie,{color:"inherit",size:20}):null,p.InputProps.endAdornment)}})})},$e=()=>t.createElement(B,{tabs:[{label:t.createElement(y,{width:180})},{label:t.createElement(y,{width:180})},{label:t.createElement(y,{width:180})},{label:t.createElement(y,{width:180})}]}),xe=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)}})),Te=({unfilteredFacets:e,onChange:r,type:a})=>{var l,n,s;const i=xe(),o={types:(l=e==null?void 0:e.types.filter(({count:p})=>p>0))!=null?l:[]},d=H(p=>{var m;r((m=o==null?void 0:o.types[p].value)!=null?m:"")},[o==null?void 0:o.types,r]);C(()=>{var p,m;const h=(o==null?void 0:o.types)&&o.types.length>=0,f=!a&&h,R=a&&h&&!(o!=null&&o.types.find(({value:E})=>E===a));(f||R)&&r((m=(p=o==null?void 0:o.types[0])==null?void 0:p.value)!=null?m:"")},[a,o==null?void 0:o.types,r]);const c=(n=o==null?void 0:o.types.map(({value:p,count:m})=>({key:p,label:`${p} (${m>50?"50+":m})`,id:p,tabProps:{className:i.tab}})))!=null?n:[];if(!c.length)return null;const u=(s=o==null?void 0:o.types.findIndex(p=>p.value===a))!=null?s:-1;return t.createElement(t.Fragment,null,t.createElement(ye,null),t.createElement(B,{onChange:d,tabs:c,selectedIndex:u>-1?u:void 0}))},Ie=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"}})),D=e=>{var r,a;const l=Ie(e),n=O(()=>Object.entries(e.progress).reduce((i,[,o])=>i+o,0),[e.progress]);if(n===0)return null;const s=(r=e.progress[k.Passed])!=null?r:0;return t.createElement(se,{arrow:!0,title:`Check passing for ${s} of ${n} ${n===1?"entity":"entities"}`,enterDelay:0,placement:"top"},t.createElement(ce,{variant:"determinate",value:((a=e.progress[k.Passed])!=null?a:0)/n*100,classes:{root:l.root,bar:l.bar}}))},Le=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:"0.75em",height:"0.75em"},empty:{width:e.spacing(2),height:e.spacing(2)},virtualized:{borderBottom:`1px solid ${e.palette.divider}`,borderRight:`1px solid ${e.palette.divider}`}})),U=b(({programId:e,checkId:r,entityRef:a,result:l,entityRoute:n,isVirtualized:s})=>{const i=Le();if(typeof a!="string")return t.createElement("td",{className:`${i.root} ${s?i.virtualized:""}`,"aria-hidden":!0},t.createElement("div",{className:i.iconWrapper},t.createElement("div",{className:i.empty})));const o=t.createElement("div",{className:i.iconWrapper},t.createElement(pe,{className:i.icon,result:l!=null?l:k.NotReported})),d=l&&l===k.NotApplicable?o:t.createElement(T,{className:i.link,to:`${n(w(a))}/soundcheck/${e}/${r}`},o);return t.createElement("td",{className:`${i.root} ${s?i.virtualized:""}`},d)}),Pe=g(e=>({virtualized:{borderRight:`1px solid ${e.palette.divider}`,height:`${v.programTitle}px`,display:"flex",justifyContent:"center",alignItems:"center"}})),Se=b(({entityRef:e,highestLevels:r})=>{const a=r.find(l=>l.entityRef===e);return a!=null&&a.badge?t.createElement(G,{badge:a.badge,size:"small"}):null}),Ae=({highestLevel:e})=>{const r=Pe();return e!=null&&e.badge?t.createElement("div",{className:r.virtualized},t.createElement(G,{badge:e.badge,size:"small"})):t.createElement("div",{className:r.virtualized},"\xA0")},q=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}`}})),Oe=b(({program:e,entityRefs:r,highestLevels:a})=>{const l=q();return t.createElement("tr",{"data-testid":"program-title-row"},t.createElement("th",{scope:"row",className:l.programNameCell},t.createElement("div",{className:l.programNameContent},t.createElement(N,{className:l.programNameTypography,variant:"h5",component:"p"},e.name))),r.map((n,s)=>typeof n!="string"?t.createElement("td",{key:s,"aria-hidden":!0}):t.createElement("td",{key:s,"data-testid":"program-certification-cell"},t.createElement("div",{className:l.badgeCellContent},t.createElement(Se,{entityRef:n,highestLevels:a})))))}),ze=b(({name:e})=>{const r=q();return t.createElement("div",{className:`${r.programNameCell} ${r.programNameCellVirtualized}`},t.createElement("div",{className:r.programNameContent},t.createElement(N,{className:r.programNameTypography,variant:"h5",component:"p"},e)))}),F=g(e=>{const r=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{root:{color:W(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:`${v.levelTitle}px`}}}),Fe=b(({level:e,entityRefs:r,programName:a})=>{const l=F();return t.createElement("tr",{className:l.root,"data-testid":"program-level-row"},t.createElement("th",{scope:"row",className:l.root},t.createElement("div",{className:l.levelContent},t.createElement(N,{className:l.levelTypography,variant:"subtitle2",component:"p","aria-label":`${e.name} for ${a} program`},e.name))),r.map((n,s)=>t.createElement("td",{key:s,className:l.root,"aria-hidden":!0})))}),He=({name:e})=>{const r=F();return t.createElement("div",{className:`${r.levelHeaderCell} ${r.root}`,"aria-label":`${e}`},t.createElement(N,{variant:"subtitle2",component:"p",className:r.levelTypography},e))},Be=()=>{const e=F();return t.createElement("div",{className:`${e.levelHeaderCell} ${e.root}`},"\xA0")},J=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:"15vh"}})),We=({entityRefs:e})=>{const r=L(S),a=J();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((l,n)=>typeof l!="string"?t.createElement("th",{key:n,className:a.cell,"aria-hidden":!0}):t.createElement("th",{scope:"col",key:n,className:a.cell},t.createElement("div",{className:a.cellInner},t.createElement(T,{to:r(w(l))},z(w(l),{defaultKind:"component"})))))))},Ge=({entityRef:e})=>{const r=L(S),a=J(),l=e?t.createElement(T,{to:r(w(e))},z(w(e),{defaultKind:"component"})):t.createElement(t.Fragment,null);return t.createElement("div",{className:a.cell},t.createElement("div",{className:a.cellInner},l))},Ve=e=>t.createElement(ze,{name:e}),je=e=>({type:"ProgramHeader",render:()=>Ve(e)}),Me=e=>e?t.createElement(He,{name:e}):t.createElement(Be,null),X=e=>({type:"LevelHeader",render:()=>Me(e)}),Ke=(e,r)=>t.createElement(et,{name:e,progress:r}),Qe=(e,r)=>({type:"CheckTitle",render:()=>Ke(e,r)}),De=(e,r,a,l,n)=>t.createElement(U,{checkId:r,entityRef:a,entityRoute:n,programId:e,result:l,isVirtualized:!0}),Ue=(e,r,a,l,n)=>({type:"CheckResult",render:()=>De(e,r,a,l,n)}),qe=e=>t.createElement(Ge,{entityRef:e}),Y=e=>({type:"EntityHeader",render:()=>qe(e)}),Je=e=>t.createElement(Ae,{highestLevel:e}),Xe=e=>({type:"LevelBadge",render:()=>Je(e)}),Ye=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})},v={programTitle:70,levelTitle:30,check:42,entityRefFooter:100},Ze=(e,r,a)=>{const l=[];for(const{program:n,levels:s,highestLevels:i}of e){l.push({height:v.programTitle,cells:[je(n.name),...r.map(o=>{const d=i.find(c=>c.entityRef===o);return Xe(d)})]});for(const o of s){l.push({height:v.levelTitle,cells:[X(o.name),...r.map(d=>X(""))]});for(const{check:d,results:c}of o.checks)l.push({height:v.check,cells:[Qe(d.name,K(c.filter(({result:u})=>u!==k.NotApplicable),"result")),...r.map(u=>{var p,m;return Ue(n.id,d.id,u,(m=(p=c.find(h=>h.entityRef===u))==null?void 0:p.result)!=null?m:k.NotApplicable,a)})]})}}return l.push({height:v.entityRefFooter,cells:[Y(""),...r.map(n=>Y(n||""))]}),l},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:`${v.check}px`,lineHeight:`${v.check}px`,borderBottom:`1px solid ${e.palette.divider}`,borderRight:`1px solid ${e.palette.divider}`}})),_e=b(({programId:e,programName:r,check:a,entityRefs:l,results:n,entityRoute:s})=>{const i=Z(),o=O(()=>K(n.filter(({result:c})=>c!==k.NotApplicable),"result"),[n]),d=new Map(n.map(c=>[c.entityRef,c.result]));return t.createElement("tr",{"data-testid":"program-check-row"},t.createElement("th",{scope:"row",className:i.checkNameCell,"aria-label":`${a.name} check for ${r} program`},t.createElement("div",{className:i.checkNameContent},t.createElement(N,{className:i.checkNameTypography,variant:"subtitle2",component:"p"},a.name),t.createElement(D,{className:i.checkIndicator,progress:o}))),l.map((c,u)=>t.createElement(U,{key:u,programId:e,checkId:a.id,entityRef:c,result:typeof c=="string"?d.get(c):void 0,entityRoute:s})))}),et=({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(N,{variant:"subtitle2",component:"p",className:a.checkNameTypography},e),t.createElement(D,{className:a.checkIndicator,progress:r})))},tt=({program:e,highestLevels:r,levels:a,entityRefs:l,entityRoute:n})=>t.createElement("tbody",null,t.createElement(Oe,{program:e,entityRefs:l,highestLevels:r}),a.map((s,i)=>t.createElement(ee,{key:i},t.createElement(Fe,{entityRefs:l,level:s,programName:e.name}),s.checks.map(({check:o,results:d},c)=>t.createElement(_e,{key:c,check:o,programId:e.id,programName:e.name,entityRefs:l,results:d,entityRoute:n}))))),rt=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]}})),_=()=>{const e=rt(),r=new Array(25).fill(void 0),a=new Array(5).fill(void 0),l=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(y,{width:180,height:40})),r.map((n,s)=>t.createElement("td",{key:s}))),l.map((n,s)=>t.createElement(t.Fragment,{key:s},t.createElement("tr",{className:e.header},t.createElement("td",{className:e.title},t.createElement(y,{width:180})),r.map((i,o)=>t.createElement("td",{key:o}))),a.map((i,o)=>t.createElement("tr",{key:o},t.createElement("td",{className:e.title},t.createElement(y,{width:240})),r.map((d,c)=>t.createElement("td",{key:c,className:e.checkResult},t.createElement(y,{width:18,height:18,variant:"rect"})))))))))},at=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}`}}})),lt=b(e=>{const{setError:r,type:a,ownerEntityRef:l}=e,n=at(),s=L(S),{data:i,isLoading:o,isError:d}=Q(l,{type:a});if(C(()=>{r==null||r(d?new Error("Error loading program overview"):void 0)},[d,r]),o)return t.createElement(_,null);if(!i||!l)return null;const{programs:c,entityRefs:u}=i;if(!o&&!c.length)return t.createElement(te,{missing:"data",title:"Missing programs",description:t.createElement(t.Fragment,null,"Looks like the group"," ",z(w(l),{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(T,{to:"https://www.npmjs.com/package/@spotify/backstage-plugin-soundcheck-backend#entity-filter"},"docs"),".")});if(d)return null;const p=u.length>=25?u:[...u,...Array.from({length:25-u.length},()=>{})];return t.createElement("div",{className:n.root},t.createElement("table",{className:n.table,"aria-label":"Check results"},c.map(({program:m,levels:h,highestLevels:f},R)=>t.createElement(tt,{key:R,program:m,entityRefs:p,levels:h,highestLevels:f,entityRoute:s})),t.createElement(We,{entityRefs:p})))}),nt=g(e=>({table:{backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap",textAlign:"left"}})),ot=e=>{let r=0;return e.forEach(a=>{r+=a.height}),r},A={programTitle:350,checkResult:42},it=e=>e*A.checkResult+A.programTitle,st=e=>{const{setError:r,type:a,ownerEntityRef:l}=e,n=nt(),s=L(S),{data:i,isLoading:o,isError:d}=Q(l,{type:a});if(C(()=>{r==null||r(d?new Error("Error loading program overview"):void 0)},[d,r]),o)return t.createElement(_,null);if(!i||!l)return null;const{programs:c,entityRefs:u}=i,p=u.length>=25?u:[...u,...Array.from({length:25-u.length},()=>{})],m=Ze(c,p,s),h=Ye(m);return t.createElement(ve,{className:n.table,columnCount:p.length+1,columnWidth:f=>f===0?A.programTitle:A.checkResult,rowCount:m.length,rowHeight:f=>m[f].height,height:ot(m),width:it(p.length)},h)},ct=g(e=>({tableContainer:{padding:e.spacing(3),backgroundColor:"transparent"},scrollContainer:{overflow:"scroll",height:`calc(100vh - 86px - 68px - ${e.spacing(3)*2}px)`}})),pt=(e,r,a,l,n,s)=>{var i;if(((i=e==null?void 0:e.types)==null?void 0:i.length)<1)return t.createElement(me,{ownerEntityRef:r});if(a)return t.createElement(ue,{severity:"error",title:a.message});if(s){const o=[];if(e&&e.types)for(let d=0;d<e.types.length;d++){const c=e.types[d].value;o.push(t.createElement(I,{"aria-label":`Check results for ${c}`,key:c,item:!0,xs:12,style:c===l?{}:{display:"none"}},t.createElement(st,{ownerEntityRef:r,type:c,setError:n})))}return t.createElement("div",null,o)}return t.createElement(lt,{ownerEntityRef:r,type:l,setError:n})},dt=({useVirtualizedResultsTable:e})=>{const[r,a]=Ce(),{group:l,type:n}=r,[s,i]=x(void 0),[o,d]=x(void 0),{data:c,isLoading:u}=Ee(l),p=s||o,m=E=>{E&&a({...r,group:E})},h=E=>{E&&a({...r,type:E})},f=ct(),R=pt(c,l,p,n,d,e);return t.createElement(re,{themeId:"website"},t.createElement(ne,{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(ae,{title:"Soundcheck"},t.createElement(Re,{onChange:m,initialValue:l,setError:i})),t.createElement(le,{noPadding:!0,stretch:!0},t.createElement(I,{container:!0,spacing:0},t.createElement(I,{item:!0,xs:12},u?t.createElement($e,null):t.createElement(Te,{unfilteredFacets:c,type:n,onChange:h})),t.createElement(I,{item:!0,xs:12,className:f.tableContainer},t.createElement("div",{className:f.scrollContainer},R)))))},mt=e=>t.createElement(de,null,t.createElement(dt,{useVirtualizedResultsTable:e}));export{mt as overviewPage};
|
|
2
|
-
//# sourceMappingURL=index-41e242ce.esm.js.map
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import{createApiRef as F,createRouteRef as y,createSubRouteRef as R,createPlugin as S,createApiFactory as D,discoveryApiRef as $,fetchApiRef as E,createRoutableExtension as w,createComponentExtension as A,useApi as P,configApiRef as I}from"@backstage/core-plugin-api";import{GraphQLClient as q}from"graphql-request";import o from"graphql-tag";var L=(e=>(e.Medal="MEDAL",e))(L||{}),k=(e=>(e.Failed="FAILED",e.NotApplicable="NOT_APPLICABLE",e.NotReported="NOT_REPORTED",e.Passed="PASSED",e))(k||{});const M=o`
|
|
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
|
-
`,b=o`
|
|
24
|
-
fragment CheckResultSummary on CheckResult {
|
|
25
|
-
id
|
|
26
|
-
name
|
|
27
|
-
result
|
|
28
|
-
timestamp
|
|
29
|
-
}
|
|
30
|
-
`,B=o`
|
|
31
|
-
fragment CheckResultDetails on CheckResult {
|
|
32
|
-
id
|
|
33
|
-
name
|
|
34
|
-
description
|
|
35
|
-
result
|
|
36
|
-
timestamp
|
|
37
|
-
notes
|
|
38
|
-
}
|
|
39
|
-
`,G=o`
|
|
40
|
-
fragment OverviewLevelResult on OverviewLevelResult {
|
|
41
|
-
ordinal
|
|
42
|
-
name
|
|
43
|
-
checks {
|
|
44
|
-
check {
|
|
45
|
-
id
|
|
46
|
-
name
|
|
47
|
-
}
|
|
48
|
-
results {
|
|
49
|
-
id
|
|
50
|
-
entityRef
|
|
51
|
-
result
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
`,W=o`
|
|
56
|
-
fragment HighestLevel on LevelResult {
|
|
57
|
-
entityRef
|
|
58
|
-
ordinal
|
|
59
|
-
name
|
|
60
|
-
badge {
|
|
61
|
-
... on BadgeVariantMedal {
|
|
62
|
-
variant
|
|
63
|
-
options {
|
|
64
|
-
color
|
|
65
|
-
level
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
`,T=o`
|
|
71
|
-
query getAllCertifications($entityRef: String!) {
|
|
72
|
-
certifications(entityRef: $entityRef, includeFilteredChecks: false) {
|
|
73
|
-
...CertificationSummary
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
${M}`,V=o`
|
|
77
|
-
query getCertificationDetails($entityRef: String!, $programId: String!) {
|
|
78
|
-
programCertification(
|
|
79
|
-
entityRef: $entityRef
|
|
80
|
-
programId: $programId
|
|
81
|
-
includeFilteredChecks: false
|
|
82
|
-
) {
|
|
83
|
-
program {
|
|
84
|
-
id
|
|
85
|
-
name
|
|
86
|
-
description
|
|
87
|
-
documentationUrl
|
|
88
|
-
}
|
|
89
|
-
highestLevel {
|
|
90
|
-
name
|
|
91
|
-
ordinal
|
|
92
|
-
badge {
|
|
93
|
-
... on BadgeVariantMedal {
|
|
94
|
-
variant
|
|
95
|
-
options {
|
|
96
|
-
level
|
|
97
|
-
color
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
levels {
|
|
103
|
-
ordinal
|
|
104
|
-
name
|
|
105
|
-
description
|
|
106
|
-
badge {
|
|
107
|
-
... on BadgeVariantMedal {
|
|
108
|
-
variant
|
|
109
|
-
options {
|
|
110
|
-
level
|
|
111
|
-
color
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
certified
|
|
116
|
-
checks {
|
|
117
|
-
...CheckResultSummary
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
${b}`,N=o`
|
|
123
|
-
query getCheckResultDetails($entityRef: String!, $programId: String!, $checkId: String!) {
|
|
124
|
-
checkResult(entityRef: $entityRef, programId: $programId, checkId: $checkId) {
|
|
125
|
-
...CheckResultDetails
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
${B}`,x=o`
|
|
129
|
-
query getFacetsForOwner($ownerEntityRef: String!) {
|
|
130
|
-
facetsForOwner(ownerEntityRef: $ownerEntityRef) {
|
|
131
|
-
types {
|
|
132
|
-
value
|
|
133
|
-
count
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
`,H=o`
|
|
138
|
-
query getProgramOverviewForOwner($ownerEntityRef: String!, $facet: FacetInput) {
|
|
139
|
-
programOverviewForOwner(
|
|
140
|
-
ownerEntityRef: $ownerEntityRef
|
|
141
|
-
facet: $facet
|
|
142
|
-
includeFilteredChecks: false
|
|
143
|
-
) {
|
|
144
|
-
programs {
|
|
145
|
-
program {
|
|
146
|
-
id
|
|
147
|
-
name
|
|
148
|
-
}
|
|
149
|
-
highestLevels {
|
|
150
|
-
...HighestLevel
|
|
151
|
-
}
|
|
152
|
-
levels {
|
|
153
|
-
...OverviewLevelResult
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
entityRefs
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
${W}
|
|
160
|
-
${G}`,z=(e,t,r)=>e();function U(e,t=z){return{getAllCertifications(r,i){return t(n=>e.request(T,r,{...i,...n}),"getAllCertifications","query")},getCertificationDetails(r,i){return t(n=>e.request(V,r,{...i,...n}),"getCertificationDetails","query")},getCheckResultDetails(r,i){return t(n=>e.request(N,r,{...i,...n}),"getCheckResultDetails","query")},getFacetsForOwner(r,i){return t(n=>e.request(x,r,{...i,...n}),"getFacetsForOwner","query")},getProgramOverviewForOwner(r,i){return t(n=>e.request(H,r,{...i,...n}),"getProgramOverviewForOwner","query")}}}var C=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},a=(e,t,r)=>(C(e,t,"read from private field"),r?r.call(e):t.get(e)),l=(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)},f=(e,t,r,i)=>(C(e,t,"write to private field"),i?i.call(e,r):t.set(e,r),r),d,h,c,p,s;const O=F({id:"plugin.soundcheck"}),_=e=>"response"in e&&"errors"in e.response,Q=e=>"response"in e&&"message"in e.response;class j{constructor(t){l(this,d,void 0),l(this,h,void 0),l(this,c,void 0),l(this,p,i=>{var n,u,v;return _(i)?(v=(u=(n=i.response)==null?void 0:n.errors)==null?void 0:u[0].message)!=null?v:`${i}`:Q(i)?i.response.message:`${i}`}),l(this,s,async i=>{try{return await i()}catch(n){throw new Error(`Error from Soundcheck backend: ${a(this,p).call(this,n)}`)}}),f(this,d,t.fetchApi),f(this,h,t.discoveryApi);const r=new q("/graphql",{fetch:async(i,n)=>{const u=`${await a(this,h).getBaseUrl("soundcheck")}${i}`;return a(this,d).fetch(u,n)}});f(this,c,U(r))}async getAllCertifications(t){return a(this,s).call(this,async()=>{const{certifications:r}=await a(this,c).getAllCertifications({entityRef:t});return r})}async getCertificationDetails(t,r){return a(this,s).call(this,async()=>{const{programCertification:i}=await a(this,c).getCertificationDetails({entityRef:t,programId:r});return i})}async getCheckResultDetails(t,r,i){return a(this,s).call(this,async()=>{const{checkResult:n}=await a(this,c).getCheckResultDetails({entityRef:t,programId:r,checkId:i});return n})}async getFacetsForOwner(t){return a(this,s).call(this,async()=>{const{facetsForOwner:r}=await a(this,c).getFacetsForOwner({ownerEntityRef:t});return r})}async getProgramOverviewForOwner(t,r){return a(this,s).call(this,async()=>{const{programOverviewForOwner:i}=await a(this,c).getProgramOverviewForOwner({ownerEntityRef:t,facet:r});return i})}}d=new WeakMap,h=new WeakMap,c=new WeakMap,p=new WeakMap,s=new WeakMap;const g=y({id:"soundcheck-entity"}),J=R({id:"soundcheck-entity-certification-program-redirect",parent:g,path:"/:programId"}),K=R({id:"soundcheck-entity-certification",parent:g,path:"/:programId/:checkId"}),X=y({id:"soundcheck-overview"}),m=S({id:"soundcheck",apis:[D({api:O,deps:{discoveryApi:$,fetchApi:E},factory:e=>new j(e)})],routes:{entityContent:g}}),Y=m.provide(w({name:"EntitySoundcheckContent",component:()=>import("./EntitySoundcheckContent-931d8ed8.esm.js").then(e=>e.EntitySoundcheckContent),mountPoint:g})),Z=m.provide(A({name:"EntitySoundcheckCard",component:{lazy:()=>import("./index-0f37ee61.esm.js").then(e=>e.EntitySoundcheckCard)}})),ee=m.provide(w({name:"SoundcheckOverviewPage",component:()=>import("./index-41e242ce.esm.js").then(e=>()=>{var t;return e.overviewPage((t=P(I).getOptionalBoolean("soundcheck.virtualizeOverviewPage"))!=null?t:!1)}),mountPoint:X}));export{Y as E,k as R,ee as S,K as a,m as b,J as c,Z as d,O as s};
|
|
161
|
-
//# sourceMappingURL=index-d6a5b7f6.esm.js.map
|