@spotify/backstage-plugin-soundcheck 0.3.0 → 0.4.1
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 +52 -0
- package/README.md +15 -2
- package/config.d.ts +11 -0
- package/dist/esm/EntitySoundcheckContent-d0819302.esm.js +2 -0
- package/dist/esm/RefetchingIndicator-96188300.esm.js +2 -0
- package/dist/esm/index-5d64d93c.esm.js +157 -0
- package/dist/esm/index-808077a4.esm.js +2 -0
- package/dist/esm/index-9d77be51.esm.js +2 -0
- package/dist/index.d.ts +25 -3
- package/dist/index.esm.js +1 -1
- package/package.json +26 -21
- package/dist/esm/CertificationSidebar-c4cee874.esm.js +0 -2
- package/dist/esm/EntitySoundcheckContent-a2d35ddd.esm.js +0 -2
- package/dist/esm/RefetchingIndicator-9e7adc3f.esm.js +0 -2
- package/dist/esm/SoundcheckQueryClientProvider-f6aa058e.esm.js +0 -2
- package/dist/esm/index-5f7bf7f6.esm.js +0 -2
- package/dist/esm/index-6b006938.esm.js +0 -161
- package/dist/esm/index-72edc5c7.esm.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @spotify/backstage-plugin-soundcheck
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Upgraded Backstage to `v1.13.0`.
|
|
8
|
+
- Removed extra scrollbars from the Soundcheck overview page.
|
|
9
|
+
- Added "No Level" badges to the tables on the Soundcheck overview page.
|
|
10
|
+
- Added tooltips to checks in the overview page results table.
|
|
11
|
+
- Removed extra scrollbars when there are no entities on the overview page.
|
|
12
|
+
Improvements to the loading of the overview page table.
|
|
13
|
+
- Added a message in the checks list of a level to indicate to a user when the level has no checks enabled.
|
|
14
|
+
- Resolved browser warnings on the overview page.
|
|
15
|
+
- The overview page can now accept a custom title. Set this in your `App.tsx` file as a property of the `SoundcheckOverviewPage`:
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
<SoundcheckOverviewPage title="My Custom Title" />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- A program's `documentationURL` is now displayed as a "Learn More" link below the program description.
|
|
22
|
+
- The Soundcheck entity card can now accept a custom title. Set this in your `EntityPage.tsx` file as a property of the `EntitySoundcheckCard`:
|
|
23
|
+
|
|
24
|
+
```jsx
|
|
25
|
+
<EntitySoundcheckCard title="My Custom Title" />
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- Updated styling to resolve misaligned borders for the tables on the overview page.
|
|
29
|
+
- Updated dependencies
|
|
30
|
+
- @spotify/backstage-plugin-core@0.5.1
|
|
31
|
+
|
|
32
|
+
## 0.4.0
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- 07770382: Upgrade to Backstage 1.12.0
|
|
37
|
+
- 1d2bfc05: Added a virtualizeOverviewPage configuration option to only render parts of the Soundcheck overview
|
|
38
|
+
page that are in-view. This improves performance for teams that have a large amount of entities.
|
|
39
|
+
|
|
40
|
+
To enable this option, add the configuration to your app-config.yaml:
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
soundcheck:
|
|
44
|
+
virtualizeOverviewPage: true
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- 7e1032fb: Updated dependency `graphql-request` to `5.1.0`
|
|
50
|
+
- 68db7129: Filter entity types out of Soundcheck overview page if the have no associated entities
|
|
51
|
+
- 179888c1: Program descriptions now support markdown content.
|
|
52
|
+
- Updated dependencies [31ac4320]
|
|
53
|
+
- @spotify/backstage-plugin-core@0.5.0
|
|
54
|
+
|
|
3
55
|
## 0.3.0
|
|
4
56
|
|
|
5
57
|
### 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
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{useState as W,useEffect as M}from"react";import{Link as O,useParams as Q,Routes as j,Route as k,Navigate as I}from"react-router-dom";import{makeStyles as p,Typography as f,Box as U,Tab as L,Tabs as T,Paper as V,Divider as Y}from"@material-ui/core";import{SpotifyLicenseBanner as q}from"@spotify/backstage-plugin-core";import{useEntity as u}from"@backstage/plugin-catalog-react";import{R as G}from"./RefetchingIndicator-96188300.esm.js";import{s as H,R as c,A as y,F as P,a as J,u as x,L as K,N as X,b,c as g,d as Z,C as _,e as B,S as ee}from"./index-5d64d93c.esm.js";import{Skeleton as s}from"@material-ui/lab";import{MarkdownContent as F}from"@backstage/core-components";import{stringifyEntityRef as te}from"@backstage/catalog-model";import{useApi as ae,useRouteRef as C,useRouteRefParams as re}from"@backstage/core-plugin-api";import{useQuery as ne}from"@tanstack/react-query";import ie from"react-use/lib/useMeasure";import $ from"react-use/lib/usePrevious";import le from"react-confetti";import"react-use/lib/useDebounce";import"graphql-request";import"graphql-tag";import"lodash";import"@material-ui/core/styles/makeStyles";import"classnames";import"@material-ui/icons/Schedule";import"luxon";import"@material-ui/icons/Check";import"@material-ui/icons/Close";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/HelpOutline";function oe(t,r,a){const n=ae(H),i=te(t);return ne(["soundcheck/check-details",i,r,a],async()=>n.getCheckResultDetails(i,r,a),{enabled:!!r&&!!a})}const ce=p({markdownContent:{"& :last-child":{marginBottom:0}}}),se=({state:t,notes:r})=>{const a=ce(),n={[c.Passed]:"success",[c.Failed]:"error",[c.NotReported]:"info",[c.NotApplicable]:"info"}[t],i={[c.Passed]:"Check passed",[c.Failed]:"Check did not pass",[c.NotReported]:"Check not reported",[c.NotApplicable]:"Check not applicable"}[t];return e.createElement(y,{severity:n,title:i},r?e.createElement(F,{className:a.markdownContent,content:r}):null)},me=()=>{const t=A();return e.createElement(P,null,e.createElement("div",{className:t.root,"data-testid":"check-details-view"},e.createElement("div",{className:t.topBar},e.createElement(f,{variant:"h2",className:t.title},e.createElement(s,{width:300,height:32})),e.createElement(s,{width:100,height:32})),e.createElement(s,{variant:"rect",height:120}),e.createElement("div",{"data-testid":"soundcheck-check-details-description"},e.createElement(f,{variant:"h3"},e.createElement(s,null)),e.createElement(s,null),e.createElement(s,null),e.createElement(s,null))))},A=p(t=>({root:{padding:`${t.spacing(3)}px ${t.spacing(5)}px`},title:{fontWeight:"normal",fontSize:t.typography.h5.fontSize},description:{padding:`${t.spacing(3)}px 0`},subtitle:{fontWeight:"normal",fontSize:t.typography.h6.fontSize},topBar:{display:"flex",justifyContent:"space-between",marginBottom:t.spacing(2)}})),de=({programId:t,checkId:r})=>{const a=A(),{entity:n}=u(),{data:i,isLoading:l,isError:o}=oe(n,t,r);if(o)return e.createElement(U,{padding:2},e.createElement(y,{severity:"error",title:"Error loading check details"}));if(l||!t||!r)return e.createElement(me,null);if(!i)return null;const{name:h,description:d,result:v,timestamp:m,notes:E}=i;return e.createElement("div",{className:a.root,"data-testid":"check-details-view"},e.createElement("div",{className:a.topBar},e.createElement(f,{variant:"h2",className:a.title},h),m?e.createElement(J,{timestamp:m,description:"Last updated"}):null),e.createElement(se,{state:v,notes:E}),e.createElement("div",{className:a.description,"data-testid":"soundcheck-check-details-description"},e.createElement(f,{variant:"h3",className:a.subtitle},"Description"),e.createElement(F,{content:d})))},pe=p(()=>({root:{position:"absolute",width:"100%",height:"100%"}})),ue=({programId:t})=>{var r,a;const n=pe(),{entity:i}=u(),{data:l,isLoading:o}=x(i,t),[h,{width:d,height:v}]=ie(),m=o?void 0:(a=(r=l==null?void 0:l.highestLevel)==null?void 0:r.ordinal)!=null?a:-1,E=$(m),R=$(t),[z,S]=W(!1);return M(()=>{typeof E!="undefined"&&typeof m!="undefined"&&t===R&&m>E&&S(!0)},[m,E,t,R]),z?e.createElement("div",{ref:h,className:n.root},e.createElement(le,{width:d,height:v,numberOfPieces:1e3,gravity:1,initialVelocityY:20,recycle:!1,onConfettiComplete:()=>S(!1)})):null},D=p(t=>({root:{maxWidth:"80ch",textTransform:"uppercase",paddingTop:t.spacing(2),paddingBottom:t.spacing(2)},wrapper:{display:"inline-block",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},badge:{marginRight:t.spacing(1)}})),he=({id:t,name:r,badge:a,href:n,selected:i=!1})=>{const l=D();return e.createElement(L,{className:l.root,classes:{wrapper:l.wrapper},value:t,label:e.createElement(e.Fragment,null,a?e.createElement(K,{badge:a,className:l.badge}):e.createElement(X,{className:l.badge}),r),component:O,to:n,selected:i})},w=()=>{const t=D();return e.createElement(L,{className:t.root,classes:{wrapper:t.wrapper},label:e.createElement(s,{width:180})})},Ee=()=>e.createElement(P,null,e.createElement(T,{value:!1,indicatorColor:"primary"},e.createElement(w,null),e.createElement(w,null),e.createElement(w,null)));function fe(t=[],r){const a=t.findIndex(n=>n.program.id===r);return a<0?!1:a}const ge=({programId:t})=>{const{entity:r}=u(),{isLoading:a,data:n}=b(r),i=C(g);if(a||!t)return e.createElement(Ee,null);const l=fe(n,t);return e.createElement(T,{value:l,indicatorColor:"primary","aria-label":"Certifications",variant:"scrollable"},n&&n.map(({program:{id:o,name:h},highestLevel:d})=>e.createElement(he,{key:o,id:o,name:h,badge:d==null?void 0:d.badge,selected:o===t,href:i({programId:o})})))},ve=p({paper:{overflow:"hidden",position:"relative"},view:{display:"grid",gridTemplateColumns:"1fr 2fr"}}),ke=()=>{const{programId:t,checkId:r}=Q(),a=ve(),{entity:n}=u(),{isError:i,isFetched:l,data:o}=b(n);return i?e.createElement(y,{severity:"error",title:"Error loading certifications"}):l&&!(o!=null&&o.length)?e.createElement(Z,null):e.createElement(V,{className:a.paper},e.createElement(G,null),e.createElement(ge,{programId:t}),e.createElement(Y,null),e.createElement("div",{"data-testid":"soundcheck-certification-view",className:a.view},e.createElement(_,{programId:t,checkId:r}),e.createElement(de,{programId:t,checkId:r}),e.createElement(ue,{programId:t})))},ye=p(t=>({root:{"&:not(:first-child)":{marginTop:t.spacing(2)}}})),N=()=>{const t=ye();return e.createElement(e.Fragment,null,e.createElement(q,{backend:"soundcheck",invalidLicenseMessage:"Submitted check results will still be stored, but it will not be possible to view certifications or individual results until a valid license is present.",inline:!0}),e.createElement("div",{className:t.root},e.createElement(ke,null)))},be=()=>{var t;const{entity:r}=u(),a=C(g),{data:n}=b(r),i=(t=n==null?void 0:n[0])==null?void 0:t.program.id;return i?e.createElement(I,{to:a({programId:i}),replace:!0}):null},Ce=()=>{var t,r;const{entity:a}=u(),{programId:n}=re(g),i=C(B),{data:l}=x(a,n),o=(r=(t=l==null?void 0:l.levels[0])==null?void 0:t.checks[0])==null?void 0:r.id;return o?e.createElement(I,{to:i({programId:n,checkId:o}),replace:!0}):null},we=()=>e.createElement(j,null,e.createElement(k,{path:"/",element:e.createElement(e.Fragment,null,e.createElement(N,null),e.createElement(be,null))}),e.createElement(k,{path:g.path,element:e.createElement(e.Fragment,null,e.createElement(N,null),e.createElement(Ce,null))}),e.createElement(k,{path:B.path,element:e.createElement(N,null)})),Ne=()=>e.createElement(ee,null,e.createElement(we,null));export{Ne as EntitySoundcheckContent};
|
|
2
|
+
//# sourceMappingURL=EntitySoundcheckContent-d0819302.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{useState as n}from"react";import{makeStyles as a,LinearProgress as m}from"@material-ui/core";import s from"react-use/lib/useDebounce";import"@backstage/catalog-model";import"@backstage/core-plugin-api";import{useIsFetching as c}from"@tanstack/react-query";import{F as d}from"./index-5d64d93c.esm.js";import"@backstage/plugin-catalog-react";import"react-router-dom";const p=a(t=>({indicator:{position:"absolute",width:"100%",zIndex:t.zIndex.speedDial}})),l=()=>{const t=c(),i=p(),[r,o]=n(!!t);return s(()=>{o(!!t)},250,[t]),r?e.createElement(d,null,e.createElement("div",{className:i.indicator},e.createElement(m,{variant:"indeterminate","data-testid":"refetching-indicator"}))):null};export{l as R};
|
|
2
|
+
//# sourceMappingURL=RefetchingIndicator-96188300.esm.js.map
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import{createApiRef as he,createRouteRef as M,createSubRouteRef as W,createPlugin as fe,createApiFactory as ye,discoveryApiRef as ve,fetchApiRef as Ee,createRoutableExtension as G,createComponentExtension as ke,useApi as I,errorApiRef as Ce,useRouteRef as U}from"@backstage/core-plugin-api";import{GraphQLClient as Re}from"graphql-request";import m from"graphql-tag";import t,{useState as we,useEffect as be,Fragment as Se}from"react";import{QueryClient as $e,QueryClientProvider as Ne,useQuery as H}from"@tanstack/react-query";import{memoize as Le}from"lodash";import Fe from"@material-ui/core/styles/makeStyles";import{makeStyles as d,Typography as c,Fade as Ie,alpha as v,Tooltip as De,withStyles as k,Box as Ae,Divider as Oe}from"@material-ui/core";import{MarkdownContent as j,Link as Q,EmptyState as V,InfoCard as xe}from"@backstage/core-components";import{useEntity as _,humanizeEntityRef as Te}from"@backstage/plugin-catalog-react";import{useAutoUpdatingRelativeTime as Pe,SpotifyLicenseBanner as ze}from"@spotify/backstage-plugin-core";import{stringifyEntityRef as K,parseEntityRef as Be}from"@backstage/catalog-model";import{Link as qe}from"react-router-dom";import{Skeleton as u,Alert as Me}from"@material-ui/lab";import C from"classnames";import We from"@material-ui/icons/Schedule";import{DateTime as J}from"luxon";import Ge from"@material-ui/icons/Check";import Ue from"@material-ui/icons/Close";import He from"@material-ui/icons/RemoveCircleOutline";import je from"@material-ui/icons/HelpOutline";var X=(e=>(e.Medal="MEDAL",e))(X||{}),p=(e=>(e.Failed="FAILED",e.NotApplicable="NOT_APPLICABLE",e.NotReported="NOT_REPORTED",e.Passed="PASSED",e))(p||{});const Qe=m`
|
|
2
|
+
fragment CertificationSummary on Certification {
|
|
3
|
+
entityRef
|
|
4
|
+
program {
|
|
5
|
+
id
|
|
6
|
+
name
|
|
7
|
+
}
|
|
8
|
+
highestLevel {
|
|
9
|
+
ordinal
|
|
10
|
+
name
|
|
11
|
+
description
|
|
12
|
+
badge {
|
|
13
|
+
... on BadgeVariantMedal {
|
|
14
|
+
variant
|
|
15
|
+
options {
|
|
16
|
+
level
|
|
17
|
+
color
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`,Ve=m`
|
|
24
|
+
fragment CheckResultSummary on CheckResult {
|
|
25
|
+
id
|
|
26
|
+
name
|
|
27
|
+
result
|
|
28
|
+
timestamp
|
|
29
|
+
}
|
|
30
|
+
`,_e=m`
|
|
31
|
+
fragment LevelResultDetails on LevelResult {
|
|
32
|
+
ordinal
|
|
33
|
+
name
|
|
34
|
+
description
|
|
35
|
+
badge {
|
|
36
|
+
... on BadgeVariantMedal {
|
|
37
|
+
variant
|
|
38
|
+
options {
|
|
39
|
+
level
|
|
40
|
+
color
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
certified
|
|
45
|
+
checks {
|
|
46
|
+
...CheckResultSummary
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
${Ve}`,Ke=m`
|
|
50
|
+
fragment CheckResultDetails on CheckResult {
|
|
51
|
+
id
|
|
52
|
+
name
|
|
53
|
+
description
|
|
54
|
+
result
|
|
55
|
+
timestamp
|
|
56
|
+
notes
|
|
57
|
+
}
|
|
58
|
+
`,Je=m`
|
|
59
|
+
fragment OverviewLevelResult on OverviewLevelResult {
|
|
60
|
+
ordinal
|
|
61
|
+
name
|
|
62
|
+
checks {
|
|
63
|
+
check {
|
|
64
|
+
id
|
|
65
|
+
name
|
|
66
|
+
description
|
|
67
|
+
}
|
|
68
|
+
results {
|
|
69
|
+
id
|
|
70
|
+
entityRef
|
|
71
|
+
result
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
`,Y=m`
|
|
76
|
+
fragment HighestLevel on LevelResult {
|
|
77
|
+
entityRef
|
|
78
|
+
ordinal
|
|
79
|
+
name
|
|
80
|
+
badge {
|
|
81
|
+
... on BadgeVariantMedal {
|
|
82
|
+
variant
|
|
83
|
+
options {
|
|
84
|
+
color
|
|
85
|
+
level
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`,Xe=m`
|
|
91
|
+
query getAllCertifications($entityRef: String!) {
|
|
92
|
+
certifications(entityRef: $entityRef, includeFilteredChecks: false) {
|
|
93
|
+
...CertificationSummary
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
${Qe}`,Ye=m`
|
|
97
|
+
query getCertificationDetails($entityRef: String!, $programId: String!) {
|
|
98
|
+
programCertification(
|
|
99
|
+
entityRef: $entityRef
|
|
100
|
+
programId: $programId
|
|
101
|
+
includeFilteredChecks: false
|
|
102
|
+
) {
|
|
103
|
+
program {
|
|
104
|
+
id
|
|
105
|
+
name
|
|
106
|
+
description
|
|
107
|
+
documentationURL
|
|
108
|
+
}
|
|
109
|
+
highestLevel {
|
|
110
|
+
...HighestLevel
|
|
111
|
+
}
|
|
112
|
+
levels {
|
|
113
|
+
...LevelResultDetails
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
${Y}
|
|
118
|
+
${_e}`,Ze=m`
|
|
119
|
+
query getCheckResultDetails($entityRef: String!, $programId: String!, $checkId: String!) {
|
|
120
|
+
checkResult(entityRef: $entityRef, programId: $programId, checkId: $checkId) {
|
|
121
|
+
...CheckResultDetails
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
${Ke}`,et=m`
|
|
125
|
+
query getFacetsForOwner($ownerEntityRef: String!) {
|
|
126
|
+
facetsForOwner(ownerEntityRef: $ownerEntityRef) {
|
|
127
|
+
types {
|
|
128
|
+
value
|
|
129
|
+
count
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
`,tt=m`
|
|
134
|
+
query getProgramOverviewForOwner($ownerEntityRef: String!, $facet: FacetInput) {
|
|
135
|
+
programOverviewForOwner(
|
|
136
|
+
ownerEntityRef: $ownerEntityRef
|
|
137
|
+
facet: $facet
|
|
138
|
+
includeFilteredChecks: false
|
|
139
|
+
) {
|
|
140
|
+
programs {
|
|
141
|
+
program {
|
|
142
|
+
id
|
|
143
|
+
name
|
|
144
|
+
}
|
|
145
|
+
highestLevels {
|
|
146
|
+
...HighestLevel
|
|
147
|
+
}
|
|
148
|
+
levels {
|
|
149
|
+
...OverviewLevelResult
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
entityRefs
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
${Y}
|
|
156
|
+
${Je}`,rt=(e,r,a)=>e();function at(e,r=rt){return{getAllCertifications(a,n){return r(i=>e.request(Xe,a,{...n,...i}),"getAllCertifications","query")},getCertificationDetails(a,n){return r(i=>e.request(Ye,a,{...n,...i}),"getCertificationDetails","query")},getCheckResultDetails(a,n){return r(i=>e.request(Ze,a,{...n,...i}),"getCheckResultDetails","query")},getFacetsForOwner(a,n){return r(i=>e.request(et,a,{...n,...i}),"getFacetsForOwner","query")},getProgramOverviewForOwner(a,n){return r(i=>e.request(tt,a,{...n,...i}),"getProgramOverviewForOwner","query")}}}var Z=(e,r,a)=>{if(!r.has(e))throw TypeError("Cannot "+a)},s=(e,r,a)=>(Z(e,r,"read from private field"),a?a.call(e):r.get(e)),E=(e,r,a)=>{if(r.has(e))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(e):r.set(e,a)},D=(e,r,a,n)=>(Z(e,r,"write to private field"),n?n.call(e,a):r.set(e,a),a),R,w,h,A,f;const b=he({id:"plugin.soundcheck"}),nt=e=>"response"in e&&"errors"in e.response,it=e=>"response"in e&&"message"in e.response;class ot{constructor(r){E(this,R,void 0),E(this,w,void 0),E(this,h,void 0),E(this,A,n=>{var i,o,l;return nt(n)?(l=(o=(i=n.response)==null?void 0:i.errors)==null?void 0:o[0].message)!=null?l:`${n}`:it(n)?n.response.message:`${n}`}),E(this,f,async n=>{try{return await n()}catch(i){throw new Error(`Error from Soundcheck backend: ${s(this,A).call(this,i)}`)}}),D(this,R,r.fetchApi),D(this,w,r.discoveryApi);const a=new Re("/graphql",{fetch:async(n,i)=>{const o=`${await s(this,w).getBaseUrl("soundcheck")}${n}`;return s(this,R).fetch(o,i)}});D(this,h,at(a))}async getAllCertifications(r){return s(this,f).call(this,async()=>{const{certifications:a}=await s(this,h).getAllCertifications({entityRef:r});return a})}async getCertificationDetails(r,a){return s(this,f).call(this,async()=>{const{programCertification:n}=await s(this,h).getCertificationDetails({entityRef:r,programId:a});return n})}async getCheckResultDetails(r,a,n){return s(this,f).call(this,async()=>{const{checkResult:i}=await s(this,h).getCheckResultDetails({entityRef:r,programId:a,checkId:n});return i})}async getFacetsForOwner(r){return s(this,f).call(this,async()=>{const{facetsForOwner:a}=await s(this,h).getFacetsForOwner({ownerEntityRef:r});return a})}async getProgramOverviewForOwner(r,a){return s(this,f).call(this,async()=>{const{programOverviewForOwner:n}=await s(this,h).getProgramOverviewForOwner({ownerEntityRef:r,facet:a});return n})}}R=new WeakMap,w=new WeakMap,h=new WeakMap,A=new WeakMap,f=new WeakMap;const S=M({id:"soundcheck-entity"}),ee=W({id:"soundcheck-entity-certification-program-redirect",parent:S,path:"/:programId"}),te=W({id:"soundcheck-entity-certification",parent:S,path:"/:programId/:checkId"}),lt=M({id:"soundcheck-overview"}),$=fe({id:"soundcheck",apis:[ye({api:b,deps:{discoveryApi:ve,fetchApi:Ee},factory:e=>new ot(e)})],routes:{entityContent:S}}),ct=$.provide(G({name:"EntitySoundcheckContent",component:()=>import("./EntitySoundcheckContent-d0819302.esm.js").then(e=>e.EntitySoundcheckContent),mountPoint:S})),st=$.provide(ke({name:"EntitySoundcheckCard",component:{lazy:()=>import("./index-9d77be51.esm.js").then(e=>e.EntitySoundcheckCard)}})),mt=$.provide(G({name:"SoundcheckOverviewPage",component:()=>import("./index-808077a4.esm.js").then(e=>e.overviewPage),mountPoint:lt})),dt=Le(e=>new $e({defaultOptions:{queries:{refetchInterval:6e4,refetchIntervalInBackground:!1,refetchOnWindowFocus:"always",retry:2,retryDelay:r=>{const a=450+Math.ceil(Math.random()*100);return Math.min(a*2**r,3e4)},onError:r=>e.post(r)}}})),pt=e=>{const r=I(Ce),a=dt(r);return t.createElement(Ne,{client:a},e.children)};function re(e){const r=I(b),a=K(e);return H(["soundcheck/certifications",a],async()=>r.getAllCertifications(a))}function ae(e,r){const a=I(b),n=K(e);return H(["soundcheck/certifications",n,r],async()=>a.getCertificationDetails(n,r),{enabled:!!r})}const ne=24,ut=11,O=e=>e==="small"?1:2,gt=d({root:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",borderWidth:"2px",fontWeight:700,width:({size:e})=>`${ne*O(e)}px`,height:({size:e})=>`${ne*O(e)}px`,fontSize:({size:e})=>`${ut*O(e)}px`}}),ie=({className:e,label:r,size:a="small"})=>{const n=gt({size:a});return t.createElement("span",{className:C(e,n.root),role:"img","aria-label":`${r} badge`},r)},ht=d(e=>({root:{background:({color:r})=>r,color:({color:r})=>e.palette.getContrastText(r),borderColor:e.palette.common.black,borderStyle:"solid","&::after":{position:"absolute",display:"block",content:'""',top:0,left:0,width:"100%",height:"100%",borderRadius:"50%",boxShadow:["inset 0 -0.18em 0 0 rgba(0, 0, 0, 0.25)","inset 0px 0.18em 0px 0px rgba(255, 255, 255, 0.5)","inset 0px 1.3em 0px -0.5em rgba(255, 255, 255, 0.2)"].join(",")}}})),x=({className:e,badge:r,size:a="small"})=>{const n=ht({color:r.options.color,size:a});return t.createElement(ie,{className:C(e,n.root),size:a,label:`L${r.options.level}`})},ft=d({root:{borderColor:"currentColor",borderStyle:"dashed"}}),oe=({className:e,size:r="small"})=>{const a=ft();return t.createElement(ie,{className:C(e,a.root),size:r,label:"NL"})},T=d(e=>({description:{padding:0,margin:0,display:"block","& p":{margin:0}},root:{padding:e.spacing(2),margin:0,display:"grid",gridTemplateColumns:"min-content auto",gridGap:e.spacing(2)},title:{fontSize:e.typography.pxToRem(18)},level:{textTransform:"uppercase",color:e.palette.text.secondary,fontWeight:700,letterSpacing:"1px"}}));function yt({description:e,documentationUrl:r}){const a=T();return r?t.createElement("div",{className:a.description},t.createElement(j,{content:e}),t.createElement(Q,{to:r},"Learn more")):t.createElement("div",{className:a.description},t.createElement(j,{content:e}))}const le=({name:e,level:r,badge:a,description:n,documentationUrl:i})=>{const o=T();return t.createElement("div",{className:o.root},a?t.createElement(x,{size:"large",badge:a}):t.createElement(oe,{size:"large"}),t.createElement("div",null,t.createElement(c,{variant:"caption",className:o.level},r!=null?r:"No Level"),t.createElement(c,{variant:"h4",className:o.title},e),n&&t.createElement(yt,{description:n,documentationUrl:i})))},N=({children:e})=>{const[r,a]=we(!1);return be(()=>{const n=setTimeout(()=>{a(!0)},250);return()=>clearTimeout(n)},[]),t.createElement(Ie,{in:r,timeout:250},e)},P=({hideDescription:e=!1})=>{const r=T();return t.createElement(N,null,t.createElement("div",{className:r.root},t.createElement(u,{width:44,height:44}),t.createElement("div",null,t.createElement(c,{variant:"caption",className:r.level},t.createElement(u,{width:100})),t.createElement(c,{variant:"h4",className:r.title},t.createElement(u,{width:300})),!e&&t.createElement(c,{variant:"body2"},t.createElement(u,null)))))},ce=d(e=>{const r=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{wrapper:{backgroundColor:r,color:v(e.palette.getContrastText(r),.7),fontSize:e.typography.caption.fontSize,minHeight:"auto",borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`,padding:e.spacing(1),display:"grid",gridTemplateAreas:({badge:a})=>[`"${a?"badge":"title"} title"`,`"${a?".":"description"} description"`].join(" "),gridTemplateColumns:"auto 1fr"},title:{gridArea:"title",textTransform:"uppercase",fontWeight:"bold",color:v(e.palette.getContrastText(r),.7),fontSize:e.typography.body2.fontSize,paddingTop:e.spacing(.5),paddingBottom:e.spacing(.5),lineHeight:1},badge:{gridArea:"badge",marginRight:e.spacing(1)},description:{gridArea:"description",color:v(e.palette.getContrastText(r),.7),fontSize:e.typography.subtitle2.fontSize,marginTop:e.spacing(1)}}}),vt=e=>{const r=ce({badge:e.badge});return t.createElement("div",{className:r.wrapper},e.badge?t.createElement(x,{className:r.badge,badge:e.badge}):null,t.createElement(c,{className:r.title},e.title),e.description?t.createElement(c,{className:r.description},e.description):null)},Et=()=>{const e=ce({});return t.createElement(N,null,t.createElement("div",{className:e.wrapper},t.createElement(u,{className:e.title}),t.createElement(c,{className:e.description},t.createElement(u,null))))},kt=d(e=>({root:{display:"inline-flex",alignItems:"center",gap:e.spacing(1)}})),se=({timestamp:e,description:r})=>{const a=kt(),n=J.fromISO(e).toLocaleString(J.DATETIME_FULL),i=Pe(e),o=r?`${r}: ${i}`:void 0;return t.createElement("div",{className:a.root},t.createElement(De,{title:n},t.createElement(c,{variant:"caption","aria-label":o},i)),t.createElement(We,null))},Ct=e=>({[p.Passed]:"Check passed",[p.NotReported]:"Check not reported",[p.Failed]:"Check failed",[p.NotApplicable]:"Check not applicable"})[e],Rt=k(e=>({root:{color:e.palette.success.main}}))(Ge),wt=k(e=>({root:{color:e.palette.error.main}}))(Ue),bt=k(e=>({root:{color:e.palette.info.main}}))(je),St=k(e=>({root:{color:e.palette.text.disabled}}))(He),me=({result:e,className:r})=>{const a={className:r,"aria-label":Ct(e),"aria-hidden":!1};return e===p.Passed?t.createElement(Rt,{...a}):e===p.NotReported?t.createElement(bt,{...a}):e===p.Failed?t.createElement(wt,{...a}):e===p.NotApplicable?t.createElement(St,{...a}):null},de=d(e=>({root:{display:"grid",width:"100%",gridTemplateColumns:"auto 1fr auto",gridColumnGap:e.spacing(1),padding:e.spacing(1),alignItems:"center","&.selected":{backgroundColor:v(e.palette.primary[e.palette.type],.2)},"&:hover, &:active, &:focus":{backgroundColor:v(e.palette.primary[e.palette.type],.3)}}})),$t=({className:e,href:r,children:a})=>r?t.createElement(qe,{to:r,className:e},a):t.createElement("div",{className:e},a),Nt=({result:e,name:r,timestamp:a,selected:n=!1,href:i})=>{const o=de(),l=C(o.root,{selected:n});return t.createElement($t,{href:i,className:l},t.createElement(me,{result:e}),t.createElement(c,{variant:"body2"},r),a?t.createElement(se,{timestamp:a}):null)},z=()=>{const e=de();return t.createElement(N,null,t.createElement("div",{className:e.root},t.createElement(u,{width:24,height:24}),t.createElement(c,{variant:"body2"},t.createElement(u,null)),t.createElement(u,{width:100,height:24})))},Lt=()=>{const e=pe();return t.createElement("div",{className:e.root},t.createElement(P,null),new Array(3).fill(null).map((r,a)=>t.createElement(t.Fragment,{key:`skeleton-level-${a}`},t.createElement(Et,null),t.createElement("ul",{className:e.checks},t.createElement(z,null),t.createElement(z,null),t.createElement(z,null)))))},Ft=d(e=>({root:{padding:e.spacing(3)},icon:{display:"none"},message:{padding:0},type:{fontWeight:700}})),B=e=>{const{type:r,...a}=Ft();return t.createElement(Me,{severity:e.severity,elevation:1,classes:a},t.createElement(c,{variant:"subtitle1",classes:{root:r}},e.title),e.children)},It=d(e=>({noChecks:{padding:e.spacing(1)},checks:{padding:0,margin:0,flex:1,listStyle:"none"},checkItem:{borderBottom:`1px solid ${e.palette.divider}`,"&:last-of-type":{borderBottom:"0"}}})),Dt=({checks:e,programId:r,checkId:a})=>{const n=It(),i=U(te);return e.length?t.createElement("ul",{className:n.checks},e.map(o=>t.createElement("li",{key:o.id,className:n.checkItem},t.createElement(Nt,{...o,selected:o.id===a,href:i({programId:r,checkId:o.id})})))):t.createElement(c,{variant:"body2",className:n.noChecks},"No applicable checks at this level.")},At=({level:e,checkId:r,programId:a})=>{var n;return t.createElement(t.Fragment,null,t.createElement(vt,{badge:e.badge,title:e.name,description:e.description}),t.createElement(Dt,{checks:(n=e.checks)!=null?n:[],programId:a,checkId:r}))},pe=d(e=>({root:{borderRight:`1px solid ${e.palette.divider}`},checks:{padding:0,margin:0,flex:1,listStyle:"none"}})),Ot=({programId:e,checkId:r})=>{var a,n;const i=pe(),{entity:o}=_(),{data:l,isLoading:g,isError:F}=ae(o,e);return F?t.createElement("div",{className:i.root},t.createElement(Ae,{padding:2},t.createElement(B,{severity:"error",title:"Error loading certification"}))):g||!e?t.createElement(Lt,null):l?t.createElement("div",{className:i.root},t.createElement(le,{name:l.program.name,level:(a=l.highestLevel)==null?void 0:a.name,badge:(n=l.highestLevel)==null?void 0:n.badge,description:l.program.description,documentationUrl:l.program.documentationURL}),l==null?void 0:l.levels.map(y=>t.createElement(At,{key:y.ordinal,level:y,checkId:r,programId:e}))):null},xt=()=>t.createElement(t.Fragment,null,t.createElement(P,{hideDescription:!0}),t.createElement(P,{hideDescription:!0})),ue=({className:e})=>t.createElement("div",{className:e},t.createElement(V,{title:"No certifications available",missing:"data",description:"There are no programs configured that apply to this entity."})),Tt=({ownerEntityRef:e})=>e?t.createElement(V,{missing:"data",title:"Missing entities",description:t.createElement(t.Fragment,null,"Looks like the group"," ",Te(Be(e),{defaultKind:"Group"})," ","doesn't own any entities.",t.createElement("br",null),t.createElement("br",null),"Please select another group from the dropdown in the corner of the header.")}):null,ge=Fe(e=>({certificationWrapper:{display:"flex",justifyContent:"space-between",alignItems:"center"},infoCard:{display:"grid",gridRowGap:e.spacing(2)},emptyState:{"& > div":{backgroundColor:e.palette.background.paper}}})),L=({children:e,title:r})=>{const a=ge();return t.createElement(xe,{title:r},t.createElement("div",{className:a.infoCard},t.createElement(ze,{inline:!0,backend:"soundcheck",invalidLicenseMessage:"Submitted check results will still be stored, but it will not be possible to view certifications or individual results until a valid license is present."}),e))},Pt=({title:e="Soundcheck"})=>{const{entity:r}=_(),a=ge(),{data:n,isError:i,isLoading:o}=re(r),l=U(ee);return i?t.createElement(L,{title:e},t.createElement(B,{severity:"error",title:"Error loading certifications"})):o||!n?t.createElement(L,{title:e},t.createElement(xt,null)):n.length===0?t.createElement(L,{title:e},t.createElement(ue,{className:a.emptyState})):t.createElement(L,{title:e},n.map((g,F)=>{var y,q;return t.createElement(Se,{key:g.program.name},t.createElement("div",{className:a.certificationWrapper,"data-testid":"soundcheck-program-row"},t.createElement(le,{key:g.program.id,name:g.program.name,badge:(y=g.highestLevel)==null?void 0:y.badge,level:(q=g.highestLevel)==null?void 0:q.name}),t.createElement(Q,{to:l({programId:g.program.id})},"View Details")),F<n.length-1?t.createElement(Oe,null):null)}))};export{B as A,X as B,Ot as C,ct as E,N as F,x as L,oe as N,p as R,pt as S,se as a,re as b,ee as c,ue as d,te as e,Pt as f,me as g,Tt as h,$ as i,st as j,mt as k,b as s,ae as u};
|
|
157
|
+
//# sourceMappingURL=index-5d64d93c.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t,{useState as $,useEffect as k,useMemo as L,useCallback as H,memo as b,Fragment as ie}from"react";import{HeaderTabs as W,Link as I,EmptyState as se,Page as ce,Header as pe,Content as me}from"@backstage/core-components";import{SpotifyLicenseBanner as de}from"@spotify/backstage-plugin-core";import{makeStyles as g,alpha as V,TextField as ue,CircularProgress as ge,Tooltip as G,LinearProgress as he,withStyles as fe,Grid as C,Typography as y}from"@material-ui/core";import{s as M,R as N,g as ye,B as ve,L as j,N as K,A as Ee,h as ke,S as be}from"./index-5d64d93c.esm.js";import Ce from"@material-ui/lab/Autocomplete";import{stringifyEntityRef as D,parseEntityRef as v}from"@backstage/catalog-model";import{useApi as x,identityApiRef as Ne,useRouteRef as P,configApiRef as we}from"@backstage/core-plugin-api";import{useQuery as S}from"@tanstack/react-query";import{catalogApiRef as _,humanizeEntityRef as T,entityRouteRef as A}from"@backstage/plugin-catalog-react";import{useSearchParams as Re}from"react-router-dom";import{R as xe}from"./RefetchingIndicator-96188300.esm.js";import{countBy as Q}from"lodash";import{Skeleton as O}from"@material-ui/lab";import{VariableSizeGrid as $e}from"react-window";import"graphql-request";import"graphql-tag";import"@material-ui/core/styles/makeStyles";import"classnames";import"@material-ui/icons/Schedule";import"luxon";import"@material-ui/icons/Check";import"@material-ui/icons/Close";import"@material-ui/icons/RemoveCircleOutline";import"@material-ui/icons/HelpOutline";import"react-use/lib/useDebounce";function Te(e){const r=x(M);return S(["soundcheck/facets-for-owner",e],async()=>r.getFacetsForOwner(e),{enabled:!!e})}function U(e,r){const a=x(M);return S(["soundcheck/program-overview-for-owner",e,r],async()=>a.getProgramOverviewForOwner(e,r),{enabled:!!e&&!!(r!=null&&r.type)})}function Le(){const e=x(Ne),r=x(_);return S(["soundcheck/user-groups-claims"],async()=>{const{ownershipEntityRefs:a}=await e.getBackstageIdentity();return(await r.getEntitiesByRefs({entityRefs:a})).items.filter(n=>(n==null?void 0:n.kind)==="Group").map(n=>{var l,s,o,i;return{name:(i=(o=(s=(l=n.spec)==null?void 0:l.profile)==null?void 0:s.displayName)!=null?o:n.metadata.title)!=null?i:n.metadata.name,ref:D(n)}})})}function Ie(){const e=x(_);return S(["soundcheck/all-groups"],async()=>{const{items:r}=await e.getEntities({filter:{kind:"Group"}});return r.filter(a=>(a==null?void 0:a.kind)==="Group").map(a=>{var n,l,s,o;return{name:(o=(s=(l=(n=a.spec)==null?void 0:n.profile)==null?void 0:l.displayName)!=null?s:a.metadata.title)!=null?o:a.metadata.name,ref:D(a)}})})}const Pe=()=>{const[e,r]=Re(),a=Object.fromEntries(e.entries()),[n,l]=$(a);return k(()=>{r(n,{replace:!0})},[n]),[n,l]},Se=()=>{const{data:e,isLoading:r,isError:a}=Le(),{data:n,isLoading:l,isError:s}=Ie();return{options:L(()=>{const o=[];return e&&o.push(...e.map(({name:i,ref:m})=>({name:i,ref:m,key:"My Groups"}))),n&&o.push(...n.map(({name:i,ref:m})=>({name:i,ref:m,key:"All Groups"}))),o},[e,n]),isLoading:r||l,isError:a||s}},Ae=g(e=>({root:{width:"100%",minWidth:250},textField:{"& $notchedOutline":{borderColor:V(e.page.fontColor,.25)},"&:hover $notchedOutline":{borderColor:e.page.fontColor}},input:{backgroundColor:"transparent",color:e.page.fontColor},clearIndicator:{color:e.page.fontColor},popupIndicator:{color:e.page.fontColor},notchedOutline:{}})),Oe=e=>{const{onChange:r,initialValue:a,setError:n}=e,{options:l,isLoading:s,isError:o}=Se(),i=Ae(),[m,p]=$(null);k(()=>{if(!s&&l!=null&&l.length&&!m){const c=a?l.find(d=>d.ref===a):l[0];c&&(p(c),r==null||r(c.ref))}},[s,l,m,r,a]);const u=H((c,d)=>{p(d),r==null||r(d==null?void 0:d.ref)},[r,p]);return k(()=>{n==null||n(o?new Error("Error loading groups"):void 0)},[o,n]),o?null:t.createElement(Ce,{"aria-label":"Current group",className:i.root,classes:{clearIndicator:i.clearIndicator,popupIndicator:i.popupIndicator},disableClearable:!0,options:l!=null?l:[],loading:s,groupBy:c=>c.key,value:m,freeSolo:!1,onChange:u,getOptionLabel:c=>c.name,renderInput:c=>t.createElement(ue,{...c,variant:"outlined",placeholder:s?"Loading":"Select a group",className:i.textField,InputProps:{...c.InputProps,className:i.input,classes:{notchedOutline:i.notchedOutline},endAdornment:t.createElement(t.Fragment,null,s?t.createElement(ge,{color:"inherit",size:20}):null,c.InputProps.endAdornment)}})})},Be=e=>({key:`skeleton${e}`,label:"",id:`skeleton${e}`}),Fe=()=>{const e=Array.from({length:4},(r,a)=>Be(a));return t.createElement(W,{tabs:e})},ze=g(e=>({root:{borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`},tab:{textTransform:"uppercase",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)}})),He=({unfilteredFacets:e,onChange:r,type:a})=>{var n,l,s;const o=ze(),i={types:(n=e==null?void 0:e.types.filter(({count:c})=>c>0))!=null?n:[]},m=H(c=>{var d;r((d=i==null?void 0:i.types[c].value)!=null?d:"")},[i==null?void 0:i.types,r]);k(()=>{var c,d;const h=(i==null?void 0:i.types)&&i.types.length>=0,f=!a&&h,E=a&&h&&!(i!=null&&i.types.find(({value:F})=>F===a));(f||E)&&r((d=(c=i==null?void 0:i.types[0])==null?void 0:c.value)!=null?d:"")},[a,i==null?void 0:i.types,r]);const p=(l=i==null?void 0:i.types.map(({value:c,count:d})=>({key:c,label:`${c} (${d>50?"50+":d})`,id:c,tabProps:{className:o.tab}})))!=null?l:[];if(!p.length)return null;const u=(s=i==null?void 0:i.types.findIndex(c=>c.value===a))!=null?s:-1;return t.createElement(t.Fragment,null,t.createElement(xe,null),t.createElement(W,{onChange:m,tabs:p,selectedIndex:u>-1?u:void 0}))},We=g(e=>({root:{height:"8px",minWidth:"64px",marginLeft:e.spacing(2),borderRadius:"100vh",backgroundColor:e.palette.background.default},bar:{backgroundColor:e.palette.success.main,transition:"none"}})),q=e=>{var r,a;const n=We(e),l=L(()=>Object.entries(e.progress).reduce((o,[,i])=>o+i,0),[e.progress]);if(l===0)return null;const s=(r=e.progress[N.Passed])!=null?r:0;return t.createElement(G,{arrow:!0,title:`Check passing for ${s} of ${l} ${l===1?"entity":"entities"}`,enterDelay:0,placement:"top"},t.createElement(he,{variant:"determinate",value:((a=e.progress[N.Passed])!=null?a:0)/l*100,classes:{root:n.root,bar:n.bar}}))},Ve=g(e=>({headerWrapper:{marginTop:e.spacing(.5)},entityRefName:{fontWeight:"bold"},iconWrapper:{padding:e.spacing(1.5,.5),display:"flex",alignItems:"center",justifyContent:"center"}})),Ge=({check:{name:e,description:r},icon:a,entityRef:n})=>{const l=Ve();return t.createElement(C,{spacing:1},t.createElement(C,{container:!0,direction:"row",spacing:1,wrap:"nowrap"},t.createElement("div",{className:l.iconWrapper},a),t.createElement(y,{variant:"h6",className:l.headerWrapper,noWrap:!0},e)),t.createElement(C,{item:!0,wrap:"nowrap"},t.createElement(y,{variant:"subtitle2",className:l.entityRefName},T(v(n),{defaultKind:"component"}))),t.createElement(y,{variant:"caption"},r))},Me=fe(e=>{const r=e.palette.type==="dark"?e.palette.common.black:e.palette.grey[300];return{tooltip:{backgroundColor:r,color:e.palette.type==="dark"?e.palette.common.white:e.palette.grey[700]},arrow:{color:r}}})(G),je=({children:e,check:r,icon:a,entityRef:n})=>t.createElement(Me,{arrow:!0,title:t.createElement(Ge,{check:r,icon:a,entityRef:n}),enterDelay:150,placement:"top"},e),Ke=g(e=>({root:{padding:0},iconWrapper:{padding:e.spacing(1.5),display:"flex",alignItems:"center",justifyContent:"center"},link:{"&:hover $iconWrapper, &:active $iconWrapper, &:focus $iconWrapper":{backgroundColor:e.palette.infoBackground}},icon:{width:"17px",height:"17px"},virtualized:{borderBottom:`1px solid ${e.palette.divider}`,borderRight:`1px solid ${e.palette.divider}`}})),J=b(({programId:e,check:r,entityRef:a,result:n,entityRoute:l,isVirtualized:s})=>{const o=Ke();if(typeof a!="string"){const u=t.createElement("div",{className:o.iconWrapper},t.createElement("div",{className:o.icon}));return s?t.createElement("div",{className:`${o.root} ${o.virtualized}`,"aria-hidden":!0},u):t.createElement("td",{className:o.root,"aria-hidden":!0},u)}const i=t.createElement(ye,{className:o.icon,result:n!=null?n:N.NotReported}),m=t.createElement("div",{className:o.iconWrapper},i),p=n&&n===N.NotApplicable?m:t.createElement(I,{className:o.link,to:`${l(v(a))}/soundcheck/${e}/${r.id}`},m);return s?t.createElement("div",{className:`${o.root} ${o.virtualized}`},t.createElement(je,{check:r,icon:i,entityRef:a},p)):t.createElement("td",{className:`${o.root}`},p)}),X=8,De=16,w={programTitle:70,levelTitle:30,check:42,entityRefFooter:100},B={programTitle:350+De*2,checkResult:42},_e=e=>e.reduce((r,a)=>r+a.height,0),Qe=e=>e*B.checkResult+B.programTitle,Ue=e=>e.filter(r=>r!==void 0).map(r=>T(v(r),{defaultKind:"component"})).reduce((r,a)=>r.length>a.length?r:a,""),qe=e=>X*e+X,Y="NoLevel",Je=e=>({name:Y,badge:{options:{level:0,color:""},variant:ve.Medal},entityRef:e,ordinal:0}),Z=g(e=>({checkNameCell:{padding:0,backgroundColor:e.palette.background.paper},checkNameContent:{padding:`0 ${e.spacing(2)}px`,display:"flex",justifyContent:"space-between",alignItems:"center"},checkNameTypography:{overflow:"hidden",textOverflow:"ellipsis"},checkIndicator:{flexBasis:e.spacing(8)},checkNameCellVirtualized:{height:`${w.check}px`,lineHeight:`${w.check}px`,borderBottom:`1px solid ${e.palette.divider}`,borderRight:`1px solid ${e.palette.divider}`}})),Xe=b(({programId:e,programName:r,check:a,entityRefs:n,results:l,entityRoute:s})=>{const o=Z(),i=L(()=>Q(l.filter(({result:p})=>p!==N.NotApplicable),"result"),[l]),m=new Map(l.map(p=>[p.entityRef,p.result]));return t.createElement("tr",{"data-testid":"program-check-row"},t.createElement("th",{scope:"row",className:o.checkNameCell,"aria-label":`${a.name} check for ${r} program`},t.createElement("div",{className:o.checkNameContent},t.createElement(y,{className:o.checkNameTypography,variant:"subtitle2",component:"p"},a.name),t.createElement(q,{className:o.checkIndicator,progress:i}))),n.map((p,u)=>t.createElement(J,{key:u,programId:e,check:a,entityRef:p,result:typeof p=="string"?m.get(p):void 0,entityRoute:s})))}),Ye=({name:e,progress:r})=>{const a=Z();return t.createElement("div",{className:a.checkNameCell,"aria-label":`${e} check`},t.createElement("div",{className:`${a.checkNameContent} ${a.checkNameCellVirtualized}`},t.createElement(y,{variant:"subtitle2",component:"p",className:a.checkNameTypography},e),t.createElement(q,{className:a.checkIndicator,progress:r})))},Ze=g(e=>({virtualized:{borderRight:`1px solid ${e.palette.divider}`,height:`${w.programTitle}px`,display:"flex",justifyContent:"center",alignItems:"center"}})),et=b(({entityRef:e,highestLevels:r})=>{const a=r.find(n=>n.entityRef===e);return t.createElement(t.Fragment,null,a!=null&&a.badge?t.createElement(j,{badge:a.badge}):t.createElement(K,null))}),tt=({highestLevel:e})=>{const r=Ze();if(!(e!=null&&e.badge))return t.createElement("div",{className:r.virtualized},"\xA0");const a=e.name!==Y;return t.createElement("div",{className:r.virtualized},a?t.createElement(j,{badge:e.badge}):t.createElement(K,null))},ee=g(e=>({programNameCell:{padding:0,position:"sticky",backgroundColor:e.palette.background.paper},programNameContent:{padding:e.spacing(2)},programNameTypography:{overflow:"hidden",textOverflow:"ellipsis"},badgeCellContent:{display:"flex",justifyContent:"center",alignItems:"center"},programNameCellVirtualized:{borderRight:`1px solid ${e.palette.divider}`}})),rt=b(({program:e,entityRefs:r,highestLevels:a})=>{const n=ee();return t.createElement("tr",{"data-testid":"program-title-row"},t.createElement("th",{scope:"row",className:n.programNameCell},t.createElement("div",{className:n.programNameContent},t.createElement(y,{className:n.programNameTypography,variant:"h5",component:"p"},e.name))),r.map((l,s)=>typeof l!="string"?t.createElement("td",{key:s,"aria-hidden":!0}):t.createElement("td",{key:s,"data-testid":"program-certification-cell"},t.createElement("div",{className:n.badgeCellContent},t.createElement(et,{entityRef:l,highestLevels:a})))))}),at=b(({name:e})=>{const r=ee();return t.createElement("div",{className:`${r.programNameCell} ${r.programNameCellVirtualized}`},t.createElement("div",{className:r.programNameContent},t.createElement(y,{className:r.programNameTypography,variant:"h5",component:"p"},e)))}),z=g(e=>{const r=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{root:{color:V(e.palette.getContrastText(r),.7),backgroundColor:r},levelContent:{padding:`${e.spacing(.5)}px ${e.spacing(2)}px`,backgroundColor:r},levelTypography:{overflow:"hidden",textOverflow:"ellipsis"},levelHeaderCell:{padding:`${e.spacing(.5)}px ${e.spacing(2)}px`,borderRight:`1px solid ${e.palette.divider}`,height:`${w.levelTitle}px`}}}),nt=b(({level:e,entityRefs:r,programName:a})=>{const n=z();return t.createElement("tr",{className:n.root,"data-testid":"program-level-row"},t.createElement("th",{scope:"row",className:n.root},t.createElement("div",{className:n.levelContent},t.createElement(y,{className:n.levelTypography,variant:"subtitle2",component:"p","aria-label":`${e.name} for ${a} program`},e.name))),r.map((l,s)=>t.createElement("td",{key:s,className:n.root,"aria-hidden":!0})))}),lt=({name:e})=>{const r=z();return t.createElement("div",{className:`${r.levelHeaderCell} ${r.root}`,"aria-label":`${e}`},t.createElement(y,{variant:"subtitle2",component:"p",className:r.levelTypography},e))},ot=()=>{const e=z();return t.createElement("div",{className:`${e.levelHeaderCell} ${e.root}`},"\xA0")},it=({program:e,highestLevels:r,levels:a,entityRefs:n,entityRoute:l})=>t.createElement("tbody",null,t.createElement(rt,{program:e,entityRefs:n,highestLevels:r}),a.map((s,o)=>t.createElement(ie,{key:o},t.createElement(nt,{entityRefs:n,level:s,programName:e.name}),s.checks.map(({check:i,results:m},p)=>t.createElement(Xe,{key:p,check:i,programId:e.id,programName:e.name,entityRefs:n,results:m,entityRoute:l}))))),te=g(e=>({root:{position:"sticky",bottom:"-1px",backgroundColor:e.palette.background.default,boxShadow:`0 -1px ${e.palette.divider}`,"& td$cell, & th$cell":{border:0,padding:e.spacing(1)},"& td$cell":{backgroundColor:e.palette.background.default}},row:{boxShadow:`1px 0 ${e.palette.background.default}, -1px 0 ${e.palette.background.default}`},cell:{verticalAlign:"top"},cellInner:{textOrientation:"mixed",writingMode:"vertical-lr",transform:"rotate(-20deg)",transformOrigin:`100% ${e.spacing(1)}px`,wordBreak:"keep-all",fontWeight:"bold",overflow:"hidden",textOverflow:"ellipsis",maxHeight:"max(15vh, 175px)"}})),st=({entityRefs:e})=>{const r=P(A),a=te();return t.createElement("tfoot",{className:a.root,"data-testid":"results-table-footer"},t.createElement("tr",{className:a.row},t.createElement("td",{className:a.cell}),e.map((n,l)=>typeof n!="string"?t.createElement("th",{key:l,className:a.cell,"aria-hidden":!0}):t.createElement("th",{scope:"col",key:l,className:a.cell},t.createElement("div",{className:a.cellInner},t.createElement(I,{to:r(v(n))},T(v(n),{defaultKind:"component"})))))))},ct=({entityRef:e})=>{const r=P(A),a=te(),n=e?t.createElement(I,{to:r(v(e))},T(v(e),{defaultKind:"component"})):t.createElement(t.Fragment,null);return t.createElement("div",{className:a.cell},t.createElement("div",{className:a.cellInner},n))},pt=g(e=>({table:{backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap","& th, & td":{border:`1px solid ${e.palette.divider}`,borderCollapse:"collapse"},paddingBottom:e.spacing(2)},programTitle:{padding:e.spacing(2)},checkResult:{padding:e.spacing(1.5)},title:{padding:`${e.spacing(1)}px ${e.spacing(2)}px`},header:{backgroundColor:e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100]}})),re=()=>{const e=pt(),r=new Array(25).fill(void 0),a=new Array(5).fill(void 0),n=new Array(3).fill(void 0);return t.createElement("table",{className:e.table},t.createElement("tbody",null,t.createElement("tr",null,t.createElement("td",{className:e.programTitle},t.createElement(O,{width:180,height:40})),r.map((l,s)=>t.createElement("td",{key:s}))),n.map((l,s)=>t.createElement(t.Fragment,{key:s},t.createElement("tr",{className:e.header},t.createElement("td",{className:e.title},t.createElement(O,{width:180})),r.map((o,i)=>t.createElement("td",{key:i}))),a.map((o,i)=>t.createElement("tr",{key:i},t.createElement("td",{className:e.title},t.createElement(O,{width:240})),r.map((m,p)=>t.createElement("td",{key:p,className:e.checkResult},t.createElement(O,{width:18,height:18,variant:"rect"})))))))))},mt=g(e=>({root:{width:"100%"},table:{overflow:"auto",backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap",textAlign:"left","& th, & td":{border:`1px solid ${e.palette.divider}`,borderCollapse:"collapse"},"& th:first-of-type":{position:"sticky",left:0,zIndex:1,maxWidth:"60ch"},"& tfoot":{bottom:0,zIndex:1e3},"& tbody td:first-of-type":{border:`1px solid ${e.palette.divider}`,boxShadow:`1px 0 ${e.palette.background.default}, -1px 0 ${e.palette.background.default}`}}})),dt=b(e=>{const{setError:r,type:a,ownerEntityRef:n}=e,l=mt(),s=P(A),{data:o,isLoading:i,isError:m}=U(n,{type:a});if(k(()=>{r==null||r(m?new Error("Error loading program overview"):void 0)},[m,r]),i)return t.createElement(re,null);if(!o||!n)return null;const{programs:p,entityRefs:u}=o;if(!i&&!p.length)return t.createElement(se,{missing:"data",title:"Missing programs",description:t.createElement(t.Fragment,null,"Looks like the group"," ",T(v(n),{defaultKind:"Group"})," ","doesn't own any ",a," components that have Soundcheck programs set up.",t.createElement("br",null),t.createElement("br",null),"If you're an administrator, you can learn more about configuring and filtering programs in the"," ",t.createElement(I,{to:"https://www.npmjs.com/package/@spotify/backstage-plugin-soundcheck-backend#entity-filter"},"docs"),".")});if(m)return null;const c=u.length>=25?u:[...u,...Array.from({length:25-u.length},()=>{})];return t.createElement("div",{className:l.root},t.createElement("table",{className:l.table,"aria-label":"Check results"},p.map(({program:d,levels:h,highestLevels:f},E)=>t.createElement(it,{key:E,program:d,entityRefs:c,levels:h,highestLevels:f,entityRoute:s})),t.createElement(st,{entityRefs:c})))}),ut=e=>t.createElement(at,{name:e}),gt=e=>({type:"ProgramHeader",render:()=>ut(e)}),ht=e=>e?t.createElement(lt,{name:e}):t.createElement(ot,null),ae=e=>({type:"LevelHeader",render:()=>ht(e)}),ft=(e,r)=>t.createElement(Ye,{name:e,progress:r}),yt=(e,r)=>({type:"CheckTitle",render:()=>ft(e,r)}),vt=(e,r,a,n,l)=>t.createElement(J,{check:r,entityRef:a,entityRoute:l,programId:e,result:n,isVirtualized:!0}),Et=(e,r,a,n,l)=>({type:"CheckResult",render:()=>vt(e,r,a,n,l)}),kt=e=>t.createElement(ct,{entityRef:e}),ne=e=>({type:"EntityHeader",render:()=>kt(e)}),bt=e=>t.createElement(tt,{highestLevel:e}),Ct=e=>({type:"LevelBadge",render:()=>bt(e)}),Nt=e=>r=>{const a=e[r.rowIndex].cells[r.columnIndex];return a?t.createElement("div",{style:r.style},a.render()):t.createElement("div",{style:r.style})},wt=(e,r,a)=>{var n;const l=[];for(const{program:o,levels:i,highestLevels:m}of e){l.push({height:w.programTitle,cells:[gt(o.name),...r.map(p=>{const u=p?m.find(c=>c.entityRef===p)||Je(p):void 0;return Ct(u)})]});for(const p of i){l.push({height:w.levelTitle,cells:[ae(p.name),...r.map(u=>ae(""))]});for(const{check:u,results:c}of p.checks)l.push({height:w.check,cells:[yt(u.name,Q(c.filter(({result:d})=>d!==N.NotApplicable),"result")),...r.map(d=>{var h,f;return Et(o.id,u,d,(f=(h=c.find(E=>E.entityRef===d))==null?void 0:h.result)!=null?f:N.NotApplicable,a)})]})}}const s=Ue(r!=null?r:[]);return l.push({height:qe((n=s.length)!=null?n:1),cells:[ne(""),...r.map(o=>ne(o||""))]}),l},Rt=g(e=>({table:{backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap",textAlign:"left",overflow:"auto"}})),xt=e=>{const{setError:r,type:a,ownerEntityRef:n}=e,l=Rt(),s=P(A),{data:o,isLoading:i,isError:m}=U(n,{type:a});if(k(()=>{r==null||r(m?new Error("Error loading program overview"):void 0)},[m,r]),i)return t.createElement(re,null);if(!o||!n)return null;const{programs:p,entityRefs:u}=o,c=u.length>=25?u:[...u,...Array.from({length:25-u.length},()=>{})],d=wt(p,c,s),h=Nt(d);return t.createElement(C,{"aria-label":`Check results for ${a}`,key:a,item:!0,xs:12},t.createElement($e,{className:l.table,columnCount:c.length+1,columnWidth:f=>f===0?B.programTitle:B.checkResult,rowCount:d.length,rowHeight:f=>d[f].height,height:_e(d),width:Qe(c.length)},h))},$t=({facets:e,ownerEntityRef:r,type:a,setError:n})=>{const l=L(()=>{const s=new Map;return e.types.forEach(({value:o})=>{s.set(o,t.createElement(xt,{key:o,ownerEntityRef:r,type:o,setError:n}))}),s},[e,r,n]);return t.createElement("div",null,l.get(a))},Tt=g(()=>({scrollContainer:{overflow:"auto"}})),Lt=({facets:e,ownerEntityRef:r,hasError:a,type:n,setError:l,useVirtualizedResultsTable:s})=>{var o,i;const m=Tt();return a?t.createElement(Ee,{severity:"error",title:a.message}):e&&((i=(o=e.types)==null?void 0:o.length)!=null?i:0)>0?t.createElement("div",{className:m.scrollContainer},s?t.createElement($t,{facets:e,type:n,setError:l,ownerEntityRef:r,hasError:a}):t.createElement(dt,{ownerEntityRef:r,type:n,setError:l})):t.createElement(ke,{ownerEntityRef:r})},It=g(e=>({tableContainer:{padding:e.spacing(3),backgroundColor:"transparent"}})),Pt=({title:e="Soundcheck"})=>{var r;const[a,n]=Pe(),{group:l,type:s}=a,[o,i]=$(void 0),[m,p]=$(void 0),[u,c]=$(void 0);k(()=>{o!==s&&i(s)},[s,o]);const{data:d,isLoading:h}=Te(l),f=(r=x(we).getOptionalBoolean("soundcheck.virtualizeOverviewPage"))!=null?r:!1,E=m||u,F=R=>{R&&n({...a,group:R})},le=R=>{R&&(i(R),n({...a,type:R}))},oe=It();return t.createElement(ce,{themeId:"website"},t.createElement(de,{backend:"soundcheck",invalidLicenseMessage:"Submitted check results will still be stored, but it will not be possible to view certifications or individual results until a valid license is present."}),t.createElement(pe,{title:e},t.createElement(Oe,{onChange:F,initialValue:l,setError:p})),t.createElement(me,{noPadding:!0,stretch:!0},t.createElement(C,{container:!0,spacing:0},t.createElement(C,{item:!0,xs:12},h?t.createElement(Fe,null):t.createElement(He,{unfilteredFacets:d,type:o,onChange:le})),t.createElement(C,{item:!0,xs:12,className:oe.tableContainer},!h&&t.createElement(Lt,{facets:d,type:o,setError:c,hasError:E,ownerEntityRef:l,useVirtualizedResultsTable:f})))))},St=e=>{const{title:r}=e;return t.createElement(be,null,t.createElement(Pt,{title:r}))};export{St as overviewPage};
|
|
2
|
+
//# sourceMappingURL=index-808077a4.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t from"react";import{S as o,f as i}from"./index-5d64d93c.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-9d77be51.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{j,E as l,k as w,i as x}from"./esm/index-5d64d93c.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{j as EntitySoundcheckCard,l 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
|
+
"version": "0.4.1",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://backstage.spotify.com/",
|
|
7
7
|
"main": "dist/index.esm.js",
|
|
@@ -26,39 +26,40 @@
|
|
|
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.
|
|
32
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
33
|
-
"@backstage/theme": "^0.2.
|
|
29
|
+
"@backstage/catalog-model": "^1.3.0",
|
|
30
|
+
"@backstage/core-components": "^0.13.0",
|
|
31
|
+
"@backstage/core-plugin-api": "^1.5.1",
|
|
32
|
+
"@backstage/plugin-catalog-react": "^1.5.0",
|
|
33
|
+
"@backstage/theme": "^0.2.19",
|
|
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.
|
|
38
|
+
"@spotify/backstage-plugin-core": "^0.5.1",
|
|
39
39
|
"@tanstack/react-query": "^4.6.1",
|
|
40
40
|
"classnames": "^2.3.2",
|
|
41
|
-
"graphql-request": "
|
|
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-use": "^17.2.4"
|
|
45
|
+
"react-use": "^17.2.4",
|
|
46
|
+
"react-window": "^1.8.8"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
49
|
"react": "^16.13.1 || ^17.0.0",
|
|
49
50
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@backstage/cli": "^0.22.
|
|
53
|
-
"@backstage/core-app-api": "^1.
|
|
54
|
-
"@backstage/dev-utils": "^1.0.
|
|
55
|
-
"@backstage/test-utils": "^1.
|
|
56
|
-
"@graphql-codegen/cli": "^
|
|
57
|
-
"@graphql-codegen/typescript": "^
|
|
53
|
+
"@backstage/cli": "^0.22.6",
|
|
54
|
+
"@backstage/core-app-api": "^1.7.0",
|
|
55
|
+
"@backstage/dev-utils": "^1.0.14",
|
|
56
|
+
"@backstage/test-utils": "^1.3.0",
|
|
57
|
+
"@graphql-codegen/cli": "^3.0.0",
|
|
58
|
+
"@graphql-codegen/typescript": "^3.0.0",
|
|
58
59
|
"@graphql-codegen/typescript-graphql-request": "^4.5.5",
|
|
59
|
-
"@graphql-codegen/typescript-operations": "^
|
|
60
|
-
"@spotify/backstage-plugin-core-common": "^0.
|
|
61
|
-
"@spotify/backstage-plugin-soundcheck-common": "^0.
|
|
60
|
+
"@graphql-codegen/typescript-operations": "^3.0.0",
|
|
61
|
+
"@spotify/backstage-plugin-core-common": "^0.5.1",
|
|
62
|
+
"@spotify/backstage-plugin-soundcheck-common": "^0.4.1",
|
|
62
63
|
"@testing-library/jest-dom": "^5.10.1",
|
|
63
64
|
"@testing-library/react": "^12.1.5",
|
|
64
65
|
"@testing-library/react-hooks": "^8.0.1",
|
|
@@ -66,11 +67,15 @@
|
|
|
66
67
|
"@types/jest": "^29.4.0",
|
|
67
68
|
"@types/luxon": "^3.0.1",
|
|
68
69
|
"@types/node": "^16.18.11",
|
|
70
|
+
"@types/react-window": "^1.8.5",
|
|
69
71
|
"cross-fetch": "^3.1.5",
|
|
70
|
-
"msw": "^0.
|
|
72
|
+
"msw": "^1.0.0"
|
|
71
73
|
},
|
|
72
74
|
"files": [
|
|
73
75
|
"dist",
|
|
74
|
-
"!dist/**/*.map"
|
|
75
|
-
|
|
76
|
+
"!dist/**/*.map",
|
|
77
|
+
"config.d.ts"
|
|
78
|
+
],
|
|
79
|
+
"configSchema": "config.d.ts",
|
|
80
|
+
"module": "./dist/index.esm.js"
|
|
76
81
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{stringifyEntityRef as y}from"@backstage/catalog-model";import{useApi as v,useRouteRef as B}from"@backstage/core-plugin-api";import{useQuery as b}from"@tanstack/react-query";import{s as k,a as I}from"./index-6b006938.esm.js";import t from"react";import{makeStyles as d,Tooltip as D,Typography as r,alpha as p,Box as F}from"@material-ui/core";import{useEntity as _}from"@backstage/plugin-catalog-react";import{Link as U}from"react-router-dom";import{useAutoUpdatingRelativeTime as W}from"@spotify/backstage-plugin-core";import G from"@material-ui/icons/Schedule";import{DateTime as S}from"luxon";import H from"classnames";import{C as j,L as N,N as M,F as E,A as O}from"./SoundcheckQueryClientProvider-f6aa058e.esm.js";import{Skeleton as c}from"@material-ui/lab";import{Link as P}from"@backstage/core-components";function Q(e){const a=v(k),n=y(e);return b(["soundcheck/certifications",n],async()=>a.getAllCertifications(n))}function C(e,a){const n=v(k),l=y(e);return b(["soundcheck/certifications",l,a],async()=>n.getCertificationDetails(l,a),{enabled:!!a})}const q=d(e=>({root:{display:"inline-flex",alignItems:"center",gap:e.spacing(1)}})),T=({timestamp:e,description:a})=>{const n=q(),l=S.fromISO(e).toLocaleString(S.DATETIME_FULL),i=W(e),o=a?`${a}: ${i}`:void 0;return t.createElement("div",{className:n.root},t.createElement(D,{title:l},t.createElement(r,{variant:"caption","aria-label":o},i)),t.createElement(G,null))},h=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)}}})),J=({className:e,href:a,children:n})=>a?t.createElement(U,{to:a,className:e},n):t.createElement("div",{className:e},n),K=({result:e,name:a,timestamp:n,selected:l=!1,href:i})=>{const o=h(),g=H(o.root,{selected:l});return t.createElement(J,{href:i,className:g},t.createElement(j,{result:e}),t.createElement(r,{variant:"body2"},a),n?t.createElement(T,{timestamp:n}):null)},L=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:n})=>[`"${n?"badge":"title"} title"`,`"${n?".":"description"} description"`].join(" "),gridTemplateColumns:"auto 1fr"},title:{gridArea:"title",textTransform:"uppercase",fontWeight:"bold",color:p(e.palette.getContrastText(a),.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)}}}),V=e=>{const a=L({badge:e.badge});return t.createElement("div",{className:a.wrapper},e.badge?t.createElement(N,{className:a.badge,badge:e.badge}):null,t.createElement(r,{className:a.title},e.title),e.description?t.createElement(r,{className:a.description},e.description):null)},x=d(e=>({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 X({description:e,documentationUrl:a}){return a?t.createElement(r,{variant:"body2"},e," ",t.createElement(P,{to:a},"Learn more")):t.createElement(r,{variant:"body2"},e)}const A=({name:e,level:a,badge:n,description:l,documentationUrl:i})=>{const o=x();return t.createElement("div",{className:o.root},n?t.createElement(N,{size:"large",badge:n}):t.createElement(M,{size:"large"}),t.createElement("div",null,t.createElement(r,{variant:"caption",className:o.level},a??"No Level"),t.createElement(r,{variant:"h4",className:o.title},e),l&&t.createElement(X,{description:l,documentationUrl:i})))},R=({hideDescription:e=!1})=>{const a=x();return t.createElement(E,null,t.createElement("div",{className:a.root},t.createElement(c,{width:44,height:44}),t.createElement("div",null,t.createElement(r,{variant:"caption",className:a.level},t.createElement(c,{width:100})),t.createElement(r,{variant:"h4",className:a.title},t.createElement(c,{width:300})),!e&&t.createElement(r,{variant:"body2"},t.createElement(c,null)))))},Y=()=>{const e=L({});return t.createElement(E,null,t.createElement("div",{className:e.wrapper},t.createElement(c,{className:e.title}),t.createElement(r,{className:e.description},t.createElement(c,null))))},f=()=>{const e=h();return t.createElement(E,null,t.createElement("div",{className:e.root},t.createElement(c,{width:24,height:24}),t.createElement(r,{variant:"body2"},t.createElement(c,null)),t.createElement(c,{width:100,height:24})))},Z=()=>{const e=$();return t.createElement("div",{className:e.root},t.createElement(R,null),new Array(3).fill(null).map((a,n)=>t.createElement(t.Fragment,{key:`skeleton-level-${n}`},t.createElement(Y,null),t.createElement("ul",{className:e.checks},t.createElement(f,null),t.createElement(f,null),t.createElement(f,null)))))},$=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"}}})),ee=({programId:e,checkId:a})=>{var n,l;const i=$(),{entity:o}=_(),g=B(I),{data:s,isLoading:w,isError:z}=C(o,e);return z?t.createElement("div",{className:i.root},t.createElement(F,{padding:2},t.createElement(O,{severity:"error",title:"Error loading certification"}))):w||!e?t.createElement(Z,null):s?t.createElement("div",{className:i.root},t.createElement(A,{name:s.program.name,level:(n=s.highestLevel)==null?void 0:n.name,badge:(l=s.highestLevel)==null?void 0:l.badge,description:s.program.description,documentationUrl:s.program.documentationUrl}),s?.levels.map(m=>t.createElement(t.Fragment,{key:m.ordinal},t.createElement(V,{key:m.ordinal,badge:m.badge,title:m.name,description:m.description}),t.createElement("ul",{className:i.checks},m.checks.map(u=>t.createElement("li",{key:u.id,className:i.checkItem},t.createElement(K,{...u,selected:u.id===a,href:g({programId:e,checkId:u.id})}))))))):null};export{ee as C,T as R,Q as a,R as b,A as c,C as u};
|
|
2
|
-
//# sourceMappingURL=CertificationSidebar-c4cee874.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import e,{useState as I,useEffect as M}from"react";import{Link as W,useParams as O,Routes as Q,Route as y,Navigate as P}from"react-router-dom";import{makeStyles as d,Typography as h,Box as j,Tab as x,Tabs as T,Paper as H,Divider as U}from"@material-ui/core";import{SpotifyLicenseBanner as V}from"@spotify/backstage-plugin-core";import{useEntity as p}from"@backstage/plugin-catalog-react";import{R as Y}from"./RefetchingIndicator-9e7adc3f.esm.js";import{R as q,u as L,a as k,C as G}from"./CertificationSidebar-c4cee874.esm.js";import{Skeleton as s}from"@material-ui/lab";import{MarkdownContent as B}from"@backstage/core-components";import{stringifyEntityRef as J}from"@backstage/catalog-model";import{useApi as K,useRouteRef as C,useRouteRefParams as X}from"@backstage/core-plugin-api";import{useQuery as Z}from"@tanstack/react-query";import{s as ee,R as c,c as v,a as F}from"./index-6b006938.esm.js";import{A as b,F as A,L as te,N as ne,a as ae,S as re}from"./SoundcheckQueryClientProvider-f6aa058e.esm.js";import ie from"react-use/lib/useMeasure";import D 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,a,n){const r=K(ee),i=J(t);return Z(["soundcheck/check-details",i,a,n],async()=>r.getCheckResultDetails(i,a,n),{enabled:!!a&&!!n})}const se=d({markdownContent:{"& :last-child":{marginBottom:0}}}),ce=({state:t,notes:a})=>{const n=se(),r={[c.Passed]:"success",[c.Failed]:"error",[c.NotReported]:"info",[c.NotApplicable]:"info"}[t],i={[c.Passed]:"Check passed",[c.Failed]:"Check did not pass",[c.NotReported]:"Check not reported",[c.NotApplicable]:"Check not applicable"}[t];return e.createElement(b,{severity:r,title:i},a?e.createElement(B,{className:n.markdownContent,content:a}):null)},me=()=>{const t=$();return e.createElement(A,null,e.createElement("div",{className:t.root,"data-testid":"check-details-view"},e.createElement("div",{className:t.topBar},e.createElement(h,{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(h,{variant:"h3"},e.createElement(s,null)),e.createElement(s,null),e.createElement(s,null),e.createElement(s,null))))},$=d(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)}})),ue=({programId:t,checkId:a})=>{const n=$(),{entity:r}=p(),{data:i,isLoading:l,isError:o}=oe(r,t,a);if(o)return e.createElement(j,{padding:2},e.createElement(b,{severity:"error",title:"Error loading check details"}));if(l||!t||!a)return e.createElement(me,null);if(!i)return null;const{name:f,description:u,result:g,timestamp:m,notes:E}=i;return e.createElement("div",{className:n.root,"data-testid":"check-details-view"},e.createElement("div",{className:n.topBar},e.createElement(h,{variant:"h2",className:n.title},f),m?e.createElement(q,{timestamp:m,description:"Last updated"}):null),e.createElement(ce,{state:g,notes:E}),e.createElement("div",{className:n.description,"data-testid":"soundcheck-check-details-description"},e.createElement(h,{variant:"h3",className:n.subtitle},"Description"),e.createElement(B,{content:u})))},de=d(()=>({root:{position:"absolute",width:"100%",height:"100%"}})),pe=({programId:t})=>{var a,n;const r=de(),{entity:i}=p(),{data:l,isLoading:o}=L(i,t),[f,{width:u,height:g}]=ie(),m=o?void 0:(n=(a=l?.highestLevel)==null?void 0:a.ordinal)!=null?n:-1,E=D(m),S=D(t),[z,N]=I(!1);return M(()=>{typeof E<"u"&&typeof m<"u"&&t===S&&m>E&&N(!0)},[m,E,t,S]),z?e.createElement("div",{ref:f,className:r.root},e.createElement(le,{width:u,height:g,numberOfPieces:1e3,gravity:1,initialVelocityY:20,recycle:!1,onConfettiComplete:()=>N(!1)})):null},_=d(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)}})),fe=({id:t,name:a,badge:n,href:r,selected:i=!1})=>{const l=_();return e.createElement(x,{className:l.root,classes:{wrapper:l.wrapper},value:t,label:e.createElement(e.Fragment,null,n?e.createElement(te,{badge:n,className:l.badge}):e.createElement(ne,{className:l.badge}),a),component:W,to:r,selected:i})},R=()=>{const t=_();return e.createElement(x,{className:t.root,classes:{wrapper:t.wrapper},label:e.createElement(s,{width:180})})},Ee=()=>e.createElement(A,null,e.createElement(T,{value:!1,indicatorColor:"primary"},e.createElement(R,null),e.createElement(R,null),e.createElement(R,null)));function he(t=[],a){const n=t.findIndex(r=>r.program.id===a);return n<0?!1:n}const ve=({programId:t})=>{const{entity:a}=p(),{isLoading:n,data:r}=k(a),i=C(v);if(n||!t)return e.createElement(Ee,null);const l=he(r,t);return e.createElement(T,{value:l,indicatorColor:"primary","aria-label":"Certifications",variant:"scrollable"},r&&r.map(({program:{id:o,name:f},highestLevel:u})=>e.createElement(fe,{key:o,id:o,name:f,badge:u?.badge,selected:o===t,href:i({programId:o})})))},ge=d({paper:{overflow:"hidden",position:"relative"},view:{display:"grid",gridTemplateColumns:"1fr 2fr"}}),ye=()=>{const{programId:t,checkId:a}=O(),n=ge(),{entity:r}=p(),{isError:i,isFetched:l,data:o}=k(r);return i?e.createElement(b,{severity:"error",title:"Error loading certifications"}):l&&!o?.length?e.createElement(ae,null):e.createElement(H,{className:n.paper},e.createElement(Y,null),e.createElement(ve,{programId:t}),e.createElement(U,null),e.createElement("div",{"data-testid":"soundcheck-certification-view",className:n.view},e.createElement(G,{programId:t,checkId:a}),e.createElement(ue,{programId:t,checkId:a}),e.createElement(pe,{programId:t})))},ke=d(t=>({root:{"&:not(:first-child)":{marginTop:t.spacing(2)}}})),w=()=>{const t=ke();return e.createElement(e.Fragment,null,e.createElement(V,{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(ye,null)))},Ce=()=>{var t;const{entity:a}=p(),n=C(v),{data:r}=k(a),i=(t=r?.[0])==null?void 0:t.program.id;return i?e.createElement(P,{to:n({programId:i}),replace:!0}):null},be=()=>{var t,a;const{entity:n}=p(),{programId:r}=X(v),i=C(F),{data:l}=L(n,r),o=(a=(t=l?.levels[0])==null?void 0:t.checks[0])==null?void 0:a.id;return o?e.createElement(P,{to:i({programId:r,checkId:o}),replace:!0}):null},Re=()=>e.createElement(Q,null,e.createElement(y,{path:"/",element:e.createElement(e.Fragment,null,e.createElement(w,null),e.createElement(Ce,null))}),e.createElement(y,{path:v.path,element:e.createElement(e.Fragment,null,e.createElement(w,null),e.createElement(be,null))}),e.createElement(y,{path:F.path,element:e.createElement(w,null)})),we=()=>e.createElement(re,null,e.createElement(Re,null));export{we as EntitySoundcheckContent};
|
|
2
|
-
//# sourceMappingURL=EntitySoundcheckContent-a2d35ddd.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import t,{useState as n}from"react";import{makeStyles as s,LinearProgress as a}from"@material-ui/core";import m from"react-use/lib/useDebounce";import"@backstage/catalog-model";import"@backstage/core-plugin-api";import{useIsFetching as c}from"@tanstack/react-query";import"./index-6b006938.esm.js";import"@backstage/plugin-catalog-react";import"react-router-dom";import{F as d}from"./SoundcheckQueryClientProvider-f6aa058e.esm.js";const l=s(e=>({indicator:{position:"absolute",width:"100%",zIndex:e.zIndex.speedDial}})),p=()=>{const e=c(),i=l(),[r,o]=n(!!e);return m(()=>{o(!!e)},250,[e]),r?t.createElement(d,null,t.createElement("div",{className:i.indicator},t.createElement(a,{variant:"indeterminate","data-testid":"refetching-indicator"}))):null};export{p as R};
|
|
2
|
-
//# sourceMappingURL=RefetchingIndicator-9e7adc3f.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 l,Typography as y}from"@material-ui/core";import b from"@material-ui/icons/Check";import g from"@material-ui/icons/Close";import E from"@material-ui/icons/RemoveCircleOutline";import C from"@material-ui/icons/HelpOutline";import{R as n}from"./index-6b006938.esm.js";import i from"classnames";import{Alert as S}from"@material-ui/lab";import{EmptyState as m}from"@backstage/core-components";import{humanizeEntityRef as N}from"@backstage/plugin-catalog-react";import{parseEntityRef as v}from"@backstage/catalog-model";import{QueryClient as x,QueryClientProvider as I}from"@tanstack/react-query";import{memoize as k}from"lodash";import{useApi as A,errorApiRef as F}from"@backstage/core-plugin-api";const R=({children:e})=>{const[t,o]=u(!1);return f(()=>{const a=setTimeout(()=>{o(!0)},250);return()=>clearTimeout(a)},[]),r.createElement(h,{in:t,timeout:250},e)},T=e=>({[n.Passed]:"Check passed",[n.NotReported]:"Check not reported",[n.Failed]:"Check failed",[n.NotApplicable]:"Check not applicable"})[e],w=s(e=>({root:{color:e.palette.success.main}}))(b),$=s(e=>({root:{color:e.palette.error.main}}))(g),B=s(e=>({root:{color:e.palette.info.main}}))(C),P=s(e=>({root:{color:e.palette.text.disabled}}))(E),L=({result:e,className:t})=>{const o={className:t,"aria-label":T(e),"aria-hidden":!1};return e===n.Passed?r.createElement(w,{...o}):e===n.NotReported?r.createElement(B,{...o}):e===n.Failed?r.createElement($,{...o}):e===n.NotApplicable?r.createElement(P,{...o}):null},p=24,O=11,c=e=>e==="small"?1:2,D=l({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})=>`${O*c(e)}px`}}),d=({className:e,label:t,size:o="small"})=>{const a=D({size:o});return r.createElement("span",{className:i(e,a.root),role:"img","aria-label":`${t} badge`},t)},M=l(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(",")}}})),W=({className:e,badge:t,size:o="small"})=>{const a=M({color:t.options.color,size:o});return r.createElement(d,{className:i(e,a.root),size:o,label:`L${t.options.level}`})},q=l({root:{borderColor:"currentColor",borderStyle:"dashed"}}),G=({className:e,size:t="small"})=>{const o=q();return r.createElement(d,{className:i(e,o.root),size:t,label:"NL"})},Q=l(e=>({root:{padding:e.spacing(3)},icon:{display:"none"},message:{padding:0},type:{fontWeight:700}})),_=e=>{const{type:t,...o}=Q();return r.createElement(S,{severity:e.severity,elevation:1,classes:o},r.createElement(y,{variant:"subtitle1",classes:{root:t}},e.title),e.children)},j=({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."})),z=({ownerEntityRef:e})=>e?r.createElement(m,{missing:"data",title:"Missing entities",description:r.createElement(r.Fragment,null,"Looks like the group"," ",N(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,Z=k(e=>new x({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)}}})),H=e=>{const t=A(F),o=Z(t);return r.createElement(I,{client:o},e.children)};export{_ as A,L as C,R as F,W as L,G as N,H as S,j as a,z as b};
|
|
2
|
-
//# sourceMappingURL=SoundcheckQueryClientProvider-f6aa058e.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import e,{Fragment as f}from"react";import{A as g,a as E,S as y}from"./SoundcheckQueryClientProvider-f6aa058e.esm.js";import v from"@material-ui/core/styles/makeStyles";import{Divider as k}from"@material-ui/core";import{useRouteRef as C}from"@backstage/core-plugin-api";import{Link as S,InfoCard as b}from"@backstage/core-components";import{useEntity as h}from"@backstage/plugin-catalog-react";import{SpotifyLicenseBanner as w}from"@spotify/backstage-plugin-core";import{c as R}from"./index-6b006938.esm.js";import{b as m,a as L,c as D}from"./CertificationSidebar-c4cee874.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 I=()=>e.createElement(e.Fragment,null,e.createElement(m,{hideDescription:!0}),e.createElement(m,{hideDescription:!0})),s=v(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=s();return e.createElement(b,{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))},N=()=>{const{entity:t}=h(),i=s(),{data:n,isError:c,isLoading:p}=L(t),u=C(R);return c?e.createElement(a,null,e.createElement(g,{severity:"error",title:"Error loading certifications"})):p||!n?e.createElement(a,null,e.createElement(I,null)):n.length===0?e.createElement(a,null,e.createElement(E,{className:i.emptyState})):e.createElement(a,null,n.map((r,d)=>{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(S,{to:u({programId:r.program.id})},"View Details")),d<n.length-1?e.createElement(k,null):null)}))},P=()=>e.createElement(y,null,e.createElement(N,null));export{P as EntitySoundcheckCard};
|
|
2
|
-
//# sourceMappingURL=index-5f7bf7f6.esm.js.map
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import{createApiRef as O,createRouteRef as y,createSubRouteRef as R,createPlugin as D,createApiFactory as E,discoveryApiRef as S,fetchApiRef as $,createRoutableExtension as k,createComponentExtension as A}from"@backstage/core-plugin-api";import{GraphQLClient as _}from"graphql-request";import o from"graphql-tag";var w=(e=>(e.Failed="FAILED",e.NotApplicable="NOT_APPLICABLE",e.NotReported="NOT_REPORTED",e.Passed="PASSED",e))(w||{});const P=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
|
-
`,L=o`
|
|
24
|
-
fragment CheckResultSummary on CheckResult {
|
|
25
|
-
id
|
|
26
|
-
name
|
|
27
|
-
result
|
|
28
|
-
timestamp
|
|
29
|
-
}
|
|
30
|
-
`,q=o`
|
|
31
|
-
fragment CheckResultDetails on CheckResult {
|
|
32
|
-
id
|
|
33
|
-
name
|
|
34
|
-
description
|
|
35
|
-
result
|
|
36
|
-
timestamp
|
|
37
|
-
notes
|
|
38
|
-
}
|
|
39
|
-
`,I=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
|
-
`,M=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
|
-
`,G=o`
|
|
71
|
-
query getAllCertifications($entityRef: String!) {
|
|
72
|
-
certifications(entityRef: $entityRef, includeFilteredChecks: false) {
|
|
73
|
-
...CertificationSummary
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
${P}`,B=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
|
-
${L}`,T=o`
|
|
123
|
-
query getCheckResultDetails($entityRef: String!, $programId: String!, $checkId: String!) {
|
|
124
|
-
checkResult(entityRef: $entityRef, programId: $programId, checkId: $checkId) {
|
|
125
|
-
...CheckResultDetails
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
${q}`,N=o`
|
|
129
|
-
query getFacetsForOwner($ownerEntityRef: String!) {
|
|
130
|
-
facetsForOwner(ownerEntityRef: $ownerEntityRef) {
|
|
131
|
-
types {
|
|
132
|
-
value
|
|
133
|
-
count
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
`,x=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
|
-
${M}
|
|
160
|
-
${I}`,V=(e,r,t)=>e();function H(e,r=V){return{getAllCertifications(t,n){return r(i=>e.request(G,t,{...n,...i}),"getAllCertifications","query")},getCertificationDetails(t,n){return r(i=>e.request(B,t,{...n,...i}),"getCertificationDetails","query")},getCheckResultDetails(t,n){return r(i=>e.request(T,t,{...n,...i}),"getCheckResultDetails","query")},getFacetsForOwner(t,n){return r(i=>e.request(N,t,{...n,...i}),"getFacetsForOwner","query")},getProgramOverviewForOwner(t,n){return r(i=>e.request(x,t,{...n,...i}),"getProgramOverviewForOwner","query")}}}var C=(e,r,t)=>{if(!r.has(e))throw TypeError("Cannot "+t)},a=(e,r,t)=>(C(e,r,"read from private field"),t?t.call(e):r.get(e)),l=(e,r,t)=>{if(r.has(e))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(e):r.set(e,t)},m=(e,r,t,n)=>(C(e,r,"write to private field"),n?n.call(e,t):r.set(e,t),t),d,h,c,p,s;const F=O({id:"plugin.soundcheck"}),Q=e=>"response"in e&&"errors"in e.response,W=e=>"response"in e&&"message"in e.response;class U{constructor(r){l(this,d,void 0),l(this,h,void 0),l(this,c,void 0),l(this,p,n=>{var i,u,v;return Q(n)?(v=(u=(i=n.response)==null?void 0:i.errors)==null?void 0:u[0].message)!=null?v:`${n}`:W(n)?n.response.message:`${n}`}),l(this,s,async n=>{try{return await n()}catch(i){throw new Error(`Error from Soundcheck backend: ${a(this,p).call(this,i)}`)}}),m(this,d,r.fetchApi),m(this,h,r.discoveryApi);const t=new _("/graphql",{fetch:async(n,i)=>{const u=`${await a(this,h).getBaseUrl("soundcheck")}${n}`;return a(this,d).fetch(u,i)}});m(this,c,H(t))}async getAllCertifications(r){return a(this,s).call(this,async()=>{const{certifications:t}=await a(this,c).getAllCertifications({entityRef:r});return t})}async getCertificationDetails(r,t){return a(this,s).call(this,async()=>{const{programCertification:n}=await a(this,c).getCertificationDetails({entityRef:r,programId:t});return n})}async getCheckResultDetails(r,t,n){return a(this,s).call(this,async()=>{const{checkResult:i}=await a(this,c).getCheckResultDetails({entityRef:r,programId:t,checkId:n});return i})}async getFacetsForOwner(r){return a(this,s).call(this,async()=>{const{facetsForOwner:t}=await a(this,c).getFacetsForOwner({ownerEntityRef:r});return t})}async getProgramOverviewForOwner(r,t){return a(this,s).call(this,async()=>{const{programOverviewForOwner:n}=await a(this,c).getProgramOverviewForOwner({ownerEntityRef:r,facet:t});return n})}}d=new WeakMap,h=new WeakMap,c=new WeakMap,p=new WeakMap,s=new WeakMap;const g=y({id:"soundcheck-entity"}),z=R({id:"soundcheck-entity-certification-program-redirect",parent:g,path:"/:programId"}),b=R({id:"soundcheck-entity-certification",parent:g,path:"/:programId/:checkId"}),J=y({id:"soundcheck-overview"}),f=D({id:"soundcheck",apis:[E({api:F,deps:{discoveryApi:S,fetchApi:$},factory:e=>new U(e)})],routes:{entityContent:g}}),K=f.provide(k({name:"EntitySoundcheckContent",component:()=>import("./EntitySoundcheckContent-a2d35ddd.esm.js").then(e=>e.EntitySoundcheckContent),mountPoint:g})),X=f.provide(A({name:"EntitySoundcheckCard",component:{lazy:()=>import("./index-5f7bf7f6.esm.js").then(e=>e.EntitySoundcheckCard)}})),Y=f.provide(k({name:"SoundcheckOverviewPage",component:()=>import("./index-72edc5c7.esm.js").then(e=>e.OverviewPage),mountPoint:J}));export{K as E,w as R,Y as S,b as a,f as b,z as c,X as d,F as s};
|
|
161
|
-
//# sourceMappingURL=index-6b006938.esm.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import t,{useState as C,useEffect as v,useMemo as N,useCallback as T,memo as b,Fragment as j}from"react";import{HeaderTabs as A,Link as I,EmptyState as M,Page as z,Header as H,Content as D}from"@backstage/core-components";import{SpotifyLicenseBanner as K}from"@spotify/backstage-plugin-core";import{makeStyles as g,alpha as O,TextField as Q,CircularProgress as V,Tooltip as U,LinearProgress as q,Typography as P,Grid as R}from"@material-ui/core";import{C as J,L as X,S as Y,b as Z,A as ee}from"./SoundcheckQueryClientProvider-f6aa058e.esm.js";import te from"@material-ui/lab/Autocomplete";import{stringifyEntityRef as L,parseEntityRef as x}from"@backstage/catalog-model";import{useApi as h,identityApiRef as re,useRouteRef as _}from"@backstage/core-plugin-api";import{useQuery as $}from"@tanstack/react-query";import{s as G,R as k}from"./index-6b006938.esm.js";import{catalogApiRef as F,entityRouteRef as B,humanizeEntityRef as W}from"@backstage/plugin-catalog-react";import{useSearchParams as ae}from"react-router-dom";import{Skeleton as E}from"@material-ui/lab";import{R as ne}from"./RefetchingIndicator-9e7adc3f.esm.js";import{countBy as oe}from"lodash";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 le(e){const a=h(G);return $(["soundcheck/facets-for-owner",e],async()=>a.getFacetsForOwner(e),{enabled:!!e})}function se(e,a){const n=h(G);return $(["soundcheck/program-overview-for-owner",e,a],async()=>n.getProgramOverviewForOwner(e,a),{enabled:!!e&&!!a?.type})}function ie(){const e=h(re),a=h(F);return $(["soundcheck/user-groups-claims"],async()=>{const{ownershipEntityRefs:n}=await e.getBackstageIdentity();return(await a.getEntitiesByRefs({entityRefs:n})).items.filter(o=>o?.kind==="Group").map(o=>{var c,i,d,s;return{name:(s=(d=(i=(c=o.spec)==null?void 0:c.profile)==null?void 0:i.displayName)!=null?d:o.metadata.title)!=null?s:o.metadata.name,ref:L(o)}})})}function ce(){const e=h(F);return $(["soundcheck/all-groups"],async()=>{const{items:a}=await e.getEntities({filter:{kind:"Group"}});return a.filter(n=>n?.kind==="Group").map(n=>{var r,l,o,c;return{name:(c=(o=(l=(r=n.spec)==null?void 0:r.profile)==null?void 0:l.displayName)!=null?o:n.metadata.title)!=null?c:n.metadata.name,ref:L(n)}})})}const de=()=>{const[e,a]=ae(),n=Object.fromEntries(e.entries()),[r,l]=C(n);return v(()=>{a(r,{replace:!0})},[r,a]),[r,l]},pe=()=>{const{data:e,isLoading:a,isError:n}=ie(),{data:r,isLoading:l,isError:o}=ce();return{options:N(()=>{const i=[];return e&&i.push(...e.map(({name:d,ref:s})=>({name:d,ref:s,key:"My Groups"}))),r&&i.push(...r.map(({name:d,ref:s})=>({name:d,ref:s,key:"All Groups"}))),i},[e,r]),isLoading:a||l,isError:n||o}},ue=g(e=>({root:{width:"100%",minWidth:250},textField:{"& $notchedOutline":{borderColor:O(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:{}})),me=e=>{const{onChange:a,initialValue:n,setError:r}=e,{options:l,isLoading:o,isError:c}=pe(),i=ue(),[d,s]=C(null);v(()=>{if(!o&&l?.length&&!d){const p=n?l.find(m=>m.ref===n):l[0];p&&(s(p),a?.(p.ref))}},[o,l,d,a,n]);const u=T((p,m)=>{s(m),a?.(m?.ref)},[a,s]);return v(()=>{r?.(c?new Error("Error loading groups"):void 0)},[c,r]),c?null:t.createElement(te,{"aria-label":"Current group",className:i.root,classes:{clearIndicator:i.clearIndicator,popupIndicator:i.popupIndicator},disableClearable:!0,options:l??[],loading:o,groupBy:p=>p.key,value:d,freeSolo:!1,onChange:u,getOptionLabel:p=>p.name,renderInput:p=>t.createElement(Q,{...p,variant:"outlined",placeholder:o?"Loading":"Select a group",className:i.textField,InputProps:{...p.InputProps,className:i.input,classes:{notchedOutline:i.notchedOutline},endAdornment:t.createElement(t.Fragment,null,o?t.createElement(V,{color:"inherit",size:20}):null,p.InputProps.endAdornment)}})})},ge=()=>{const e=[{label:t.createElement(E,{width:180})},{label:t.createElement(E,{width:180})},{label:t.createElement(E,{width:180})},{label:t.createElement(E,{width:180})}];return t.createElement(A,{tabs:e})},fe=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)}})),Ee=({facets:e,onChange:a,type:n})=>{var r,l;const o=fe(),c=T(s=>{var u;a((u=e?.types[s].value)!=null?u:"")},[e?.types,a]);v(()=>{var s;const u=e?.types&&e.types.length>=0,p=!n&&u,m=n&&u&&!e.types.find(({value:y})=>y===n);(p||m)&&a((s=e.types[0])==null?void 0:s.value)},[n,e?.types,a]);const i=(r=e?.types.map(({value:s,count:u})=>({key:s,label:`${s} (${u>50?"50+":u})`,id:s,tabProps:{className:o.tab}})))!=null?r:[];if(!i.length)return null;const d=(l=e?.types.findIndex(s=>s.value===n))!=null?l:-1;return t.createElement(t.Fragment,null,t.createElement(ne,null),t.createElement(A,{onChange:c,tabs:i,selectedIndex:d>-1?d:void 0}))},be=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"}})),ye=e=>{var a,n;const r=be(e),l=N(()=>Object.entries(e.progress).reduce((c,[,i])=>c+i,0),[e.progress]);if(l===0)return null;const o=(a=e.progress[k.Passed])!=null?a:0;return t.createElement(U,{arrow:!0,title:`Check passing for ${o} of ${l} ${l===1?"entity":"entities"}`,enterDelay:0,placement:"top"},t.createElement(q,{variant:"determinate",value:((n=e.progress[k.Passed])!=null?n:0)/l*100,classes:{root:r.root,bar:r.bar}}))},ve=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)}})),he=b(({programId:e,checkId:a,entityRef:n,result:r,entityRoute:l})=>{const o=ve();if(typeof n!="string")return t.createElement("td",{className:`${o.root}`,"aria-hidden":!0},t.createElement("div",{className:o.iconWrapper},t.createElement("div",{className:o.empty})));const c=t.createElement("div",{className:o.iconWrapper},t.createElement(J,{className:o.icon,result:r??k.NotReported})),i=r&&r===k.NotApplicable?c:t.createElement(I,{className:o.link,to:`${l(x(n))}/soundcheck/${e}/${a}`},c);return t.createElement("td",{className:o.root},i)}),ke=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)}})),we=b(({programId:e,programName:a,check:n,entityRefs:r,results:l,entityRoute:o})=>{const c=ke(),i=N(()=>oe(l.filter(({result:s})=>s!==k.NotApplicable),"result"),[l]),d=new Map(l.map(s=>[s.entityRef,s.result]));return t.createElement("tr",{"data-testid":"program-check-row"},t.createElement("th",{scope:"row",className:c.checkNameCell,"aria-label":`${n.name} check for ${a} program`},t.createElement("div",{className:c.checkNameContent},t.createElement(P,{className:c.checkNameTypography,variant:"subtitle2",component:"p"},n.name),t.createElement(ye,{className:c.checkIndicator,progress:i}))),r.map((s,u)=>t.createElement(he,{key:u,programId:e,checkId:n.id,entityRef:s,result:typeof s=="string"?d.get(s):void 0,entityRoute:o})))}),Ce=b(({entityRef:e,highestLevels:a})=>{const n=a.find(r=>r.entityRef===e);return n?.badge?t.createElement(X,{badge:n.badge,size:"small"}):null}),Ne=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"}})),xe=b(({program:e,entityRefs:a,highestLevels:n})=>{const r=Ne();return t.createElement("tr",{"data-testid":"program-title-row"},t.createElement("th",{scope:"row",className:r.programNameCell},t.createElement("div",{className:r.programNameContent},t.createElement(P,{className:r.programNameTypography,variant:"h5",component:"p"},e.name))),a.map((l,o)=>typeof l!="string"?t.createElement("td",{key:o,"aria-hidden":!0}):t.createElement("td",{key:o,"data-testid":"program-certification-cell"},t.createElement("div",{className:r.badgeCellContent},t.createElement(Ce,{entityRef:l,highestLevels:n})))))}),$e=g(e=>{const a=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{root:{color:O(e.palette.getContrastText(a),.7),backgroundColor:a},levelContent:{padding:`${e.spacing(.5)}px ${e.spacing(2)}px`,backgroundColor:a},levelTypography:{overflow:"hidden",textOverflow:"ellipsis"}}}),Se=b(({level:e,entityRefs:a,programName:n})=>{const r=$e();return t.createElement("tr",{className:r.root,"data-testid":"program-level-row"},t.createElement("th",{scope:"row",className:r.root},t.createElement("div",{className:r.levelContent},t.createElement(P,{className:r.levelTypography,variant:"subtitle2",component:"p","aria-label":`${e.name} for ${n} program`},e.name))),a.map((l,o)=>t.createElement("td",{key:o,className:r.root,"aria-hidden":!0})))}),Ie=({program:e,highestLevels:a,levels:n,entityRefs:r,entityRoute:l})=>t.createElement("tbody",null,t.createElement(xe,{program:e,entityRefs:r,highestLevels:a}),n.map((o,c)=>t.createElement(j,{key:c},t.createElement(Se,{entityRefs:r,level:o,programName:e.name}),o.checks.map(({check:i,results:d},s)=>t.createElement(we,{key:s,check:i,programId:e.id,programName:e.name,entityRefs:r,results:d,entityRoute:l}))))),Pe=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"}})),Re=({entityRefs:e})=>{const a=_(B),n=Pe();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((r,l)=>typeof r!="string"?t.createElement("th",{key:l,className:n.cell,"aria-hidden":!0}):t.createElement("th",{scope:"col",key:l,className:n.cell},t.createElement("div",{className:n.cellInner},t.createElement(I,{to:a(x(r))},W(x(r),{defaultKind:"component"})))))))},Te=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]}})),Ae=()=>{const e=Te(),a=new Array(25).fill(void 0),n=new Array(5).fill(void 0),r=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(E,{width:180,height:40})),a.map((l,o)=>t.createElement("td",{key:o}))),r.map((l,o)=>t.createElement(t.Fragment,{key:o},t.createElement("tr",{className:e.header},t.createElement("td",{className:e.title},t.createElement(E,{width:180})),a.map((c,i)=>t.createElement("td",{key:i}))),n.map((c,i)=>t.createElement("tr",{key:i},t.createElement("td",{className:e.title},t.createElement(E,{width:240})),a.map((d,s)=>t.createElement("td",{key:s,className:e.checkResult},t.createElement(E,{width:18,height:18,variant:"rect"})))))))))},Oe=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}`}}})),Le=b(e=>{const{setError:a,type:n,ownerEntityRef:r}=e,l=Oe(),o=_(B),{data:c,isLoading:i,isError:d}=se(r,{type:n});if(v(()=>{a?.(d?new Error("Error loading program overview"):void 0)},[d,a]),i)return t.createElement(Ae,null);if(!c||!r)return null;const{programs:s,entityRefs:u}=c;if(!i&&!s.length)return t.createElement(M,{missing:"data",title:"Missing programs",description:t.createElement(t.Fragment,null,"Looks like the group"," ",W(x(r),{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(I,{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:l.root},t.createElement("table",{className:l.table,"aria-label":"Check results"},s.map(({program:m,levels:y,highestLevels:w},S)=>t.createElement(Ie,{key:S,program:m,entityRefs:p,levels:y,highestLevels:w,entityRoute:o})),t.createElement(Re,{entityRefs:p})))}),_e=g(e=>({tableContainer:{padding:e.spacing(3),backgroundColor:"transparent"},scrollContainer:{overflow:"scroll",height:`calc(100vh - 86px - 68px - ${e.spacing(3)*2}px)`}})),Ge=()=>{var e;const[a,n]=de(),{group:r,type:l}=a,[o,c]=C(void 0),[i,d]=C(void 0),{data:s,isLoading:u}=le(r),p=o||i,m=f=>{f&&n({...a,group:f})},y=f=>{f&&n({...a,type:f})},w=_e(),S=N(()=>{var f;return((f=s?.types)==null?void 0:f.length)<1?t.createElement(Z,{ownerEntityRef:r}):p?t.createElement(ee,{severity:"error",title:p.message}):t.createElement(Le,{ownerEntityRef:r,type:l,setError:d})},[(e=s?.types)==null?void 0:e.length,p,r,l]);return t.createElement(z,{themeId:"website"},t.createElement(K,{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(H,{title:"Soundcheck"},t.createElement(me,{onChange:m,initialValue:r,setError:c})),t.createElement(D,{noPadding:!0,stretch:!0},t.createElement(R,{container:!0,spacing:0},t.createElement(R,{item:!0,xs:12},u?t.createElement(ge,null):t.createElement(Ee,{facets:s,type:l,onChange:y})),t.createElement(R,{item:!0,xs:12,className:w.tableContainer},t.createElement("div",{className:w.scrollContainer},S)))))},Fe=()=>t.createElement(Y,null,t.createElement(Ge,null));export{Fe as OverviewPage};
|
|
2
|
-
//# sourceMappingURL=index-72edc5c7.esm.js.map
|