@spotify/backstage-plugin-soundcheck 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/README.md +41 -1
- package/config.d.ts +15 -1
- package/dist/esm/EntitySoundcheckContent-296037fb.esm.js +2 -0
- package/dist/esm/OverviewPageContent-799c2286.esm.js +2 -0
- package/dist/esm/{RefetchingIndicator-fd4435c2.esm.js → RefetchingIndicator-40f27138.esm.js} +2 -2
- package/dist/esm/chartUtils-080232d7.esm.js +2 -0
- package/dist/esm/index-6236514d.esm.js +2 -0
- package/dist/esm/index-7588122c.esm.js +2 -0
- package/dist/esm/index-dbd15076.esm.js +488 -0
- package/dist/esm/{index-df582cac.esm.js → index-fdc09bba.esm.js} +2 -2
- package/dist/index.esm.js +1 -1
- package/package.json +14 -14
- package/dist/esm/EntitySoundcheckContent-fddf6ba7.esm.js +0 -2
- package/dist/esm/OverviewPageContent-8f5b5b64.esm.js +0 -2
- package/dist/esm/index-277bccda.esm.js +0 -2
- package/dist/esm/index-76a92dde.esm.js +0 -2
- package/dist/esm/index-88bfe2d5.esm.js +0 -456
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# @spotify/backstage-plugin-soundcheck
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Soundcheck no longer allows unrecognized keys in configurations. This should make it easier to identify misconfigurations but may cause validation errors with existing misconfigured instances.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Upgraded Backstage to v1.22.0
|
|
12
|
+
- Updated dependency `@types/node` to `^20.0.0`.
|
|
13
|
+
- - Fixed issue where filters were editable when viewing a Check or Track in read-only mode
|
|
14
|
+
- Fixed issue that prevents users from viewing Checks and Tracks created via configuration file.
|
|
15
|
+
- Entity owner filters in no code ui will now allow all groups to be selectable, not just entity owners. This is useful in combination with the nested owner filtering changes introducted in a previous patch.
|
|
16
|
+
- Tech Health Page now includes a filter for Entity Systems.
|
|
17
|
+
- Added two additional string operators `startsWith` and `endsWith`. The `startsWith` operator tests if a string starts
|
|
18
|
+
with a given string. The `endsWith` operator tests if a string ends with a given string.
|
|
19
|
+
- Added a defaultSelectedGroupType configuration option to pre-select a group which spec.type equals
|
|
20
|
+
to the configured type in the group selector on Soundcheck overview page.
|
|
21
|
+
|
|
22
|
+
To enable this option, add the configuration to your app-config.yaml:
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
soundcheck:
|
|
26
|
+
overview:
|
|
27
|
+
defaultSelectedGroupType: team
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- Fixes autocomplete for facts in the Check form so that options are now properly filtered.
|
|
31
|
+
- Added in an indication to users when their search filters do not match any entries in the check or tracks libraries.
|
|
32
|
+
- Added clickable steps for the Campaign edit form.
|
|
33
|
+
- The Soundcheck overview page now persists and restores the users last selected group.
|
|
34
|
+
- Added a flag to the Soundcheck configuration to allow users to disable the "Tech Health" section of the application.
|
|
35
|
+
This flag is set to true by default.
|
|
36
|
+
|
|
37
|
+
Example:
|
|
38
|
+
|
|
39
|
+
```YML
|
|
40
|
+
soundcheck:
|
|
41
|
+
techHealth:
|
|
42
|
+
enable: false
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- Added consistent usage of links for the owners of specific campaigns in Soundcheck.
|
|
46
|
+
- Added support for displaying form field errors on markdown inputs.
|
|
47
|
+
- Added a field to the track creation form in No-Code UI for a "Documentation URL".
|
|
48
|
+
- Fixed an issue where certain collectors were showing the "Configure" button as clickable when it should have been disabled.
|
|
49
|
+
- Fixed an issue with the loading state of the library pages in Soundcheck.
|
|
50
|
+
- Add loading indicator to overview page.
|
|
51
|
+
- Editable Collectors are now linkable via the following url structure `/collectors/:collectorId`.
|
|
52
|
+
- Updated dependencies
|
|
53
|
+
- Updated dependencies
|
|
54
|
+
- Updated dependencies
|
|
55
|
+
- Updated dependencies
|
|
56
|
+
- Updated dependencies
|
|
57
|
+
- @spotify/backstage-plugin-soundcheck-common@0.11.0
|
|
58
|
+
- @spotify/backstage-plugin-core@0.5.9
|
|
59
|
+
|
|
3
60
|
## 0.10.0
|
|
4
61
|
|
|
5
62
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -46,7 +46,20 @@ Together, they show you how any given software component is performing against y
|
|
|
46
46
|
- [Filters](#filters-1)
|
|
47
47
|
- [Trends](#trends)
|
|
48
48
|
- [Data Export](#data-export)
|
|
49
|
-
|
|
49
|
+
- [Data Caching](#data-caching)
|
|
50
|
+
- [Campaigns in Soundcheck](#campaigns-in-soundcheck)
|
|
51
|
+
- [Key features include:](#key-features-include)
|
|
52
|
+
- [Campaigns Library](#campaigns-library)
|
|
53
|
+
- [Campaign Creation](#campaign-creation)
|
|
54
|
+
- [Step 1: Campaign Details](#step-1-campaign-details)
|
|
55
|
+
- [Step 2: Selecting Checks](#step-2-selecting-checks)
|
|
56
|
+
- [Step 3: Applying Filters](#step-3-applying-filters)
|
|
57
|
+
- [Step 4: Defining Milestones](#step-4-defining-milestones)
|
|
58
|
+
- [Campaign Archival](#campaign-archival)
|
|
59
|
+
- [Campaign Progress and Milestones](#campaign-progress-and-milestones)
|
|
60
|
+
- [Campaign Notifications](#campaign-notifications)
|
|
61
|
+
- [Scenarios for Receiving Notifications](#scenarios-for-receiving-notifications)
|
|
62
|
+
<!-- TOC -->
|
|
50
63
|
|
|
51
64
|
## Prerequisites
|
|
52
65
|
|
|
@@ -374,6 +387,33 @@ The aggregated data from each Tech Health Page tab can be exported into a Comma-
|
|
|
374
387
|
file format. The CSV format is widely supported and can be easily imported into various data analysis
|
|
375
388
|
tools, spreadsheets, and databases.
|
|
376
389
|
|
|
390
|
+
### Data Caching
|
|
391
|
+
|
|
392
|
+
In order to improve Soundcheck Tech Health page performance you can enable data caching.
|
|
393
|
+
Caching can be specified for trends and snapshots separately.
|
|
394
|
+
Omitting a cache specification will disable caching for that data type.
|
|
395
|
+
|
|
396
|
+
The configuration should be added to the soundcheck portion of `app-config.yaml`:
|
|
397
|
+
|
|
398
|
+
```yaml
|
|
399
|
+
# app-config.yaml
|
|
400
|
+
soundcheck:
|
|
401
|
+
techHealth:
|
|
402
|
+
caching:
|
|
403
|
+
trends:
|
|
404
|
+
enabled: true
|
|
405
|
+
cacheTtl: 86400
|
|
406
|
+
snapshots:
|
|
407
|
+
enabled: true
|
|
408
|
+
cacheTtl: 600
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
- `caching`: A section in which caching per data type can be enabled/disabled. Default value is 'true' for both types.
|
|
412
|
+
- `trends`: A section in which trend data caching can be configured.
|
|
413
|
+
- `snapshots`: A section in which snapshot data caching can be configured.
|
|
414
|
+
- `enabled`: A boolean value indicating whether caching is enabled for the data type. Default value is 'true'.
|
|
415
|
+
- `cacheTtl`: The number of seconds for which the data will be cached, if enabled. Default value is 900 (15 minutes) for snapshots and 86400 (24 hours) for trends.
|
|
416
|
+
|
|
377
417
|
## Campaigns in Soundcheck
|
|
378
418
|
|
|
379
419
|
Soundcheck Campaigns provide a structured approach for organizations to drive focused initiatives, such as software updates or system transitions. They offer a way to create, manage, and monitor these initiatives within the Soundcheck framework.
|
package/config.d.ts
CHANGED
|
@@ -10,6 +10,20 @@ export interface Config {
|
|
|
10
10
|
/**
|
|
11
11
|
* @visibility frontend
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
techHealth?: {
|
|
14
|
+
/**
|
|
15
|
+
* @visibility frontend
|
|
16
|
+
*/
|
|
17
|
+
enable?: boolean;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @visibility frontend
|
|
21
|
+
*/
|
|
22
|
+
overview?: {
|
|
23
|
+
/**
|
|
24
|
+
* @visibility frontend
|
|
25
|
+
*/
|
|
26
|
+
defaultSelectedGroupType?: string;
|
|
27
|
+
};
|
|
14
28
|
};
|
|
15
29
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{useState as ee,useEffect as te,createContext as ae,useContext as ne,useMemo as re}from"react";import{Link as M,useParams as j,Routes as le,Route as v,Navigate as b}from"react-router-dom";import{makeStyles as u,Typography as k,Box as ie,Tab as S,Tabs as O,useTheme as ce,Paper as oe,Divider as se}from"@material-ui/core";import{SpotifyLicenseBanner as de}from"@spotify/backstage-plugin-core";import{useEntity as f}from"@backstage/plugin-catalog-react";import{R as me}from"./RefetchingIndicator-40f27138.esm.js";import{s as L,R as g,A as I,F as U,a as pe,u as N,C as ue,L as ge,N as fe,b as B,c as R,d as w,e as Q,f as Ee,g as he,i as ye,h as $,j as H,k as V,S as ve}from"./index-dbd15076.esm.js";import{Skeleton as E}from"@material-ui/lab";import{MarkdownContent as P,LinearGauge as ke,Link as Ce}from"@backstage/core-components";import{stringifyEntityRef as F}from"@backstage/catalog-model";import{useApi as D,useRouteRef as y,useRouteRefParams as A}from"@backstage/core-plugin-api";import{useQuery as W}from"@tanstack/react-query";import be from"react-use/lib/useMeasure";import Y from"react-use/lib/usePrevious";import Ie from"react-confetti";import T from"lodash";import{i as Ne}from"./chartUtils-080232d7.esm.js";import"react-use/lib/useDebounce";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"../images/empty-state.svg";function Re(t){const n=D(L);return W(["soundcheck/certifications",t],async()=>n.getCertificationDetails(t))}function we(t,n,a){const i=D(L),r=F(t);return W(["soundcheck/check-details",r,n,a],async()=>i.getCheckResultDetails(r,n,a),{enabled:!!n&&!!a})}function x(t){const n=D(L),a=F(t);return W(["soundcheck/playlists",a],async()=>n.getPlaylists(a))}const Pe=u({markdownContent:{"& :last-child":{marginBottom:0}}}),Te=({state:t,notes:n})=>{const a=Pe(),i={[g.Passed]:"success",[g.Failed]:"error",[g.NotReported]:"info",[g.NotApplicable]:"info"}[t],r={[g.Passed]:"Check passed",[g.Failed]:"Check did not pass",[g.NotReported]:"Check not reported",[g.NotApplicable]:"Check not applicable"}[t];return e.createElement(I,{severity:i,title:r},n?e.createElement(P,{className:a.markdownContent,content:n}):null)},xe=()=>{const t=q();return e.createElement(U,null,e.createElement("div",{className:t.root,"data-testid":"check-details-view"},e.createElement("div",{className:t.topBar},e.createElement(k,{variant:"h2",className:t.title},e.createElement(E,{width:300,height:32})),e.createElement(E,{width:100,height:32})),e.createElement(E,{variant:"rect",height:120}),e.createElement("div",{"data-testid":"soundcheck-check-details-description"},e.createElement(k,{variant:"h3"},e.createElement(E,null)),e.createElement(E,null),e.createElement(E,null),e.createElement(E,null))))},q=u(t=>({root:{padding:`${t.spacing(3)}px ${t.spacing(5)}px`},title:{fontWeight:"normal",fontSize:t.typography.h5.fontSize},description:{padding:`${t.spacing(3)}px 0`},subtitle:{fontWeight:"normal",fontSize:t.typography.h6.fontSize},topBar:{display:"flex",justifyContent:"space-between",marginBottom:t.spacing(2)}})),J=({programId:t,checkId:n})=>{const a=q(),{entity:i}=f(),{data:r,isLoading:l,isError:c}=we(i,t,n);if(c)return e.createElement(ie,{padding:2},e.createElement(I,{severity:"error",title:"Error loading check details"}));if(l||!t||!n)return e.createElement(xe,null);if(!r)return null;const{name:s,description:p,result:d,timestamp:o,notes:m}=r;return e.createElement("div",{className:a.root,"data-testid":"check-details-view"},e.createElement("div",{className:a.topBar},e.createElement(k,{variant:"h2",className:a.title},s),o?e.createElement(pe,{timestamp:o,description:"Last updated"}):null),e.createElement(Te,{state:d,notes:m}),e.createElement("div",{className:a.description,"data-testid":"soundcheck-check-details-description"},e.createElement(k,{variant:"h3",className:a.subtitle},"Description"),e.createElement(P,{content:p})))},Se=u(()=>({root:{position:"absolute",width:"100%",height:"100%"}})),Le=({programId:t})=>{var n,a;const i=Se(),{entity:r}=f(),{data:l,isLoading:c}=N(r,t),[s,{width:p,height:d}]=be(),o=c?void 0:(a=(n=l==null?void 0:l.highestLevel)==null?void 0:n.ordinal)!=null?a:-1,m=Y(o),h=Y(t),[_,G]=ee(!1);return te(()=>{typeof m!="undefined"&&typeof o!="undefined"&&t===h&&o>m&&G(!0)},[o,m,t,h]),_?e.createElement("div",{ref:s,className:i.root},e.createElement(Ie,{width:p,height:d,numberOfPieces:1e3,gravity:1,initialVelocityY:20,recycle:!1,onConfettiComplete:()=>G(!1)})):null},K=u(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)}})),Be=({id:t,name:n,badge:a,href:i,selected:r=!1})=>{const l=K(),{entity:c}=f(),{data:s}=N(c,t);return e.createElement(S,{className:l.root,classes:{wrapper:l.wrapper},value:t,label:e.createElement(e.Fragment,null,e.createElement(ue,{badge:a,isCampaign:(s==null?void 0:s.program.type)==="campaign",className:l.badge}),n),component:M,to:i,selected:r})},z=()=>{const t=K();return e.createElement(S,{className:t.root,classes:{wrapper:t.wrapper},label:e.createElement(E,{width:180})})},$e=()=>e.createElement(U,null,e.createElement(O,{value:!1,indicatorColor:"primary"},e.createElement(z,null),e.createElement(z,null),e.createElement(z,null))),Fe=u(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)}})),De=({id:t,name:n,badge:a,href:i,selected:r=!1})=>{const l=Fe();return e.createElement(S,{className:l.root,classes:{wrapper:l.wrapper},value:t,label:e.createElement(e.Fragment,null,a?e.createElement(ge,{badge:a,className:l.badge}):e.createElement(fe,{className:l.badge}),n),component:M,to:i,selected:r})};function Ae(t=[],n=[],a,i){if(a){const l=t.findIndex(c=>c.id===a);return l<0?!1:l}const r=n.findIndex(l=>l.program.id===i);return r<0?!1:r+t.length}const We=({playlistId:t,trackId:n})=>{const{entity:a}=f(),{isLoading:i,data:r}=B(a),{isLoading:l,data:c}=x(a),s=y(R),p=y(w);if(l||i||!n)return e.createElement($e,null);const d=Ae(c,r,t,n);return e.createElement(O,{value:d,indicatorColor:"primary","aria-label":"Certifications",variant:"scrollable"},(c==null?void 0:c.length)&&c.map(({id:o,name:m})=>e.createElement(De,{key:o,id:o,name:m,selected:o===n,href:s({playlistId:o})})),r&&r.filter(({program:{type:o}})=>o!=="playlist").map(({program:{id:o,name:m},highestLevel:h})=>e.createElement(Be,{key:o,id:o,name:m,badge:h==null?void 0:h.badge,selected:o===n,href:p({trackId:o})})))},X=ae(void 0),ze=()=>{const t=ne(X);if(!t)throw new Error("useAPlaylistCertificationContext must be used within an PlaylistCertificationProvider");return t},Ge=t=>{const{children:n,entityRef:a}=t,i=Re(a);return e.createElement(X.Provider,{value:i},n)},Me=(t,n)=>{if(n)return n.filter(a=>t.trackIds.includes(a.program.id)).map(a=>{const i=T.sumBy(a.levels,c=>T.filter(c.checks,{result:g.Passed}).length),r=T.sumBy(a.levels,c=>T.reject(c.checks,{result:g.NotApplicable}).length),l=r===0?0:i/r;return{id:a.program.id,name:a.program.name,checkPassRate:l}})},je=u(()=>({root:{margin:0,width:"250px"},trackItem:{display:"flex",flexDirection:"column",alignItems:"flex-start"},trackName:{margin:0,padding:0}})),Oe=({playlist:t})=>{const n=je(),{data:a}=ze(),i=ce(),r=re(()=>Me(t,a),[a,t]);return e.createElement("div",{className:n.root},r&&r.map(l=>e.createElement("div",{className:n.trackItem,key:l.id},e.createElement(k,{variant:"caption",color:"textSecondary"},l.name),e.createElement("div",{style:{width:"100%",margin:0,padding:0}},e.createElement(ke,{value:l.checkPassRate,getColor:()=>i.palette.status.ok})))))},Z=u(t=>({description:{padding:0,margin:0,display:"block","& p":{margin:0}},root:{padding:t.spacing(2),margin:0,display:"grid",gridTemplateColumns:"min-content auto",gridGap:t.spacing(2)},title:{fontSize:t.typography.pxToRem(18),fontWeight:700,lineHeight:1.235,marginBottom:"6px"},level:{textTransform:"uppercase",color:t.palette.text.secondary,fontWeight:700,letterSpacing:"1px"}}));function Ue({description:t,documentationUrl:n}){const a=Z();return n?e.createElement("div",{className:a.description},e.createElement(P,{content:t}),e.createElement(Ce,{to:n},"Learn more")):e.createElement("div",{className:a.description},e.createElement(P,{content:t}))}const Qe=({playlist:t})=>{const n=Z(),{name:a,description:i}=t;return e.createElement("div",{className:n.root},e.createElement(Oe,{playlist:t}),e.createElement("div",null,e.createElement(k,{className:n.title},a),i&&e.createElement(Ue,{description:i,documentationUrl:void 0})))},He=u(t=>({root:{margin:0,display:"grid",gridTemplateColumns:"1fr",backgroundColor:Ne(t)?t.palette.background.paper:t.palette.background.default},section:{backgroundColor:t.palette.background.paper,border:`1px solid ${t.palette.divider}`,boxShadow:"none"},header:{paddingTop:t.spacing(1),paddingLeft:t.spacing(1),paddingRight:t.spacing(1)},twoColumns:{padding:t.spacing(1),display:"grid",gridTemplateColumns:"1fr 2fr",gridGap:t.spacing(1)},sidebar:{display:"grid",gridTemplateColumns:"1fr",gridGap:t.spacing(1.5)}})),Ve=({playlist:t,entityRef:n})=>{const a=He(),{trackId:i,checkId:r}=j();return e.createElement("div",{className:a.root},e.createElement(Ge,{entityRef:n},e.createElement("div",{className:a.header},e.createElement("div",{className:a.section},e.createElement(Qe,{playlist:t,entityRef:n}))),e.createElement("div",{className:a.twoColumns},e.createElement("div",{className:a.sidebar},t.trackIds.map(l=>e.createElement("div",{className:a.section},e.createElement(Q,{key:l,playlistId:t.id,trackId:l,checkId:r})))),e.createElement("div",{className:a.section},e.createElement(J,{programId:i,checkId:r})))))},Ye=u(t=>({paper:{overflow:"hidden",position:"relative"},view:{display:"grid",gridTemplateColumns:"1fr 2fr"},sidebar:{borderRight:`1px solid ${t.palette.divider}`}})),qe=()=>{const{playlistId:t,trackId:n,checkId:a}=j(),i=Ye(),{entity:r}=f(),{isError:l,isFetched:c,data:s}=B(r),{isError:p,data:d}=x(r);if(l||p)return e.createElement(I,{severity:"error",title:"Error loading certifications"});const o=t&&(d==null?void 0:d.find(h=>h.id===t));if(t&&!o)return e.createElement(I,{severity:"error",title:"Playlist ${playlistId} not found."});if(c&&!(s!=null&&s.length))return e.createElement(Ee,null);const m=r?F(r):void 0;return e.createElement(oe,{className:i.paper},e.createElement(me,null),e.createElement(We,{playlistId:t,trackId:n}),e.createElement(se,null),o&&e.createElement(Ve,{playlist:o,entityRef:m}),!o&&n&&e.createElement("div",{"data-testid":"soundcheck-certification-view",className:i.view},e.createElement("div",{className:i.sidebar},e.createElement(Q,{trackId:n,checkId:a})),e.createElement(J,{programId:n,checkId:a}),e.createElement(Le,{programId:n})))},Je=u(t=>({root:{"&:not(:first-child)":{marginTop:t.spacing(2)}}})),C=()=>{const t=Je();return e.createElement(e.Fragment,null,e.createElement(de,{backend:he,invalidLicenseMessage:ye,inline:!0}),e.createElement("div",{className:t.root},e.createElement(qe,null)))},Ke=()=>{var t,n;const{entity:a}=f(),i=y(R),r=y(w),{isLoading:l,data:c}=x(a),{isLoading:s,data:p}=B(a);if(l||s)return null;const d=(t=c==null?void 0:c[0])==null?void 0:t.id,o=(n=p==null?void 0:p[0])==null?void 0:n.program.id;return!d&&!o?null:e.createElement(b,{to:d?i({playlistId:d}):r({trackId:o}),replace:!0})},Xe=()=>{var t;const{entity:n}=f(),{playlistId:a}=A(R),i=y($),{data:r}=x(n),l=(t=r==null?void 0:r.find(c=>c.id===a))==null?void 0:t.trackIds[0];return l?e.createElement(b,{to:i({playlistId:a,trackId:l}),replace:!0}):null},Ze=()=>{var t,n;const{entity:a}=f(),{playlistId:i,trackId:r}=A($),{data:l}=N(a,r),c=y(V),s=(n=(t=l==null?void 0:l.levels[0])==null?void 0:t.checks[0])==null?void 0:n.id;return s?e.createElement(b,{to:c({playlistId:i,trackId:r,checkId:s}),replace:!0}):null},_e=()=>{var t,n;const{entity:a}=f(),{trackId:i}=A(w),r=y(H),{data:l}=N(a,i),c=(n=(t=l==null?void 0:l.levels[0])==null?void 0:t.checks[0])==null?void 0:n.id;return c?e.createElement(b,{to:r({trackId:i,checkId:c}),replace:!0}):null},et=()=>e.createElement(le,null,e.createElement(v,{path:"/",element:e.createElement(e.Fragment,null,e.createElement(C,null),e.createElement(Ke,null))}),e.createElement(v,{path:w.path,element:e.createElement(e.Fragment,null,e.createElement(C,null),e.createElement(_e,null))}),e.createElement(v,{path:R.path,element:e.createElement(e.Fragment,null,e.createElement(C,null),e.createElement(Xe,null))}),e.createElement(v,{path:$.path,element:e.createElement(e.Fragment,null,e.createElement(C,null),e.createElement(Ze,null))}),e.createElement(v,{path:H.path,element:e.createElement(C,null)}),e.createElement(v,{path:V.path,element:e.createElement(C,null)})),tt=()=>e.createElement(ve,null,e.createElement(et,null));export{tt as EntitySoundcheckContent};
|
|
2
|
+
//# sourceMappingURL=EntitySoundcheckContent-296037fb.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t,{useState as B,useEffect as w,useMemo as z,useCallback as Q,createContext as Le,useContext as Oe,memo as $,Fragment as Be}from"react";import{useSearchParams as Pe,useNavigate as Se}from"react-router-dom";import{makeStyles as h,alpha as q,TextField as Fe,CircularProgress as J,Tooltip as X,LinearProgress as Ae,withStyles as ze,Grid as v,Typography as E,Button as Ge,Menu as Me,MenuItem as Y,Card as We}from"@material-ui/core";import He from"@material-ui/lab/Autocomplete";import{stringifyEntityRef as H,parseEntityRef as P}from"@backstage/catalog-model";import{useApi as k,identityApiRef as Z,configApiRef as ee,useRouteRef as T}from"@backstage/core-plugin-api";import{useQuery as x}from"@tanstack/react-query";import{s as D,Q as V,R as I,m as De,B as Ve,L as te,N as ae,n as ne,A as je,f as Ke,o as Ue,p as _e,q as Qe,r as qe}from"./index-dbd15076.esm.js";import{catalogApiRef as G,humanizeEntityRef as M,entityRouteRef as j,EntityRefLink as Je}from"@backstage/plugin-catalog-react";import Xe from"react-use/lib/useAsync";import{HeaderTabs as re,MarkdownContent as Ye,Link as W,EmptyState as Ze,LinearGauge as et}from"@backstage/core-components";import{R as tt}from"./RefetchingIndicator-40f27138.esm.js";import at,{countBy as le}from"lodash";import{Skeleton as K}from"@material-ui/lab";import{VariableSizeGrid as nt}from"react-window";import{DateTime as oe}from"luxon";import rt from"@material-ui/icons/ArrowDropUp";import lt from"@material-ui/icons/ArrowDropDown";import{motion as ie}from"framer-motion";function se(e,a){const n=k(D);return x(["soundcheck/track-overview-for-owner",e,a],async()=>n.getProgramOverviewForOwner(e,a),{enabled:!!e&&!!(a!=null&&a.kind)})}function ce(){const e=k(G);return x(["soundcheck/all-groups"],async()=>{const{items:a}=await e.getEntities({filter:{kind:"Group"},fields:["spec.profile.displayName","metadata.title","metadata.name","metadata.namespace","kind"]});return a.filter(n=>(n==null?void 0:n.kind)==="Group").map(n=>{var r,l,i,o;return{name:(o=(i=(l=(r=n.spec)==null?void 0:r.profile)==null?void 0:l.displayName)!=null?i:n.metadata.title)!=null?o:n.metadata.name,ref:H(n)}})},{staleTime:5*60*1e3,refetchInterval:!1,refetchOnWindowFocus:!1})}function ot(){const e=k(Z),a=k(G);return x(["soundcheck/user-groups-claims"],async()=>{const{ownershipEntityRefs:n}=await e.getBackstageIdentity();return(await a.getEntitiesByRefs({entityRefs:n})).items.filter(r=>(r==null?void 0:r.kind)==="Group").map(r=>{var l,i,o,d,s;return{name:(d=(o=(i=(l=r.spec)==null?void 0:l.profile)==null?void 0:i.displayName)!=null?o:r.metadata.title)!=null?d:r.metadata.name,ref:H(r),type:(s=r.spec)==null?void 0:s.type}})})}function de(e){const a=k(D);return x([V.GetCampaigns,JSON.stringify(e)],async()=>a.getCampaigns(e),{staleTime:5*60*1e3,refetchInterval:!1,refetchOnWindowFocus:!1})}function it(e){const a=k(D);return x(["soundcheck/facets-for-owner",e],async()=>a.getFacetsForOwner(e),{enabled:!!e})}const st=()=>{const[e,a]=Pe(),n=Object.fromEntries(e.entries()),[r,l]=B(n);return w(()=>{a(r,{replace:!0})},[r]),[r,l]},me=e=>{const a=k(D);return x([V.GetIndividualEntityPassRate,e],async()=>a.getIndividualEntityPassRates(e),{staleTime:5*60*1e3,refetchInterval:!1,refetchOnWindowFocus:!1})},pe=()=>{const{data:e,isLoading:a,isError:n}=ot(),{data:r,isLoading:l,isError:i}=ce();return{options:z(()=>{const o=new Map;return e&&e.forEach(({name:d,ref:s,type:c})=>{o.set(`${s}`,{name:d,ref:s,type:c,key:"My Groups"})}),r&&r.forEach(({name:d,ref:s})=>{o.has(`${s}`)||o.set(`${s}`,{name:d,ref:s,key:"All Groups"})}),[...o.values()]},[e,r]),isLoading:a||l,isError:n||i}},ct=h(e=>({root:{width:"100%",minWidth:250},textField:{"& $notchedOutline":{borderColor:q(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:{}})),dt=e=>{const{onChange:a,initialValue:n,setError:r}=e,{options:l,isLoading:i,isError:o}=pe(),d=ct(),[s,c]=B(null),p=k(ee).getOptionalString("soundcheck.overview.defaultSelectedGroupType");w(()=>{var m,u;if(!i&&l!=null&&l.length&&!s){let f;n?f=(m=l.find(y=>y.ref===n))!=null?m:l[0]:p?f=(u=l.find(y=>y.type===p))!=null?u:l[0]:f=l[0],f&&(c(f),a==null||a(f.ref))}},[i,l,s,a,n,p]);const g=Q((m,u)=>{c(u),a==null||a(u==null?void 0:u.ref)},[a,c]);return w(()=>{r==null||r(o?new Error("Error loading groups"):void 0)},[o,r]),o?null:t.createElement(He,{"aria-label":"Current group",className:d.root,classes:{clearIndicator:d.clearIndicator,popupIndicator:d.popupIndicator},disableClearable:!0,options:l!=null?l:[],loading:i,groupBy:m=>m.key,value:s,freeSolo:!1,onChange:g,getOptionLabel:m=>m.name,renderInput:m=>t.createElement(Fe,{...m,variant:"outlined",placeholder:i?"Loading":"Select a group",className:d.textField,InputProps:{...m.InputProps,className:d.input,classes:{notchedOutline:d.notchedOutline},endAdornment:t.createElement(t.Fragment,null,i?t.createElement(J,{color:"inherit",size:20}):null,m.InputProps.endAdornment)}})})},ue={loading:!1},ge=Le(ue),mt=()=>Oe(ge),pt=({children:e})=>{const[a,n]=B(ue),r=k(G),l=k(Z),{value:i,loading:o,error:d}=Xe(async()=>{const[{token:s},c]=await Promise.all([l.getCredentials(),l.getBackstageIdentity()]);return s?await r.getEntityByRef(c.userEntityRef):null},[r,l]);return w(()=>{if(i){const s=H(i);n({user:i,userEntityRef:s,loading:o,error:d})}else n({loading:o,error:d})},[i,o,d]),t.createElement(ge.Provider,{value:a},e)},ut=e=>({key:`skeleton${e}`,label:"",id:`skeleton${e}`}),gt=()=>{const e=Array.from({length:4},(a,n)=>ut(n));return t.createElement(re,{tabs:e})},ft=h(e=>({root:{borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`},tab:{textTransform:"uppercase",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)}})),yt=({unfilteredFacets:e,onChange:a,kind:n,type:r})=>{var l,i,o;const d=ft(),s={types:(l=e==null?void 0:e.types.filter(({count:m})=>m>0))!=null?l:[]},c=Q(m=>{var u;a((u=s==null?void 0:s.types[m].kind)!=null?u:"",s==null?void 0:s.types[m].type)},[s==null?void 0:s.types,a]);w(()=>{var m,u,f;const y=(s==null?void 0:s.types)&&s.types.length>=0,C=!n&&y,O=n&&y&&!(s!=null&&s.types.find(({kind:S,type:N})=>n===S&&(!r&&!N||r===N)));(C||O)&&a((u=(m=s==null?void 0:s.types[0])==null?void 0:m.kind)!=null?u:"",(f=s==null?void 0:s.types[0])==null?void 0:f.type)},[n,r,s==null?void 0:s.types,a]);const p=(i=s==null?void 0:s.types.map(({kind:m,type:u,count:f})=>{const y=`${m}|${u!=null?u:""}`;return{key:y,label:`${u!=null?u:m} (${f>50?"50+":f})`,id:y,tabProps:{className:d.tab}}}))!=null?i:[];if(!p.length)return null;const g=(o=s==null?void 0:s.types.findIndex(m=>m.kind===n&&(!m.type&&!r||m.type===r)))!=null?o:-1;return t.createElement(t.Fragment,null,t.createElement(tt,null),t.createElement(re,{onChange:c,tabs:p,selectedIndex:g>-1?g:void 0}))},ht=h(e=>({root:{height:"8px",minWidth:"64px",marginLeft:e.spacing(2),borderRadius:"100vh",backgroundColor:e.palette.background.default},bar:{backgroundColor:e.palette.success.main,transition:"none"}})),fe=e=>{var a,n;const r=ht(e),l=z(()=>Object.entries(e.progress).reduce((o,[,d])=>o+d,0),[e.progress]);if(l===0)return null;const i=(a=e.progress[I.Passed])!=null?a:0;return t.createElement(X,{arrow:!0,title:`Check passing for ${i} of ${l} ${l===1?"entity":"entities"}`,enterDelay:0,placement:"top"},t.createElement(Ae,{variant:"determinate",value:((n=e.progress[I.Passed])!=null?n:0)/l*100,classes:{root:r.root,bar:r.bar}}))},Et=h(e=>({headerWrapper:{marginTop:e.spacing(.5)},entityRefName:{fontWeight:"bold"},iconWrapper:{padding:e.spacing(1.5,.5),display:"flex",alignItems:"center",justifyContent:"center"}})),vt=({check:{name:e,description:a},icon:n,entityRef:r})=>{const l=Et(),i=P(r);return t.createElement(v,{spacing:1},t.createElement(v,{container:!0,direction:"row",spacing:1,wrap:"nowrap"},t.createElement("div",{className:l.iconWrapper},n),t.createElement(E,{variant:"h6",className:l.headerWrapper,noWrap:!0},e)),t.createElement(v,{item:!0,wrap:"nowrap"},t.createElement(E,{variant:"subtitle2",className:l.entityRefName},M(i,{defaultKind:i.kind}))),t.createElement(Ye,{content:a}))},kt=ze(e=>{const a=e.palette.type==="dark"?e.palette.common.black:e.palette.grey[300];return{tooltip:{backgroundColor:a,color:e.palette.type==="dark"?e.palette.common.white:e.palette.grey[700]},arrow:{color:a}}})(X),bt=({children:e,check:a,icon:n,entityRef:r})=>t.createElement(kt,{arrow:!0,title:t.createElement(vt,{check:a,icon:n,entityRef:r}),enterDelay:150,placement:"top"},e),Ct=h(e=>({root:{padding:0},iconWrapper:{padding:e.spacing(1.5),display:"flex",alignItems:"center",justifyContent:"center"},link:{"&:hover $iconWrapper, &:active $iconWrapper, &:focus $iconWrapper":{backgroundColor:e.palette.infoBackground}},icon:{width:"17px",height:"17px"},virtualized:{borderBottom:`1px solid ${e.palette.divider}`,borderRight:`1px solid ${e.palette.divider}`}})),ye=$(({programId:e,check:a,entityRef:n,result:r,entityRoute:l,isVirtualized:i})=>{const o=Ct();if(typeof n!="string"){const p=t.createElement("div",{className:o.iconWrapper},t.createElement("div",{className:o.icon}));return i?t.createElement("div",{className:`${o.root} ${o.virtualized}`,"aria-hidden":!0},p):t.createElement("td",{className:o.root,"aria-hidden":!0},p)}const d=t.createElement(De,{className:o.icon,result:r!=null?r:I.NotReported}),s=t.createElement("div",{className:o.iconWrapper},d),c=r&&r===I.NotApplicable?s:t.createElement(W,{className:o.link,to:`${l(P(n))}/soundcheck/${e}/${a.id}`},s);return i?t.createElement("div",{className:`${o.root} ${o.virtualized}`},t.createElement(bt,{check:a,icon:d,entityRef:n},c)):t.createElement("td",{className:`${o.root}`},c)}),he=8,Nt=16,L={programTitle:70,levelTitle:30,check:42,entityRefFooter:100},U={programTitle:350+Nt*2,checkResult:42},Rt=e=>e.reduce((a,n)=>a+n.height,0),wt=e=>e*U.checkResult+U.programTitle,xt=e=>e.filter(a=>a!==void 0).map(a=>{const n=P(a);return M(n,{defaultKind:n.kind})}).reduce((a,n)=>a.length>n.length?a:n,""),$t=e=>he*e+he,Ee="NoLevel",Tt=e=>({name:Ee,badge:{options:{level:0,color:""},variant:Ve.Medal},entityRef:e,ordinal:0}),ve=h(e=>({checkNameCell:{padding:0,backgroundColor:e.palette.background.paper},checkNameContent:{padding:`0 ${e.spacing(2)}px`,display:"flex",justifyContent:"space-between",alignItems:"center"},checkNameTypography:{overflow:"hidden",textOverflow:"ellipsis"},checkIndicator:{flexBasis:e.spacing(8)},checkNameCellVirtualized:{height:`${L.check}px`,lineHeight:`${L.check}px`,borderBottom:`1px solid ${e.palette.divider}`,borderRight:`1px solid ${e.palette.divider}`}})),It=$(({programId:e,programName:a,check:n,entityRefs:r,results:l,entityRoute:i})=>{const o=ve(),d=z(()=>le(l.filter(({result:c})=>c!==I.NotApplicable),"result"),[l]),s=new Map(l.map(c=>[c.entityRef,c.result]));return t.createElement("tr",{"data-testid":"track-check-row"},t.createElement("th",{scope:"row",className:o.checkNameCell,"aria-label":`${n.name} check for ${a} track`},t.createElement("div",{className:o.checkNameContent},t.createElement(E,{className:o.checkNameTypography,variant:"subtitle2",component:"p"},n.name),t.createElement(fe,{className:o.checkIndicator,progress:d}))),r.map((c,p)=>t.createElement(ye,{key:p,programId:e,check:n,entityRef:c,result:typeof c=="string"?s.get(c):void 0,entityRoute:i})))}),Lt=({name:e,progress:a})=>{const n=ve();return t.createElement("div",{className:n.checkNameCell,"aria-label":`${e} check`},t.createElement("div",{className:`${n.checkNameContent} ${n.checkNameCellVirtualized}`},t.createElement(E,{variant:"subtitle2",component:"p",className:n.checkNameTypography},e),t.createElement(fe,{className:n.checkIndicator,progress:a})))},Ot=h(e=>({virtualized:{borderRight:`1px solid ${e.palette.divider}`,height:`${L.programTitle}px`,display:"flex",justifyContent:"center",alignItems:"center"}})),Bt=$(({entityRef:e,highestLevels:a,trackType:n})=>{const r=a.find(i=>i.entityRef===e);let l=r!=null&&r.badge?t.createElement(te,{badge:r.badge}):t.createElement(ae,null);return n==="campaign"&&(l=t.createElement(ne,null)),l}),Pt=({highestLevel:e,trackType:a})=>{const n=Ot();if(!(e!=null&&e.badge))return t.createElement("div",{className:n.virtualized},"\xA0");let r=e.name!==Ee?t.createElement(te,{badge:e.badge}):t.createElement(ae,null);return a==="campaign"&&(r=t.createElement(ne,null)),t.createElement("div",{className:n.virtualized},r)},ke=h(e=>({programNameCell:{padding:0,position:"sticky",backgroundColor:e.palette.background.paper},programNameContent:{padding:e.spacing(2)},programNameTypography:{overflow:"hidden",textOverflow:"ellipsis"},badgeCellContent:{display:"flex",justifyContent:"center",alignItems:"center"},programNameCellVirtualized:{borderRight:`1px solid ${e.palette.divider}`}})),St=$(({program:e,entityRefs:a,highestLevels:n})=>{const r=ke();return t.createElement("tr",{"data-testid":"track-title-row"},t.createElement("th",{scope:"row",className:r.programNameCell},t.createElement("div",{className:r.programNameContent},t.createElement(E,{className:r.programNameTypography,variant:"h5",component:"p"},e.name))),a.map((l,i)=>{var o;return typeof l!="string"?t.createElement("td",{key:i,"aria-hidden":!0}):t.createElement("td",{key:i,"data-testid":"track-certification-cell"},t.createElement("div",{className:r.badgeCellContent},t.createElement(Bt,{entityRef:l,highestLevels:n,trackType:(o=e.type)!=null?o:void 0})))}))}),Ft=$(({name:e})=>{const a=ke();return t.createElement("div",{className:`${a.programNameCell} ${a.programNameCellVirtualized}`},t.createElement("div",{className:a.programNameContent},t.createElement(E,{className:a.programNameTypography,variant:"h5",component:"p"},e)))}),_=h(e=>{const a=e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100];return{root:{color:q(e.palette.getContrastText(a),.8),backgroundColor:a},levelContent:{padding:`${e.spacing(.5)}px ${e.spacing(2)}px`,backgroundColor:a},levelTypography:{overflow:"hidden",textOverflow:"ellipsis"},levelHeaderCell:{padding:`${e.spacing(.5)}px ${e.spacing(2)}px`,borderRight:`1px solid ${e.palette.divider}`,height:`${L.levelTitle}px`}}}),At=$(({level:e,entityRefs:a,programName:n})=>{const r=_();return t.createElement("tr",{className:r.root,"data-testid":"track-level-row"},t.createElement("th",{scope:"row",className:r.root},t.createElement("div",{className:r.levelContent},t.createElement(E,{className:r.levelTypography,variant:"subtitle2",component:"p","aria-label":`${e.name} for ${n} track`},e.name))),a.map((l,i)=>t.createElement("td",{key:i,className:r.root,"aria-hidden":!0})))}),zt=({name:e})=>{const a=_();return t.createElement("div",{className:`${a.levelHeaderCell} ${a.root}`,"aria-label":`${e}`},t.createElement(E,{variant:"subtitle2",component:"p",className:a.levelTypography},e))},Gt=()=>{const e=_();return t.createElement("div",{className:`${e.levelHeaderCell} ${e.root}`},"\xA0")},Mt=({program:e,highestLevels:a,levels:n,entityRefs:r,entityRoute:l})=>t.createElement("tbody",null,t.createElement(St,{program:e,entityRefs:r,highestLevels:a}),n.map((i,o)=>t.createElement(Be,{key:o},t.createElement(At,{entityRefs:r,level:i,programName:e.name}),i.checks.map(({check:d,results:s},c)=>t.createElement(It,{key:c,check:d,programId:e.id,programName:e.name,entityRefs:r,results:s,entityRoute:l}))))),be=e=>{const a=k(G);return x([V.EntityByRef,e],async()=>a.getEntityByRef(e),{onError:()=>{},enabled:!!e})},Wt=e=>{const a=k(G);return x([V.EntitiesByRefs,e],async()=>a.getEntitiesByRefs({entityRefs:e.entityRefs,fields:e.fields}),{onError:()=>{},enabled:!!e.entityRefs})},Ce=h(e=>({root:{position:"sticky",bottom:"-1px",backgroundColor:e.palette.background.default,boxShadow:`0 -1px ${e.palette.divider}`,"& td$cell, & th$cell":{border:0,padding:e.spacing(1)},"& td$cell":{backgroundColor:e.palette.background.default}},row:{boxShadow:`1px 0 ${e.palette.background.default}, -1px 0 ${e.palette.background.default}`},cell:{verticalAlign:"top"},cellInner:{textOrientation:"mixed",writingMode:"vertical-lr",transform:"rotate(-20deg)",transformOrigin:`100% ${e.spacing(1)}px`,wordBreak:"keep-all",fontWeight:"bold",overflow:"hidden",textOverflow:"ellipsis",maxHeight:"max(15vh, 175px)"}})),Ht=({entityRefs:e})=>{const a=T(j),n=Ce(),{data:r}=Wt({entityRefs:at.compact(e),fields:["kind","metadata.name","metadata.namespace","metadata.title"]});return t.createElement("tfoot",{className:n.root,"data-testid":"results-table-footer"},t.createElement("tr",{className:n.row},t.createElement("td",{className:n.cell}),e.map((l,i)=>{if(typeof l!="string")return t.createElement("th",{key:i,className:n.cell,"aria-hidden":!0});const o=P(l),d=r==null?void 0:r.items.find(s=>s&&H(s)===l);return t.createElement("th",{scope:"col",key:i,className:n.cell},t.createElement("div",{className:n.cellInner},t.createElement(W,{to:a(o)},d!=null&&d.metadata.title?d.metadata.title:M(o,{defaultKind:o.kind}))))})))},Dt=({entityRef:e})=>{const{data:a}=be(e),n=T(j),r=Ce(),l=e?P(e):void 0,i=l?t.createElement(W,{to:n(l)},a!=null&&a.metadata.title?a.metadata.title:M(l,{defaultKind:l.kind})):t.createElement(t.Fragment,null);return t.createElement("div",{className:r.cell},t.createElement("div",{className:r.cellInner},i))},Vt=h(e=>({table:{backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap","& th, & td":{border:`1px solid ${e.palette.divider}`,borderCollapse:"collapse"},paddingBottom:e.spacing(2)},programTitle:{padding:e.spacing(2)},checkResult:{padding:e.spacing(1.5)},title:{padding:`${e.spacing(1)}px ${e.spacing(2)}px`},header:{backgroundColor:e.palette.type==="dark"?e.palette.grey[700]:e.palette.grey[100]}})),Ne=()=>{const e=Vt(),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(K,{width:180,height:40})),a.map((l,i)=>t.createElement("td",{key:i}))),r.map((l,i)=>t.createElement(t.Fragment,{key:i},t.createElement("tr",{className:e.header},t.createElement("td",{className:e.title},t.createElement(K,{width:180})),a.map((o,d)=>t.createElement("td",{key:d}))),n.map((o,d)=>t.createElement("tr",{key:d},t.createElement("td",{className:e.title},t.createElement(K,{width:240})),a.map((s,c)=>t.createElement("td",{key:c,className:e.checkResult},t.createElement(K,{width:18,height:18,variant:"rect"})))))))))},jt=h(e=>({root:{width:"100%"},table:{overflow:"auto",backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap",textAlign:"left","& th, & td":{border:`1px solid ${e.palette.divider}`,borderCollapse:"collapse"},"& th:first-of-type":{position:"sticky",left:0,zIndex:1,maxWidth:"60ch"},"& tfoot":{bottom:0,zIndex:1e3},"& tbody td:first-of-type":{border:`1px solid ${e.palette.divider}`,boxShadow:`1px 0 ${e.palette.background.default}, -1px 0 ${e.palette.background.default}`}}})),Kt=$(e=>{const{setError:a,kind:n,type:r,ownerEntityRef:l}=e,i=jt(),o=T(j),{data:d,isLoading:s,isError:c}=se(l,{kind:n,type:r});if(w(()=>{a==null||a(c?new Error("Error loading track overview"):void 0)},[c,a]),s)return t.createElement(Ne,null);if(!d||!l)return null;const{programs:p,entityRefs:g}=d;if(!s&&!p.length)return t.createElement(Ze,{missing:"data",title:"Missing tracks",description:t.createElement(t.Fragment,null,"Looks like the group"," ",M(P(l),{defaultKind:"Group"})," ","doesn't own any ",r!=null?r:n," components that have Soundcheck tracks set up.",t.createElement("br",null),t.createElement("br",null),"If you're an administrator, you can learn more about configuring and filtering tracks in the"," ",t.createElement(W,{to:"https://www.npmjs.com/package/@spotify/backstage-plugin-soundcheck-backend#entity-filter"},"docs"),".")});if(c)return null;const m=g.length>=25?g:[...g,...Array.from({length:25-g.length},()=>{})];return t.createElement("div",{className:i.root},t.createElement("table",{className:i.table,"aria-label":"Check results"},p.map(({program:u,levels:f,highestLevels:y},C)=>t.createElement(Mt,{key:C,program:u,entityRefs:m,levels:f,highestLevels:y,entityRoute:o})),t.createElement(Ht,{entityRefs:m})))}),Ut=e=>t.createElement(Ft,{name:e}),_t=e=>({type:"ProgramHeader",render:()=>Ut(e)}),Qt=e=>e?t.createElement(zt,{name:e}):t.createElement(Gt,null),Re=e=>({type:"LevelHeader",render:()=>Qt(e)}),qt=(e,a)=>t.createElement(Lt,{name:e,progress:a}),Jt=(e,a)=>({type:"CheckTitle",render:()=>qt(e,a)}),Xt=(e,a,n,r,l)=>t.createElement(ye,{check:a,entityRef:n,entityRoute:l,programId:e,result:r,isVirtualized:!0}),Yt=(e,a,n,r,l)=>({type:"CheckResult",render:()=>Xt(e,a,n,r,l)}),Zt=e=>t.createElement(Dt,{entityRef:e}),we=e=>({type:"EntityHeader",render:()=>Zt(e)}),ea=(e,a)=>t.createElement(Pt,{highestLevel:e,trackType:a}),ta=(e,a)=>({type:"LevelBadge",render:()=>ea(e,a)}),aa=e=>a=>{const n=e[a.rowIndex].cells[a.columnIndex];return n?t.createElement("div",{style:a.style},n.render()):t.createElement("div",{style:a.style})},na=(e,a,n)=>{var r;const l=[];for(const{program:o,levels:d,highestLevels:s}of e){l.push({height:L.programTitle,cells:[_t(o.name),...a.map(c=>{var p;const g=c?s.find(m=>m.entityRef===c)||Tt(c):void 0;return ta(g,(p=o.type)!=null?p:void 0)})]});for(const c of d){l.push({height:L.levelTitle,cells:[Re(c.name),...a.map(p=>Re(""))]});for(const{check:p,results:g}of c.checks)l.push({height:L.check,cells:[Jt(p.name,le(g.filter(({result:m})=>m!==I.NotApplicable),"result")),...a.map(m=>{var u,f;return Yt(o.id,p,m,(f=(u=g.find(y=>y.entityRef===m))==null?void 0:u.result)!=null?f:I.NotApplicable,n)})]})}}const i=xt(a!=null?a:[]);return l.push({height:$t((r=i.length)!=null?r:1),cells:[we(""),...a.map(o=>we(o||""))]}),l},ra=h(e=>({table:{backgroundColor:e.palette.background.paper,borderCollapse:"collapse",whiteSpace:"nowrap",textAlign:"left",overflow:"auto"}})),la=e=>{const{setError:a,kind:n,type:r,ownerEntityRef:l}=e,i=ra(),o=T(j),{data:d,isLoading:s,isError:c}=se(l,{kind:n,type:r});if(w(()=>{a==null||a(c?new Error("Error loading program overview"):void 0)},[c,a]),s)return t.createElement(Ne,null);if(!d||!l)return null;const{programs:p,entityRefs:g}=d,m=g.length>=25?g:[...g,...Array.from({length:25-g.length},()=>{})],u=na(p,m,o),f=aa(u);return t.createElement(v,{"aria-label":`Check results for ${r!=null?r:n}`,key:`${n}|${r!=null?r:""}`,item:!0,xs:12},t.createElement(nt,{className:i.table,columnCount:m.length+1,columnWidth:y=>y===0?U.programTitle:U.checkResult,rowCount:u.length,rowHeight:y=>u[y].height,height:Rt(u),width:wt(m.length)},f))},oa=({facets:e,ownerEntityRef:a,kind:n,type:r,setError:l})=>{const i=z(()=>{const o=new Map;return e.types.forEach(({kind:d,type:s})=>{const c=`${d}|${s!=null?s:""}`;o.set(c,t.createElement(la,{key:c,ownerEntityRef:a,kind:d,type:s,setError:l}))}),o},[e,a,l]);return t.createElement("div",null,i.get(`${n}|${r!=null?r:""}`))},ia=h(()=>({scrollContainer:{overflow:"auto"}})),sa=({facets:e,ownerEntityRef:a,hasError:n,kind:r,type:l,setError:i,useVirtualizedResultsTable:o,isFixedGroup:d})=>{var s,c,p;const g=ia();if(n)return t.createElement(je,{severity:"error",title:n.message});const m="Use the groups drop-down list at the top-right of the page to select another group.";return e&&((c=(s=e.types)==null?void 0:s.length)!=null?c:0)>0?(p=e.types)!=null&&p.find(u=>u.count>0)?t.createElement("div",{className:g.scrollContainer},o?t.createElement(oa,{facets:e,kind:r,type:l,setError:i,ownerEntityRef:a,hasError:n}):t.createElement(Kt,{ownerEntityRef:a,kind:r,type:l,setError:i})):t.createElement(Ke,{ownerEntityRef:a,selectGroupHint:m}):t.createElement(Ue,{ownerEntityRef:a,selectGroupHint:d?void 0:m})};function ca({angle:e,arc:a,direction:n,dist:r,emoji:l,delay:i,fontSize:o,speed:d}){return t.createElement(ie.div,{style:{position:"absolute",fontSize:o},initial:{top:0,left:"50%",x:"-50%",y:"-100%",rotate:0,originX:`${a*n}px`,originY:`${a}px`},animate:{opacity:[0,1,0,0,0,0],y:`${-r}px`,rotate:e*n},transition:{delay:i,duration:d,ease:[.2,.83,.46,.63],repeat:1/0}},l)}const da=["\u{1F4C8}","\u{1F4CA}","\u{1F4C9}","\u{1F680}","\u2B50\uFE0F"],ma=h(()=>({container:{position:"relative"}}));function pa({angle:e=125,density:a=20,emojis:n=da,fontSizeMin:r=6,fontSizeMax:l=24,size:i=300,speed:o=4}){const d=ma(),s=z(()=>Array.from({length:a*n.length}).map((c,p)=>({emoji:n[Math.floor(Math.random()*n.length)],arc:Math.random()*i*.5,delay:Math.random()*o,dist:Math.random()*i,direction:p%2?1:-1,fontSize:Math.random()*(l-r)+r,angle:e,speed:o})),[a,n,o,i,e,l,r]);return t.createElement("div",{className:d.container},t.createElement(E,{variant:"h1"},"\u{1F469}\u200D\u{1F4BB}"),s.map((c,p)=>t.createElement(ca,{key:`${c.emoji}-${p}`,...c})))}const ua=h(()=>({container:{position:"relative",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flex:1,height:"100%"},textContainer:{position:"relative",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}}));function xe({title:e,subtitle:a}){const n=ua();return t.createElement("div",{className:n.container},t.createElement("div",{className:n.textContainer},t.createElement(pa,null),t.createElement(ie.div,{animate:{y:0,opacity:1},initial:{y:100,opacity:0}},e&&t.createElement(E,{align:"center",variant:"h6"},e),a&&t.createElement(E,{align:"center",variant:"subtitle2"},a))))}const ga=h(e=>({campaignCards:{display:"flex",flexDirection:"column",gap:e.spacing(1)},campaignCard:{border:`1px solid ${e.palette.border}`,padding:e.spacing(2),borderRadius:e.shape.borderRadius},actions:{display:"flex",alignItems:"center",gap:e.spacing(1)},actionsText:{textTransform:"lowercase","&:first-letter":{textTransform:"uppercase"}},actionsIcon:{display:"flex"},campaignText:{display:"flex",flexDirection:"column"},campaignDescription:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},entityProgress:{display:"flex",flexDirection:"column"},progress:{display:"flex",alignItems:"center",gap:e.spacing(1),width:"90%"},progressBar:{display:"flex",width:"90%",height:e.spacing(3),"& > span":{display:"flex",margin:"auto",width:"100%",height:e.spacing(2)}},daysLeft:{display:"flex",flexDirection:"column"}})),fa=({campaign:e})=>{var a;const n=ga(),r=T(_e),l=T(Qe),i=Se(),[o,d]=B(null),{data:s,isLoading:c,isError:p}=me({tracks:[{trackId:e.track.id}]}),g=(a=s==null?void 0:s.individualEntityPassRates)!=null?a:[],m=oe.fromISO(e.startDate,{zone:"utc"}),u=oe.fromISO(e.targetCompletionDate,{zone:"utc"}),f=Math.round(u.diff(m,"days").days),y=F=>{d(F.currentTarget)},C=()=>{d(null)},O=()=>{i(l({campaignId:e.id}))},S=()=>{i(r({campaignId:e.id}))};if(c)return t.createElement("div",{"data-testid":"loading-indicator"},t.createElement(xe,null));if(p)return t.createElement(E,{color:"error"},"Failed to load campaigns progress.");let N;return g.length?N=g.map(({id:F,entityOwnerRef:R,snapshotPassRate:b})=>t.createElement("div",{key:F,className:n.entityProgress},R&&t.createElement(Je,{entityRef:R}),t.createElement("div",{className:n.progress},t.createElement("div",{className:n.progressBar},t.createElement(et,{value:b/100,getColor:({value:A,palette:Ie})=>A<0?"":Ie.primary.main})),t.createElement("div",null,b,"%")))):N=t.createElement(E,{variant:"body2"},"No campaigns progress found."),t.createElement("div",{className:n.campaignCards},t.createElement("div",{className:n.campaignCard},t.createElement(v,{container:!0,spacing:4,alignItems:"flex-start"},t.createElement(v,{item:!0,xs:12,md:4},t.createElement("div",{className:n.campaignText},t.createElement(E,{variant:"subtitle2"},e.name),t.createElement(E,{variant:"body2",className:n.campaignDescription},e.description))),t.createElement(v,{item:!0,xs:12,md:4},N),t.createElement(v,{item:!0,xs:6,md:2},t.createElement("div",{className:n.daysLeft},t.createElement(E,{variant:"subtitle2"},"Days left"),t.createElement(E,{variant:"body2"},f))),t.createElement(v,{item:!0,xs:6,md:2},t.createElement("div",null,t.createElement(Ge,{variant:"text","aria-controls":"menu","aria-haspopup":"true",onClick:y},t.createElement("div",{className:n.actions},t.createElement("div",{className:n.actionsText},"Actions"),t.createElement("div",{className:n.actionsIcon},o?t.createElement(rt,{fontSize:"small"}):t.createElement(lt,{fontSize:"small"})))),t.createElement(Me,{id:"campaign-menu",anchorEl:o,keepMounted:!0,open:!!o,onClose:C},t.createElement(Y,{onClick:S},"View"),t.createElement(Y,{onClick:O},"Edit")))))))},ya=h(e=>({loadingContainer:{marginTop:e.spacing(1),display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}})),$e=({size:e})=>{const a=ya();return t.createElement(v,{container:!0,className:a.loadingContainer},t.createElement(J,{size:e}))},ha=h(e=>({tableContainer:{padding:0,backgroundColor:"transparent"},campaignsGrid:{margin:`0 0 ${e.spacing(3)}px`},campaignsCard:{padding:e.spacing(2),gap:e.spacing(2)},campaignsLink:{textAlign:"center",margin:`${e.spacing(1)}rem 0 ${e.spacing(1)}`},tableLoading:{backgroundColor:e.palette.background.paper,padding:e.spacing(6)}})),Te=3,Ea=({groupSelectorError:e,searchParams:a,setSearchParams:n,isFixedGroup:r=!1})=>{var l;const{group:i,kind:o,type:d}=a,s=T(qe),[c,p]=B(void 0),[g,m]=B(void 0);w(()=>{((c==null?void 0:c.kind)!==o||(c==null?void 0:c.type)!==d)&&p({kind:o,type:d})},[o,d,c]);const{data:u,isLoading:f}=it(i),{data:y}=de({orderAlphabetical:"default",searchByOwner:i,searchByStatus:"active"}),C=y==null?void 0:y.edges.map(b=>b.campaign),O=C==null?void 0:C.slice(0,Te),S=(l=k(ee).getOptionalBoolean("soundcheck.virtualizeOverviewPage"))!=null?l:!0,N=g||e,F=(b,A)=>{b&&(p({kind:b,type:A}),A?n({...a,kind:b,type:A}):(a!=null&&a.hasOwnProperty("type")&&delete a.type,n({...a,kind:b})))},R=ha();return t.createElement(v,{container:!0,spacing:0},C&&C.length>0&&t.createElement(v,{item:!0,xs:12,className:R.campaignsGrid},t.createElement(We,{className:R.campaignsCard},t.createElement(E,{variant:"h5"},"Campaigns"),O==null?void 0:O.map(b=>t.createElement("div",{key:b.id},t.createElement(fa,{campaign:b}))),C.length>Te&&t.createElement(W,{to:s(),className:R.campaignsLink},"More Campaigns"))),t.createElement(v,{item:!0,xs:12},f?t.createElement(gt,null):t.createElement(yt,{unfilteredFacets:u,kind:c==null?void 0:c.kind,type:c==null?void 0:c.type,onChange:F})),t.createElement(v,{item:!0,xs:12,className:R.tableContainer},f?t.createElement("div",{className:R.tableLoading},t.createElement($e,{size:80})):t.createElement(sa,{facets:u,kind:c==null?void 0:c.kind,type:c==null?void 0:c.type,setError:m,hasError:N,ownerEntityRef:i,useVirtualizedResultsTable:S,isFixedGroup:r})))};export{dt as G,$e as L,Ea as O,pt as U,pe as a,mt as b,ce as c,xe as d,be as e,me as f,de as g,st as u};
|
|
2
|
+
//# sourceMappingURL=OverviewPageContent-799c2286.esm.js.map
|
package/dist/esm/{RefetchingIndicator-fd4435c2.esm.js → RefetchingIndicator-40f27138.esm.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t,{useState as n}from"react";import{makeStyles as a,LinearProgress as m}from"@material-ui/core";import s from"react-use/lib/useDebounce";import"@backstage/catalog-model";import"@backstage/core-plugin-api";import{useIsFetching as c}from"@tanstack/react-query";import{F as d}from"./index-
|
|
2
|
-
//# sourceMappingURL=RefetchingIndicator-
|
|
1
|
+
import t,{useState as n}from"react";import{makeStyles as a,LinearProgress as m}from"@material-ui/core";import s from"react-use/lib/useDebounce";import"@backstage/catalog-model";import"@backstage/core-plugin-api";import{useIsFetching as c}from"@tanstack/react-query";import{F as d}from"./index-dbd15076.esm.js";import"@backstage/plugin-catalog-react";import"react-router-dom";const p=a(e=>({indicator:{position:"absolute",width:"100%",zIndex:e.zIndex.speedDial}})),l=()=>{const e=c(),i=p(),[r,o]=n(!!e);return s(()=>{o(!!e)},250,[e]),r?t.createElement(d,null,t.createElement("div",{className:i.indicator},t.createElement(m,{variant:"indeterminate","data-testid":"refetching-indicator"}))):null};export{l as R};
|
|
2
|
+
//# sourceMappingURL=RefetchingIndicator-40f27138.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{DATA_VIZ_DARK_THEME as r,DATA_VIZ_LIGHT_THEME as o}from"@spotify/backstage-plugin-core";const s=t=>t?t.palette.type:"",e=t=>s(t).toLowerCase()==="dark",T=t=>e(t)?t.palette.grey[200]:t.palette.grey[800],m=t=>e(t)?r:o;function p(t,a){return(a?t.minus({days:a}):t).toFormat("MMM dd")}export{m as a,p as f,T as g,e as i};
|
|
2
|
+
//# sourceMappingURL=chartUtils-080232d7.esm.js.map
|