@spotify/backstage-plugin-soundcheck 0.21.0 → 0.22.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/alpha/integrations.esm.js +1 -1
  3. package/dist/alpha/pages.esm.js +1 -1
  4. package/dist/alpha.d.ts +68 -23
  5. package/dist/api.esm.js +1 -1
  6. package/dist/blueprints/CampaignActionBlueprint.esm.js +2 -0
  7. package/dist/blueprints/IntegrationPageBlueprint.esm.js +1 -1
  8. package/dist/components/AccordionSection/AccordionSection.esm.js +2 -0
  9. package/dist/components/Alert/Alert.esm.js +1 -1
  10. package/dist/components/CampaignPage/CampaignActionsContext.esm.js +2 -0
  11. package/dist/components/CertificationSidebar/Check.esm.js +1 -1
  12. package/dist/components/CheckPage/CheckEntitiesTable/CheckEntitiesTableBUI.esm.js +1 -1
  13. package/dist/components/CheckTemplatesPage/CheckTemplatesPageBUI.esm.js +1 -1
  14. package/dist/components/CheckTemplatesPage/TemplateCategoryBUI.esm.js +1 -1
  15. package/dist/components/ChecksPage/ChecksListPageBUI.esm.js +1 -1
  16. package/dist/components/CollectorPage/Configurators/Configurator.esm.js +1 -1
  17. package/dist/components/CollectorPage/Configurators/SonarQube/utils.esm.js +1 -1
  18. package/dist/components/CollectorsPage/IntegrationLogoBUI.esm.js +1 -1
  19. package/dist/components/CollectorsPage/IntegrationsListPageBUI.esm.js +1 -1
  20. package/dist/components/CreateNewTrackPage/CreateNewTrackPage.esm.js +2 -0
  21. package/dist/components/EmptyState/EmptyStateNoTracks.esm.js +1 -1
  22. package/dist/components/FactExplorer/FactExplorer.esm.js +1 -1
  23. package/dist/components/FilterSidebar/useTrackFilterSidebar.esm.js +1 -1
  24. package/dist/components/FilterSidebar/util.esm.js +1 -1
  25. package/dist/components/FormControlledAutocomplete/FormControlledAutocomplete.esm.js +1 -1
  26. package/dist/components/GroupSelectorBUI/GroupSelectorBUI.esm.js +1 -1
  27. package/dist/components/HierarchicalTechInsightsPage/visualizations/hierarchyToNivo.esm.js +1 -1
  28. package/dist/components/Menus/useCampaignActions.esm.js +1 -1
  29. package/dist/components/RoutingPage/RoutingPageBUI.esm.js +1 -1
  30. package/dist/components/SoundcheckHeader/SoundcheckHeaderBUI.esm.js +1 -1
  31. package/dist/components/SoundcheckMarkdownContent/SoundcheckMarkdownContentBUI.esm.js +1 -1
  32. package/dist/components/Stepper/Stepper.esm.js +1 -1
  33. package/dist/components/TableRowWithOwner/TableRowWithOwner.esm.js +1 -1
  34. package/dist/components/TechInsights/TechInsightsPageBUI.esm.js +1 -1
  35. package/dist/components/TechInsightsExplorerTable/TechInsightsExplorerTable.esm.js +1 -1
  36. package/dist/components/TimePeriodBar/TimePeriodBarBUI.esm.js +1 -1
  37. package/dist/components/TopAndBottomPerformingTeams/TopAndBottomPerformingTeams.esm.js +1 -1
  38. package/dist/components/TrackBuilderPage/TrackBuilderPage.esm.js +1 -1
  39. package/dist/components/TrackBuilderPage/components/CheckItem/CheckItem.esm.js +2 -0
  40. package/dist/components/TrackBuilderPage/components/IntegrationTags/IntegrationTags.esm.js +2 -0
  41. package/dist/components/TrackBuilderPage/components/RunChecksStep/RunChecksStep.esm.js +2 -0
  42. package/dist/components/TrackBuilderPage/components/SelectProviderStep/SelectProviderStep.esm.js +2 -0
  43. package/dist/components/TrackBuilderPage/components/SelectTracksStep/SelectTracksStep.esm.js +2 -0
  44. package/dist/components/TrackBuilderPage/components/TrackAccordion/TrackAccordion.esm.js +2 -0
  45. package/dist/components/TrackBuilderPage/components/TrackBuilderStatus/TrackBuilderStatus.esm.js +2 -0
  46. package/dist/components/TrackBuilderPage/hooks/useTrackBuilderStatus.esm.js +2 -0
  47. package/dist/components/TrackBuilderPage/hooks/useTrackCheckExecutions.esm.js +2 -0
  48. package/dist/components/TrackBuilderPage/utils.esm.js +4 -0
  49. package/dist/components/TrackPage/TrackEntitiesTable/TrackEntitiesTableBUI.esm.js +1 -1
  50. package/dist/components/TrackPage/TrackHistoryChartBUI.esm.js +1 -1
  51. package/dist/components/TrackPage/TrackPageBUI.esm.js +1 -1
  52. package/dist/components/TrackPage/TrackTechInsightsExplorerPage.esm.js +1 -1
  53. package/dist/components/TracksPage/TracksListPageBUI.esm.js +1 -1
  54. package/dist/graphql/generated/index.esm.js +168 -85
  55. package/dist/hooks/catalog/useGetEntityRefs.esm.js +1 -1
  56. package/dist/hooks/graphqlKeys.esm.js +1 -1
  57. package/dist/hooks/tracks/useDeleteTrack.esm.js +1 -1
  58. package/dist/hooks/tracks/useOutOfBoxTracks.esm.js +2 -0
  59. package/dist/hooks/tracks/useSaveOutOfBoxTracks.esm.js +2 -0
  60. package/dist/hooks/tracks/useTracksApplicableToGroup.esm.js +1 -1
  61. package/dist/index.d.ts +30 -2
  62. package/dist/index.esm.js +1 -1
  63. package/dist/routes.esm.js +1 -1
  64. package/package.json +24 -24
  65. package/dist/components/Badge/Badge.esm.js +0 -2
  66. package/dist/components/TrackBuilderPage/RunFirstCheckStep.esm.js +0 -2
  67. package/dist/components/TrackBuilderPage/SelectTracksStep.esm.js +0 -2
  68. package/dist/components/TrackBuilderPage/mockData.esm.js +0 -2
@@ -1,2 +1,2 @@
1
- import{asArray as d}from"@spotify/backstage-plugin-soundcheck-common";import{defaultBaseCollectorOption as u,defaultCollectorOption as O}from"../Common/CollectorOption.esm.js";import{mapBackendConfigToFormIntegrationConfig as p,mapFormIntegrationConfigToBackendConfig as m}from"../Common/utils.esm.js";const C="projects",E="project-tags",r="issues",f="measures",D=["OPEN","CONFIRMED","REOPENED","RESOLVED","CLOSED"],y=["BLOCKER","CRITICAL","MAJOR","MINOR","INFO"],L=["VULNERABILITY","BUG","CODE_SMELL"],T=["OPEN"],g=["ncloc","complexity","violations","open_issues"],I={factDetails:{factName:{name:"Fact Name",helperText:"Fact name must be unique",placeholder:"Fact Name"},metrics:{name:"Metrics",helperText:"Add more metrics to collect",placeholder:"Example: code_smells"}}},S=(t,s,c,o,i)=>({...u(t),factDetails:{factName:s??"",statuses:c??T,severities:o,types:i}}),N=(t,s,c)=>({...u(t),factDetails:{factName:s??"",metrics:c??g}}),_=t=>({projects:O(t),projectTags:O(t),issues:{enabled:!1,collectors:[S(t,r,T)]},measures:{enabled:!1,collectors:[N(t,f,g)]}});function R(t){const{projects:s,projectTags:c,issues:o,measures:i}=t;if(s.enabled||c.enabled||o.enabled||i.enabled){const l={},n=[];return l.collects=n,s.enabled&&n.push(m({factType:C,configOption:s})),c.enabled&&n.push(m({factType:E,configOption:c})),o.enabled&&o.collectors.forEach(a=>{n.push(m({factType:r,configOption:a,additionalParams:{factName:a.factDetails.factName,statuses:a.factDetails.statuses?.length?a.factDetails.statuses:void 0,severities:a.factDetails.severities?.length?a.factDetails.severities:void 0,types:a.factDetails.types?.length?a.factDetails.types:void 0}}))}),i.enabled&&i.collectors.forEach(a=>{n.push(m({factType:f,configOption:a,additionalParams:{factName:a.factDetails.factName,metrics:a.factDetails.metrics}}))}),l}return{collects:[]}}function b(t){const s=_(t);if(t){const c=d(t).flatMap(o=>o.collects);if(c){const o=d(c),i=o.find(e=>e.type===C);i&&(s.projects={...p({parentConfig:t,factTypeConfig:i}),enabled:!0});const l=o.find(e=>e.type===E);l&&(s.projectTags={...p({parentConfig:t,factTypeConfig:l}),enabled:!0});const n=o.filter(e=>e.type===r);n.length&&(s.issues={enabled:!0,collectors:n.map(e=>({...p({parentConfig:t,factTypeConfig:e}),factDetails:{factName:e.factName??r,statuses:e.statuses?.length?e.statuses:void 0,severities:e.severities?.length?e.severities:void 0,types:e.types?.length?e.types:void 0}}))});const a=o.filter(e=>e.type===f);a.length&&(s.measures={enabled:!0,collectors:a.map(e=>({...p({parentConfig:t,factTypeConfig:e}),factDetails:{factName:e.factName??f,metrics:e.metrics}}))})}}return s}export{T as DEFAULT_ISSUE_STATUSES,g as DEFAULT_METRICS,r as ISSUES_COLLECTOR_TYPE,y as ISSUE_SEVERITY_OPTIONS,D as ISSUE_STATUS_OPTIONS,L as ISSUE_TYPE_OPTIONS,f as MEASURES_COLLECTOR_TYPE,C as PROJECTS_COLLECTOR_TYPE,E as PROJECT_TAGS_COLLECTOR_TYPE,I as SONARQUBE_COLLECTOR_FIELDS,_ as defaultSonarQubeConfig,S as issuesCollectorConfig,b as mapConfigToSonarQubeCollectorConfig,R as mapSonarQubeCollectorConfigToConfig,N as measuresCollectorConfig};
1
+ import{asArray as g}from"@spotify/backstage-plugin-soundcheck-common";import{defaultBaseCollectorOption as u,defaultCollectorOption as O}from"../Common/CollectorOption.esm.js";import{mapBackendConfigToFormIntegrationConfig as p,mapFormIntegrationConfigToBackendConfig as m}from"../Common/utils.esm.js";const C="projects",E="project-tags",r="issues",f="measures",D=["OPEN","CONFIRMED","REOPENED","RESOLVED","CLOSED"],y=["BLOCKER","CRITICAL","MAJOR","MINOR","INFO"],L=["VULNERABILITY","BUG","CODE_SMELL"],T=["OPEN"],d=["ncloc","complexity","violations","open_issues"],I={factDetails:{factName:{name:"Fact Name",helperText:"Fact name must be unique",placeholder:"Fact Name"},metrics:{name:"Metrics",helperText:"Add more metrics to collect",placeholder:"Example: code_smells"}}},S=(t,o,c,s,i)=>({...u(t),factDetails:{factName:o??"",statuses:c??T,severities:s,types:i}}),N=(t,o,c)=>({...u(t),factDetails:{factName:o??"",metrics:c??d}}),_=t=>({projects:O(t),projectTags:O(t),issues:{enabled:!1,collectors:[S(t,r,T)]},measures:{enabled:!1,collectors:[N(t,f,d)]}});function R(t){const{projects:o,projectTags:c,issues:s,measures:i}=t;if(o.enabled||c.enabled||s.enabled||i.enabled){const l={},n=[];return l.collects=n,o.enabled&&n.push(m({factType:C,configOption:o})),c.enabled&&n.push(m({factType:E,configOption:c})),s.enabled&&s.collectors.forEach(a=>{n.push(m({factType:r,configOption:a,additionalParams:{factName:a.factDetails.factName,statuses:a.factDetails.statuses?.length?a.factDetails.statuses:void 0,severities:a.factDetails.severities?.length?a.factDetails.severities:void 0,types:a.factDetails.types?.length?a.factDetails.types:void 0}}))}),i.enabled&&i.collectors.forEach(a=>{n.push(m({factType:f,configOption:a,additionalParams:{factName:a.factDetails.factName,metrics:a.factDetails.metrics}}))}),l}return{collects:[]}}function b(t){const o=_(t);if(t){const c=g(t).flatMap(s=>s.collects).filter(s=>s!==void 0);if(c){const s=g(c),i=s.find(e=>e.type===C);i&&(o.projects={...p({parentConfig:t,factTypeConfig:i}),enabled:!0});const l=s.find(e=>e.type===E);l&&(o.projectTags={...p({parentConfig:t,factTypeConfig:l}),enabled:!0});const n=s.filter(e=>e.type===r);n.length&&(o.issues={enabled:!0,collectors:n.map(e=>({...p({parentConfig:t,factTypeConfig:e}),factDetails:{factName:e.factName??r,statuses:e.statuses?.length?e.statuses:void 0,severities:e.severities?.length?e.severities:void 0,types:e.types?.length?e.types:void 0}}))});const a=s.filter(e=>e.type===f);a.length&&(o.measures={enabled:!0,collectors:a.map(e=>({...p({parentConfig:t,factTypeConfig:e}),factDetails:{factName:e.factName??f,metrics:e.metrics}}))})}}return o}export{T as DEFAULT_ISSUE_STATUSES,d as DEFAULT_METRICS,r as ISSUES_COLLECTOR_TYPE,y as ISSUE_SEVERITY_OPTIONS,D as ISSUE_STATUS_OPTIONS,L as ISSUE_TYPE_OPTIONS,f as MEASURES_COLLECTOR_TYPE,C as PROJECTS_COLLECTOR_TYPE,E as PROJECT_TAGS_COLLECTOR_TYPE,I as SONARQUBE_COLLECTOR_FIELDS,_ as defaultSonarQubeConfig,S as issuesCollectorConfig,b as mapConfigToSonarQubeCollectorConfig,R as mapSonarQubeCollectorConfigToConfig,N as measuresCollectorConfig};
2
2
  //# sourceMappingURL=utils.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as p}from"react/jsx-runtime";import{makeStyles as a,useTheme as f}from"@material-ui/core";import s from"../../images/integrations-bui/azure-rgb.svg";import g from"../../images/integrations-bui/azure-wht.svg";import n from"../../images/integrations-bui/bigquery-rgb.svg";import c from"../../images/integrations-bui/bigquery-wht.svg";import u from"../../images/integrations-bui/catalog-rgb.svg";import h from"../../images/integrations-bui/catalog-wht.svg";import b from"../../images/integrations-bui/data-registry-rgb.svg";import d from"../../images/integrations-bui/data-registry-wht.svg";import l from"../../images/integrations-bui/datadog-rgb.svg";import y from"../../images/integrations-bui/datadog-wht.svg";import k from"../../images/integrations-bui/default-logo-rgb.svg";import j from"../../images/integrations-bui/default-logo-wht.svg";import q from"../../images/integrations-bui/github-rgb.svg";import w from"../../images/integrations-bui/github-wht.svg";import x from"../../images/integrations-bui/gitlab-rgb.svg";import I from"../../images/integrations-bui/gitlab-wht.svg";import z from"../../images/integrations-bui/http-rgb.svg";import B from"../../images/integrations-bui/http-wht.svg";import T from"../../images/integrations-bui/jira-rgb.svg";import v from"../../images/integrations-bui/jira-wht.svg";import D from"../../images/integrations-bui/kubernetes-rgb.svg";import F from"../../images/integrations-bui/kubernetes-wht.svg";import L from"../../images/integrations-bui/newrelic-rgb.svg";import M from"../../images/integrations-bui/newrelic-wht.svg";import N from"../../images/integrations-bui/pagerduty-rgb.svg";import S from"../../images/integrations-bui/pagerduty-wht.svg";import U from"../../images/integrations-bui/scm-rgb.svg";import W from"../../images/integrations-bui/scm-wht.svg";import A from"../../images/integrations-bui/sonarqube-rgb.svg";import E from"../../images/integrations-bui/sonarqube-wht.svg";import G from"../../images/integrations-bui/soundcheck-rgb.svg";import H from"../../images/integrations-bui/soundcheck-wht.svg";import O from"../../images/integrations-bui/techinsights-rgb.svg";import Q from"../../images/integrations-bui/techinsights-wht.svg";import{isDarkTheme as R}from"../Charts/chartUtils.esm.js";const _={github:q,gitlab:x,datadog:l,scm:U,pagerduty:N,catalog:u,soundcheck:G,techinsights:O,kubernetes:D,jira:T,sonarqube:A,newrelic:L,bigquery:n,azure:s,http:z,"data-registry":b},C={github:w,gitlab:I,datadog:y,scm:W,pagerduty:S,catalog:h,soundcheck:H,techinsights:Q,kubernetes:F,jira:v,sonarqube:E,newrelic:M,bigquery:c,azure:g,http:B,"data-registry":d},J=a(()=>({image:{objectFit:"contain",color:"white",height:"var(--bui-space-4)",maxWidth:"100%"}})),K=({integrationId:r,noMargin:t})=>{const i=J(),e=f(),m=R(e);let o=m?C[r]:_[r];return o||(o=m?j:k),p("img",{src:o,alt:r,style:t?{marginBottom:0}:{},className:i.image})};export{K as IntegrationLogoBUI};
1
+ import{jsx as p}from"react/jsx-runtime";import{makeStyles as f,useTheme as s}from"@material-ui/core";import g from"../../images/integrations-bui/azure-rgb.svg";import c from"../../images/integrations-bui/azure-wht.svg";import n from"../../images/integrations-bui/bigquery-rgb.svg";import u from"../../images/integrations-bui/bigquery-wht.svg";import h from"../../images/integrations-bui/catalog-rgb.svg";import l from"../../images/integrations-bui/catalog-wht.svg";import b from"../../images/integrations-bui/data-registry-rgb.svg";import d from"../../images/integrations-bui/data-registry-wht.svg";import y from"../../images/integrations-bui/datadog-rgb.svg";import k from"../../images/integrations-bui/datadog-wht.svg";import v from"../../images/integrations-bui/default-logo-rgb.svg";import j from"../../images/integrations-bui/default-logo-wht.svg";import q from"../../images/integrations-bui/github-rgb.svg";import w from"../../images/integrations-bui/github-wht.svg";import x from"../../images/integrations-bui/gitlab-rgb.svg";import z from"../../images/integrations-bui/gitlab-wht.svg";import I from"../../images/integrations-bui/http-rgb.svg";import B from"../../images/integrations-bui/http-wht.svg";import T from"../../images/integrations-bui/jira-rgb.svg";import D from"../../images/integrations-bui/jira-wht.svg";import F from"../../images/integrations-bui/kubernetes-rgb.svg";import L from"../../images/integrations-bui/kubernetes-wht.svg";import M from"../../images/integrations-bui/newrelic-rgb.svg";import S from"../../images/integrations-bui/newrelic-wht.svg";import U from"../../images/integrations-bui/pagerduty-rgb.svg";import W from"../../images/integrations-bui/pagerduty-wht.svg";import A from"../../images/integrations-bui/scm-rgb.svg";import C from"../../images/integrations-bui/scm-wht.svg";import E from"../../images/integrations-bui/sonarqube-rgb.svg";import G from"../../images/integrations-bui/sonarqube-wht.svg";import H from"../../images/integrations-bui/soundcheck-rgb.svg";import K from"../../images/integrations-bui/soundcheck-wht.svg";import N from"../../images/integrations-bui/techinsights-rgb.svg";import O from"../../images/integrations-bui/techinsights-wht.svg";import{isDarkTheme as Q}from"../Charts/chartUtils.esm.js";const R={github:q,gitlab:x,datadog:y,scm:A,pagerduty:U,catalog:h,soundcheck:H,techinsights:N,kubernetes:F,jira:T,sonarqube:E,newrelic:M,bigquery:n,azure:g,http:I,"data-registry":b},Z={github:w,gitlab:z,datadog:k,scm:C,pagerduty:W,catalog:l,soundcheck:K,techinsights:O,kubernetes:L,jira:D,sonarqube:G,newrelic:S,bigquery:u,azure:c,http:B,"data-registry":d},_={small:"var(--bui-space-4)",medium:"var(--bui-space-6)",large:"var(--bui-space-8)"},J=f(()=>({image:{objectFit:"contain",color:"white",height:"var(--bui-space-4)",maxWidth:"100%"}})),P=({integrationId:r,noMargin:t,size:i="small"})=>{const e=J(),a=s(),m=Q(a);let o=m?Z[r]:R[r];return o||(o=m?j:v),p("img",{src:o,alt:r,style:{height:_[i],marginBottom:t?0:void 0},className:e.image})};export{P as IntegrationLogoBUI};
2
2
  //# sourceMappingURL=IntegrationLogoBUI.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as r,Fragment as Y}from"react/jsx-runtime";import{useRouteRef as w}from"@backstage/core-plugin-api";import{usePermission as $}from"@backstage/plugin-permission-react";import{HeaderPage as z,SearchField as O,Container as V,TableRoot as W,TableHeader as J,Column as g,TableBody as K,Row as Q,Flex as X,Text as Z,TooltipTrigger as _,ButtonIcon as ee,Tooltip as te,Box as oe,CellText as P,Button as ie}from"@backstage/ui";import{makeStyles as re}from"@material-ui/core";import{RiInformationLine as ne}from"@remixicon/react";import{soundcheckCollectorUpdatePermission as ae}from"@spotify/backstage-plugin-soundcheck-common";import{sortBy as se,isEmpty as p}from"lodash";import{useState as C,useMemo as x,useEffect as ce,useCallback as de}from"react";import{useNavigate as le}from"react-router-dom";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@backstage/plugin-catalog-react";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{useSearchName as me}from"../../hooks/useSearchName.esm.js";import"react-use/lib/useLocalStorage";import{useSortSearchParams as ge}from"../../hooks/useSortSearchParams.esm.js";import{useGetCollectors as pe}from"../../hooks/collectors/useGetCollectors.esm.js";import{useLCPReporting as ue}from"../../hooks/useLCPReporting.esm.js";import{useLoadTimeReporting as he}from"../../hooks/useLoadTimeReporting.esm.js";import{integrationDetailsRouteRef as fe,integrationEditRouteRef as Ce}from"../../routes.esm.js";import{CustomCell as R}from"../CustomCell/CustomCell.esm.js";import"../EmptyState/EmptyState.esm.js";import{EmptyStateBUI as be}from"../EmptyState/EmptyStateBUI.esm.js";import{LoadingTableSkeleton as Ie}from"../LoadingTableSkeleton/LoadingTableSkeleton.esm.js";import{IntegrationLogoBUI as Se}from"./IntegrationLogoBUI.esm.js";const B=["github","gitlab","scm","pagerduty","datadog","kubernetes","jira","sonarqube","newrelic","bigquery","catalog","azure","http","data-registry"],N=t=>{const s=t.hasUIConfig?"UI":"YAML";return p(t.config)&&p(t.collectionConfigs)?"None":s},L=re(()=>({container:{marginBottom:"var(--bui-space-12)"},button:{boxShadow:"none !important",backgroundColor:"inherit !important"},tooltip:{maxWidth:"50rem",padding:0},scrollBox:{maxHeight:"30rem",overflow:"auto",padding:"0 var(--bui-space-3)"}})),T=({integration:t,hasConfigPage:s})=>{const n=L(),c=w(fe),a=le(),u=w(Ce);return r(Q,{onAction:()=>a(c({integrationId:t.id})),children:[e(R,{children:r(X,{gap:"2",align:"center",children:[e(Se,{integrationId:t.id}),e(Z,{children:t.name??t.id}),t.description&&r(_,{children:[e(ee,{className:n.button,variant:"secondary",icon:e(ne,{}),onClick:()=>a(c({integrationId:t.id}))}),e(te,{className:n.tooltip,children:e(oe,{className:n.scrollBox,children:e("p",{children:t.description})})})]})]})}),e(P,{title:`${String(t.dependentChecks?.length??0)} checks`}),e(P,{title:N(t)}),e(R,{onClick:d=>d.stopPropagation(),children:e(ie,{onClick:()=>a(u({integrationId:t.id})),isDisabled:!s,variant:"tertiary","aria-label":`${t.id} configure`,children:"Configure"})})]})},ye=["name","dependent-checks","config-source"],ke=({integrations:t})=>{const s=L(),{updateSortParams:n,searchParams:c}=ge(),[a,u]=C(""),[d,v]=C(()=>c.get("sortDirection")==="descending"?"descending":"ascending"),[l,D]=C(()=>{const o=c.get("sort");return o&&ye.includes(o)?o:""}),b=x(()=>({routeName:"soundcheck-integrations",additionalAttributes:{integrationsPerPage:t?.length}}),[t?.length]),{reportContentLoaded:I}=he(b),{reporter:U}=ue(b),{loading:H,allowed:A}=$({permission:ae}),{data:E,isLoading:m}=pe(),h=t?.map(o=>o.integrationId)??B,S=me({items:E??[],searchTerm:a}),f=x(()=>{const o=se(S,i=>l==="name"?i.name??i.id:l==="dependent-checks"?i.dependentChecks?.length??0:l==="config-source"?N(i):h.includes(i.id)?1:2);return d==="descending"&&o.reverse(),o},[S,h,l,d]),y=U?.getLCPValue();ce(()=>{m||I({lcp:y})},[m,I,y]);const j=de(({direction:o,column:i})=>{const k=String(i);D(k),v(o),n({sort:k,sortDirection:o})},[n]),F=!m&&!p(f),M=m,q=!m&&p(f),G=e(be,{title:"No integrations found",body:"Your current search term did not return any integrations. Please try a different search term."});return r(Y,{children:[e(z,{customActions:e(O,{value:a,onChange:u,"aria-label":"Search Name"}),title:"Integrations"}),r(V,{className:s.container,children:[M&&e(Ie,{rowCount:10,rowHeight:36}),q&&G,F&&r(W,{onSortChange:j,sortDescriptor:{direction:d,column:l},children:[r(J,{children:[e(g,{id:"name",allowsSorting:!0,isRowHeader:!0,style:{width:"63%"},children:"Name"}),e(g,{id:"dependent-checks",allowsSorting:!0,style:{width:"15%"},children:"Dependent Checks"}),e(g,{id:"config-source",allowsSorting:!0,style:{width:"15%"},children:"Config Source"}),e(g,{style:{width:"7%"}})]}),e(K,{children:f.map(o=>e(T,{integration:o,hasConfigPage:!H&&A&&h.includes(o.id)},o.id))})]})]})]})};export{B as ConfigurableIntegrationIds,T as IntegrationRow,ke as IntegrationsListPageBUI};
1
+ import{jsx as e,jsxs as r,Fragment as M}from"react/jsx-runtime";import{useRouteRef as w}from"@backstage/core-plugin-api";import{usePermission as Y}from"@backstage/plugin-permission-react";import{HeaderPage as $,SearchField as O,Container as V,TableRoot as W,TableHeader as q,Column as g,TableBody as z,Row as J,Flex as K,Text as Q,TooltipTrigger as X,ButtonIcon as Z,Tooltip as _,Box as ee,CellText as y,Button as te}from"@backstage/ui";import{makeStyles as oe}from"@material-ui/core";import{RiInformationLine as ie}from"@remixicon/react";import{soundcheckCollectorUpdatePermission as re}from"@spotify/backstage-plugin-soundcheck-common";import{sortBy as ne,isEmpty as p}from"lodash";import{useState as f,useMemo as P,useEffect as ae,useCallback as se}from"react";import{useNavigate as ce}from"react-router-dom";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@backstage/plugin-catalog-react";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{useSearchName as de}from"../../hooks/useSearchName.esm.js";import"react-use/lib/useLocalStorage";import{useSortSearchParams as le}from"../../hooks/useSortSearchParams.esm.js";import{useGetCollectors as me}from"../../hooks/collectors/useGetCollectors.esm.js";import{useLCPReporting as ge}from"../../hooks/useLCPReporting.esm.js";import{useLoadTimeReporting as pe}from"../../hooks/useLoadTimeReporting.esm.js";import{integrationDetailsRouteRef as he,integrationEditRouteRef as ue}from"../../routes.esm.js";import{CustomCell as x}from"../CustomCell/CustomCell.esm.js";import"../EmptyState/EmptyState.esm.js";import{EmptyStateBUI as fe}from"../EmptyState/EmptyStateBUI.esm.js";import{LoadingTableSkeleton as Ce}from"../LoadingTableSkeleton/LoadingTableSkeleton.esm.js";import{IntegrationLogoBUI as Se}from"./IntegrationLogoBUI.esm.js";const R=t=>{const s=t.hasUIConfig?"UI":"YAML";return p(t.config)&&p(t.collectionConfigs)?"None":s},B=oe(()=>({container:{marginBottom:"var(--bui-space-12)"},button:{boxShadow:"none !important",backgroundColor:"inherit !important"},tooltip:{maxWidth:"50rem",padding:0},scrollBox:{maxHeight:"30rem",overflow:"auto",padding:"0 var(--bui-space-3)"}})),N=({integration:t,hasConfigPage:s})=>{const n=B(),c=w(he),a=ce(),h=w(ue);return r(J,{onAction:()=>a(c({integrationId:t.id})),children:[e(x,{children:r(K,{gap:"2",align:"center",children:[e(Se,{integrationId:t.id}),e(Q,{children:t.name??t.id}),t.description&&r(X,{children:[e(Z,{className:n.button,variant:"secondary",icon:e(ie,{}),onClick:()=>a(c({integrationId:t.id}))}),e(_,{className:n.tooltip,children:e(ee,{className:n.scrollBox,children:e("p",{children:t.description})})})]})]})}),e(y,{title:`${String(t.dependentChecks?.length??0)} checks`}),e(y,{title:R(t)}),e(x,{onClick:d=>d.stopPropagation(),children:e(te,{onClick:()=>a(h({integrationId:t.id})),isDisabled:!s,variant:"tertiary","aria-label":`${t.id} configure`,children:"Configure"})})]})},be=["name","dependent-checks","config-source"],ke=({integrations:t})=>{const s=B(),{updateSortParams:n,searchParams:c}=le(),[a,h]=f(""),[d,T]=f(()=>c.get("sortDirection")==="descending"?"descending":"ascending"),[l,L]=f(()=>{const o=c.get("sort");return o&&be.includes(o)?o:""}),C=P(()=>({routeName:"soundcheck-integrations",additionalAttributes:{integrationsPerPage:t?.length}}),[t?.length]),{reportContentLoaded:S}=pe(C),{reporter:v}=ge(C),{loading:D,allowed:E}=Y({permission:re}),{data:U,isLoading:m}=me(),b=de({items:U??[],searchTerm:a}),u=P(()=>{const o=ne(b,i=>l==="name"?i.name??i.id:l==="dependent-checks"?i.dependentChecks?.length??0:l==="config-source"?R(i):i.isEditable?1:2);return d==="descending"&&o.reverse(),o},[b,l,d]),k=v?.getLCPValue();ae(()=>{m||S({lcp:k})},[m,S,k]);const H=se(({direction:o,column:i})=>{const I=String(i);L(I),T(o),n({sort:I,sortDirection:o})},[n]),A=!m&&!p(u),F=m,j=!m&&p(u),G=e(fe,{title:"No integrations found",body:"Your current search term did not return any integrations. Please try a different search term."});return r(M,{children:[e($,{customActions:e(O,{value:a,onChange:h,"aria-label":"Search Name"}),title:"Integrations"}),r(V,{className:s.container,children:[F&&e(Ce,{rowCount:10,rowHeight:36}),j&&G,A&&r(W,{onSortChange:H,sortDescriptor:{direction:d,column:l},children:[r(q,{children:[e(g,{id:"name",allowsSorting:!0,isRowHeader:!0,style:{width:"63%"},children:"Name"}),e(g,{id:"dependent-checks",allowsSorting:!0,style:{width:"15%"},children:"Dependent Checks"}),e(g,{id:"config-source",allowsSorting:!0,style:{width:"15%"},children:"Config Source"}),e(g,{style:{width:"7%"}})]}),e(z,{children:u.map(o=>e(N,{integration:o,hasConfigPage:!D&&E&&o.isEditable},o.id))})]})]})]})};export{N as IntegrationRow,ke as IntegrationsListPageBUI};
2
2
  //# sourceMappingURL=IntegrationsListPageBUI.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{jsxs as t,Fragment as y,jsx as e}from"react/jsx-runtime";import{useRouteRef as n}from"@backstage/core-plugin-api";import{HeaderPage as b,Container as C,Box as a,Text as o,Flex as i,Card as d,CardBody as m,Link as u}from"@backstage/ui";import{makeStyles as R}from"@material-ui/core/styles";import{RiAddLine as v,RiLayoutGridFill as N}from"@remixicon/react";import{useNavigate as x}from"react-router-dom";import B from"react-use/lib/useLocalStorage";import{trackCreateRouteRef as T,tracksPageRouteRef as w,trackBuilderRouteRef as P}from"../../routes.esm.js";import{PROVIDER_STORAGE_KEY as S}from"../TrackBuilderPage/utils.esm.js";const E=R(()=>({container:{marginBottom:"var(--bui-space-12)"},icon:{width:"64px",height:"64px",background:"var(--bui-bg-neutral-2)",borderRadius:"var(--bui-radius-full)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--bui-fg-success)"},cardBody:{padding:"var(--bui-space-10)"},card:{width:"30%",cursor:"pointer"}})),_=()=>{const r=E(),p=n(T),h=n(w),f=n(P),s=x(),g="Create a custom track or use Spotify templates.",[l]=B(S,null),k=()=>{const c=f();return l?`${c}?step=2&provider=${l}`:c};return t(y,{children:[e(b,{title:"Create New Track",breadcrumbs:[{label:"All Tracks",href:h()}]}),t(C,{className:r.container,children:[e(a,{mb:"8",children:e(o,{color:"secondary",variant:"body-large",children:g})}),t(i,{children:[e(d,{className:r.card,onClick:()=>s(p()),children:t(m,{className:r.cardBody,children:[e(i,{direction:"column",align:"center",mb:"2",children:e(a,{className:r.icon,children:e(v,{size:64})})}),t(i,{direction:"column",align:"center",gap:"1",children:[e(o,{variant:"title-small",children:"Create Custom Track"}),e(o,{color:"secondary",children:"Create a custom track with your own checks. Ensure that checks are created first."}),e(a,{mt:"4",children:e(u,{href:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/tracks#creating-a-custom-track",target:"_blank",rel:"noopener noreferrer",onClick:c=>c.stopPropagation(),children:"Documentation"})})]})]})}),e(d,{className:r.card,onClick:()=>s(k()),children:t(m,{className:r.cardBody,children:[e(i,{direction:"column",align:"center",mb:"2",children:e(a,{className:r.icon,children:e(N,{size:36})})}),t(i,{direction:"column",align:"center",gap:"1",children:[e(o,{variant:"title-small",children:"Use Spotify Templates"}),e(o,{color:"secondary",children:"Ready-to-use tracks and checks recommended by Spotify. You can modify this configuration at any time."}),e(a,{mt:"4",children:e(u,{href:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/tracks#creating-tracks-using-spotify-templates",target:"_blank",rel:"noopener noreferrer",onClick:c=>c.stopPropagation(),children:"Documentation"})})]})]})})]})]})]})};export{_ as CreateNewTrackPage};
2
+ //# sourceMappingURL=CreateNewTrackPage.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as o}from"react/jsx-runtime";import{useRouteRef as s}from"@backstage/core-plugin-api";import{usePermission as n}from"@backstage/plugin-permission-react";import{RiAddLine as m}from"@remixicon/react";import{soundcheckTrackCreatePermission as p}from"@spotify/backstage-plugin-soundcheck-common";import{useNavigate as d}from"react-router-dom";import{trackCreateRouteRef as u}from"../../routes.esm.js";import{EmptyStateBUI as f}from"./EmptyStateBUI.esm.js";const k=({title:r})=>{const e=s(u),a=d(),{loading:i,allowed:c}=n({permission:p}),t=!i&&c;return o(f,{title:r??(t?"Create your first track":"No tracks found"),body:"Tracks encourage alignment to architectural best practices and standards.",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/tracks/",actionButtonIcon:o(m,{}),actionOnClick:t?()=>a(e()):()=>{},actionText:"Create a track",actionDisabled:!t})};export{k as EmptyStateNoTracks};
1
+ import{jsx as o}from"react/jsx-runtime";import{useRouteRef as s}from"@backstage/core-plugin-api";import{usePermission as n}from"@backstage/plugin-permission-react";import{RiAddLine as m}from"@remixicon/react";import{soundcheckTrackCreatePermission as p}from"@spotify/backstage-plugin-soundcheck-common";import{useNavigate as d}from"react-router-dom";import{newTrackRouteRef as u}from"../../routes.esm.js";import{EmptyStateBUI as f}from"./EmptyStateBUI.esm.js";const k=({title:r})=>{const e=s(u),a=d(),{loading:i,allowed:c}=n({permission:p}),t=!i&&c;return o(f,{title:r??(t?"Create your first track":"No tracks found"),body:"Tracks encourage alignment to architectural best practices and standards.",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/tracks/",actionButtonIcon:o(m,{}),actionOnClick:t?()=>a(e()):()=>{},actionText:"Create a track",actionDisabled:!t})};export{k as EmptyStateNoTracks};
2
2
  //# sourceMappingURL=EmptyStateNoTracks.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as a,Fragment as v}from"react/jsx-runtime";import{stringifyEntityRef as ee}from"@backstage/catalog-model";import{makeStyles as te,Box as o,Typography as n,TextField as ae,Button as W}from"@material-ui/core";import{Alert as ie}from"@material-ui/lab";import{parseFactRef as oe}from"@spotify/backstage-plugin-soundcheck-common";import ne from"lodash";import{useMemo as g,useState as F,useEffect as re,useCallback as le}from"react";import{useGetEntityRefs as ce}from"../../hooks/catalog/useGetEntityRefs.esm.js";import{useGetLimitedEntityRefs as se}from"../../hooks/catalog/useGetLimitedEntityRefs.esm.js";import{useGetCollectors as de}from"../../hooks/collectors/useGetCollectors.esm.js";import{useGetFactSchema as he}from"../../hooks/collectors/useGetFactSchema.esm.js";import{useGetFact as pe}from"../../hooks/useGetFact.esm.js";import{useGetPathResolvers as me}from"../../hooks/useGetPathResolvers.esm.js";import{generateJsonPaths as fe}from"../CheckForm/utils/checkFormUtils.esm.js";import{hasLogo as ue,CollectorLogo as ve}from"../CollectorsPage/CollectorListPage/CollectorLogo.esm.js";import{ExpandableSection as G}from"../ExpandableSection/ExpandableSection.esm.js";import{mapFiltersToCatalogFilter as ge}from"../Filter/utils.esm.js";import"../Filter/FilterComponent.esm.js";import{emptyFilters as ye}from"../Filter/types.esm.js";import{FormattedPreview as w}from"../FormattedPreview/FormattedPreview.esm.js";import"../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import"@material-ui/icons/CheckBox";import"@material-ui/icons/CheckBoxOutlineBlank";import"react-hook-form";import"../ListboxVirtualized/ListboxVirtualized.esm.js";import{useLabelOptions as be}from"../FormControlledAutocomplete/useLabelOptions.esm.js";import{ControlledAutocomplete as y}from"../FormControlledAutocomplete/ControlledAutocomplete.esm.js";import{LoadingIndicator as Se}from"../LoadingIndicator/LoadingIndicator.esm.js";import{useFactOptions as Fe}from"./useFactOptions.esm.js";const Ne=800,Re=te(t=>({content:{padding:t.spacing(2,3),width:Ne},section:{margin:t.spacing(2,0)},expandedSection:{borderTop:`1px solid ${t.palette.divider}`,padding:t.spacing(0,2)},loading:{margin:t.spacing(2)},preview:{maxHeight:500,overflow:"auto",border:`1px solid ${t.palette.divider}`},pathSection:{display:"flex",alignItems:"center",margin:t.spacing(1,0)},testPathButton:{margin:t.spacing(1,1,.5,0)},collectorName:{fontSize:24}})),xe=t=>{const p=!t?.length||t.every(h=>Object.values(h).every(N=>!N?.length))?[{...ye(),selectedKinds:["Component","System"]}]:t;return ge(p)},Ee=({factRef:t,updateFactRef:p,path:h,updatePath:N,entityRef:m,updateEntityRef:k,pathResolver:s,filters:R,onSave:P,hidePath:O})=>{const i=Re(),d=g(()=>{if(t)try{return oe(t)}catch{return}},[t]),[x,j]=F(d?.source??null);re(()=>{d?.source&&j(d.source)},[d?.source]);const[b,V]=F("jsonpath"),[E,B]=F(),[C,M]=F(),{data:I}=me(),A=g(()=>I?.map(r=>r.id)??[],[I]),{data:f}=he(d?.source,d?.name,!0),D=g(()=>f?fe(f.schema):[],[f]),{data:L,isLoading:J}=de(),$=L?.map(r=>r.id)?.sort()??[],S=!R?.length||R.every(r=>Object.values(r).every(Z=>!Z?.length)),{data:z,isLoading:H}=ce(xe(R),1e3,!S),K=z?.items.map(r=>ee(r)),{entityRefs:U,allLoading:q}=se(500,S),l=g(()=>L?.find(r=>r.id===x),[L,x]),{factOptions:Q}=Fe({selectedCollector:l}),{options:X,getOptionLabel:T}=be(Q),{data:c,isLoading:u}=pe({factRef:t||"",entityRef:C||"",path:E,pathResolver:s??b??void 0},!!t&&!!C),Y=le(()=>{B(h),M(m)},[m,h]),_=g(()=>!!l?.config?.cache,[l]);return e(o,{className:i.content,"data-testid":"fact-explorer",children:a(o,{children:[a(o,{children:[e(n,{variant:"subtitle1",children:"Select an Integration"}),e(y,{options:$,onChange:r=>{j(r),p("")},value:x,placeholder:"Integration",disabled:J,fullWidth:!0,freeSolo:!0})]}),!l&&e(v,{children:a(o,{children:[e(n,{variant:"subtitle1",children:"Enter a Fact Ref Directly"}),e(ae,{value:t,onChange:r=>p(r.currentTarget.value),variant:"outlined",margin:"dense",placeholder:"Enter the full fact ref, i.e. custom:default/custom-fact",fullWidth:!0})]})}),!!l&&e(v,{children:a(o,{className:i.section,children:[ue(l.id)?e(ve,{noMargin:!0,collectorId:l.id}):a(n,{variant:"h5",className:i.collectorName,component:"div",children:[l.name??l.id," "]}),!!l.description&&e(n,{variant:"body2",children:l.description}),e(y,{options:X,onChange:p,value:t??null,placeholder:"Select Fact",getOptionLabel:T,noOptionsText:"No Facts",fullWidth:!0})]})}),!!t&&!!d&&a(v,{children:[!!f?.schema&&e(o,{className:i.section,children:e(G,{elevation:1,title:"JSON Schema",children:e("div",{className:i.preview,children:e(w,{data:f.schema})})})}),!O&&a(v,{children:[a(o,{className:i.section,children:[e(n,{variant:"subtitle1",children:"Path Resolver"}),!s&&e(n,{variant:"caption",children:"Defaults to jsonpath"}),s?e(n,{variant:"body1",children:s}):e(y,{options:A,onChange:V,value:s??b,placeholder:"Path Resolver (Optional)",getOptionLabel:T,fullWidth:!0,disabled:!!s,freeSolo:!0})]}),a(o,{className:i.section,children:[e(n,{variant:"subtitle1",children:"Path"}),e(y,{options:(s??b)==="jsonpath"?D:[],onChange:r=>{E&&B(void 0),N(r)},value:h??null,placeholder:"Path",fullWidth:!0,freeSolo:!0}),e("div",{className:i.pathSection,children:!!P&&e(W,{className:i.testPathButton,variant:"contained",onClick:()=>P({factRef:t,path:h??"",pathResolver:b??s??""}),disabled:!h,color:"primary",children:"Save"})})]})]})]}),!!t&&!!d&&e(G,{alwaysExpanded:O,elevation:0,title:"Sample Fact and Test Path",children:a(o,{className:i.expandedSection,children:[a(o,{marginBottom:1,children:[e(n,{variant:"subtitle1",children:"Select an Entity"}),a(n,{variant:"caption",children:["Fact will be sampled from this entity.",e("br",{}),"If you don't see the entity in the drop-down list, you can type its reference in the format ","<kind>:<namespace>/<name>","."]}),e(y,{options:S?U??[]:K??[],onChange:k,value:m??null,placeholder:"Entity Selection",isLoading:S?q:H,freeSolo:!0,fullWidth:!0})]}),e(o,{children:e(W,{className:i.testPathButton,variant:"contained",onClick:Y,disabled:!m,color:"primary",children:"Sample Fact"})}),a(v,{children:[!!E&&!u&&a(o,{className:i.section,children:[e(n,{variant:"subtitle1",children:"Resolved Value"}),c?.resolvedValue!==null&&c?.resolvedValue!==void 0?e(o,{className:i.preview,children:e(w,{data:c?.resolvedValue})}):e(n,{color:"textSecondary",variant:"body2",children:"Could not resolve path"})]}),!!C&&a(o,{className:i.section,children:[e(n,{variant:"subtitle1",children:"Fact Data"}),_&&e(n,{variant:"caption",children:"Uses cache when available."}),!!u&&e("div",{className:i.loading,children:e(Se,{})}),!u&&!!c?.fact&&e(o,{className:i.preview,children:c?.fact?.sensitive&&ne.isEmpty(c?.fact?.data)?e(o,{children:e(ie,{severity:"info",children:"The associated fact contains potentially sensitive information and has been redacted."})}):e(w,{data:c?.fact?.data})}),!u&&!!c?.collectionError&&a(n,{color:"textSecondary",variant:"body2",children:["Failed to collect:"," ",c?.collectionError?.errorMessage]}),!u&&!c?.fact&&!c?.collectionError&&a(n,{color:"textSecondary",variant:"body2",children:["Fact ",t," unavailable for entity ",m]})]})]})]})})]})})};export{Ee as FactExplorer};
1
+ import{jsx as e,jsxs as a,Fragment as v}from"react/jsx-runtime";import{stringifyEntityRef as ee}from"@backstage/catalog-model";import{makeStyles as te,Box as o,Typography as r,TextField as ae,Button as W}from"@material-ui/core";import{Alert as ie}from"@material-ui/lab";import{parseFactRef as oe}from"@spotify/backstage-plugin-soundcheck-common";import re from"lodash";import{useMemo as g,useState as F,useEffect as ne,useCallback as le}from"react";import{useGetEntityRefs as ce}from"../../hooks/catalog/useGetEntityRefs.esm.js";import{useGetLimitedEntityRefs as se}from"../../hooks/catalog/useGetLimitedEntityRefs.esm.js";import{useGetCollectors as de}from"../../hooks/collectors/useGetCollectors.esm.js";import{useGetFactSchema as he}from"../../hooks/collectors/useGetFactSchema.esm.js";import{useGetFact as pe}from"../../hooks/useGetFact.esm.js";import{useGetPathResolvers as me}from"../../hooks/useGetPathResolvers.esm.js";import{generateJsonPaths as fe}from"../CheckForm/utils/checkFormUtils.esm.js";import{hasLogo as ue,CollectorLogo as ve}from"../CollectorsPage/CollectorListPage/CollectorLogo.esm.js";import{ExpandableSection as G}from"../ExpandableSection/ExpandableSection.esm.js";import{mapFiltersToCatalogFilter as ge}from"../Filter/utils.esm.js";import"../Filter/FilterComponent.esm.js";import{emptyFilters as ye}from"../Filter/types.esm.js";import{FormattedPreview as w}from"../FormattedPreview/FormattedPreview.esm.js";import"../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import"@material-ui/icons/CheckBox";import"@material-ui/icons/CheckBoxOutlineBlank";import"react-hook-form";import"../ListboxVirtualized/ListboxVirtualized.esm.js";import{useLabelOptions as be}from"../FormControlledAutocomplete/useLabelOptions.esm.js";import{ControlledAutocomplete as y}from"../FormControlledAutocomplete/ControlledAutocomplete.esm.js";import{LoadingIndicator as Se}from"../LoadingIndicator/LoadingIndicator.esm.js";import{useFactOptions as Fe}from"./useFactOptions.esm.js";const Ne=800,Re=te(t=>({content:{padding:t.spacing(2,3),width:Ne},section:{margin:t.spacing(2,0)},expandedSection:{borderTop:`1px solid ${t.palette.divider}`,padding:t.spacing(0,2)},loading:{margin:t.spacing(2)},preview:{maxHeight:500,overflow:"auto",border:`1px solid ${t.palette.divider}`},pathSection:{display:"flex",alignItems:"center",margin:t.spacing(1,0)},testPathButton:{margin:t.spacing(1,1,.5,0)},collectorName:{fontSize:24}})),xe=t=>{const p=!t?.length||t.every(h=>Object.values(h).every(N=>!N?.length))?[{...ye(),selectedKinds:["Component","System"]}]:t;return ge(p)},Ee=({factRef:t,updateFactRef:p,path:h,updatePath:N,entityRef:m,updateEntityRef:k,pathResolver:s,filters:R,onSave:P,hidePath:O})=>{const i=Re(),d=g(()=>{if(t)try{return oe(t)}catch{return}},[t]),[x,j]=F(d?.source??null);ne(()=>{d?.source&&j(d.source)},[d?.source]);const[b,V]=F("jsonpath"),[E,B]=F(),[C,M]=F(),{data:I}=me(),A=g(()=>I?.map(n=>n.id)??[],[I]),{data:f}=he(d?.source,d?.name,!0),D=g(()=>f?fe(f.schema):[],[f]),{data:L,isLoading:J}=de(),$=L?.map(n=>n.id)?.sort()??[],S=!R?.length||R.every(n=>Object.values(n).every(Z=>!Z?.length)),{data:z,isLoading:H}=ce(xe(R),1e3,!S),K=z?.items.map(n=>ee(n)),{entityRefs:U,allLoading:q}=se(500,S),l=g(()=>L?.find(n=>n.id===x),[L,x]),{factOptions:Q}=Fe({selectedCollector:l}),{options:X,getOptionLabel:T}=be(Q),{data:c,isLoading:u}=pe({factRef:t||"",entityRef:C||"",path:E,pathResolver:s??b??void 0,refresh:!0},!!t&&!!C),Y=le(()=>{B(h),M(m)},[m,h]),_=g(()=>!!l?.config?.cache,[l]);return e(o,{className:i.content,"data-testid":"fact-explorer",children:a(o,{children:[a(o,{children:[e(r,{variant:"subtitle1",children:"Select an Integration"}),e(y,{options:$,onChange:n=>{j(n),p("")},value:x,placeholder:"Integration",disabled:J,fullWidth:!0,freeSolo:!0})]}),!l&&e(v,{children:a(o,{children:[e(r,{variant:"subtitle1",children:"Enter a Fact Ref Directly"}),e(ae,{value:t,onChange:n=>p(n.currentTarget.value),variant:"outlined",margin:"dense",placeholder:"Enter the full fact ref, i.e. custom:default/custom-fact",fullWidth:!0})]})}),!!l&&e(v,{children:a(o,{className:i.section,children:[ue(l.id)?e(ve,{noMargin:!0,collectorId:l.id}):a(r,{variant:"h5",className:i.collectorName,component:"div",children:[l.name??l.id," "]}),!!l.description&&e(r,{variant:"body2",children:l.description}),e(y,{options:X,onChange:p,value:t??null,placeholder:"Select Fact",getOptionLabel:T,noOptionsText:"No Facts",fullWidth:!0})]})}),!!t&&!!d&&a(v,{children:[!!f?.schema&&e(o,{className:i.section,children:e(G,{elevation:1,title:"JSON Schema",children:e("div",{className:i.preview,children:e(w,{data:f.schema})})})}),!O&&a(v,{children:[a(o,{className:i.section,children:[e(r,{variant:"subtitle1",children:"Path Resolver"}),!s&&e(r,{variant:"caption",children:"Defaults to jsonpath"}),s?e(r,{variant:"body1",children:s}):e(y,{options:A,onChange:V,value:s??b,placeholder:"Path Resolver (Optional)",getOptionLabel:T,fullWidth:!0,disabled:!!s,freeSolo:!0})]}),a(o,{className:i.section,children:[e(r,{variant:"subtitle1",children:"Path"}),e(y,{options:(s??b)==="jsonpath"?D:[],onChange:n=>{E&&B(void 0),N(n)},value:h??null,placeholder:"Path",fullWidth:!0,freeSolo:!0}),e("div",{className:i.pathSection,children:!!P&&e(W,{className:i.testPathButton,variant:"contained",onClick:()=>P({factRef:t,path:h??"",pathResolver:b??s??""}),disabled:!h,color:"primary",children:"Save"})})]})]})]}),!!t&&!!d&&e(G,{alwaysExpanded:O,elevation:0,title:"Sample Fact and Test Path",children:a(o,{className:i.expandedSection,children:[a(o,{marginBottom:1,children:[e(r,{variant:"subtitle1",children:"Select an Entity"}),a(r,{variant:"caption",children:["Fact will be sampled from this entity.",e("br",{}),"If you don't see the entity in the drop-down list, you can type its reference in the format ","<kind>:<namespace>/<name>","."]}),e(y,{options:S?U??[]:K??[],onChange:k,value:m??null,placeholder:"Entity Selection",isLoading:S?q:H,freeSolo:!0,fullWidth:!0})]}),e(o,{children:e(W,{className:i.testPathButton,variant:"contained",onClick:Y,disabled:!m,color:"primary",children:"Sample Fact"})}),a(v,{children:[!!E&&!u&&a(o,{className:i.section,children:[e(r,{variant:"subtitle1",children:"Resolved Value"}),c?.resolvedValue!==null&&c?.resolvedValue!==void 0?e(o,{className:i.preview,children:e(w,{data:c?.resolvedValue})}):e(r,{color:"textSecondary",variant:"body2",children:"Could not resolve path"})]}),!!C&&a(o,{className:i.section,children:[e(r,{variant:"subtitle1",children:"Fact Data"}),_&&e(r,{variant:"caption",children:"Uses cache when available."}),!!u&&e("div",{className:i.loading,children:e(Se,{})}),!u&&!!c?.fact&&e(o,{className:i.preview,children:c?.fact?.sensitive&&re.isEmpty(c?.fact?.data)?e(o,{children:e(ie,{severity:"info",children:"The associated fact contains potentially sensitive information and has been redacted."})}):e(w,{data:c?.fact?.data})}),!u&&!!c?.collectionError&&a(r,{color:"textSecondary",variant:"body2",children:["Failed to collect:"," ",c?.collectionError?.errorMessage]}),!u&&!c?.fact&&!c?.collectionError&&a(r,{color:"textSecondary",variant:"body2",children:["Fact ",t," unavailable for entity ",m]})]})]})]})})]})})};export{Ee as FactExplorer};
2
2
  //# sourceMappingURL=FactExplorer.esm.js.map
@@ -1,2 +1,2 @@
1
- import{isEqual as g}from"lodash";import{useMemo as y,useCallback as F,useState as u,useEffect as O}from"react";import{useSearchParams as P}from"react-router-dom";const v=()=>{const[t,S]=P(),a=y(()=>t.getAll("owners"),[t]),l=y(()=>t.getAll("lifecycles"),[t]),c=y(()=>t.getAll("types"),[t]),r=y(()=>t.getAll("systems"),[t]),i=y(()=>t.getAll("certificationStatuses"),[t]),m=F(()=>a.map(e=>({label:e,value:e})),[a]),[n,h]=u(l),[o,w]=u(m()),[d,E]=u(c),[f,A]=u(r),[p,C]=u(i);O(()=>{w(m()),h(l??[]),E(c??[]),A(r??[]),C(i??[])},[a,l,c,r,m,i]);const b=y(()=>{const e={owners:!g(o,a??[]),lifecycles:!g(n,l??[]),types:!g(d,c??[]),systems:!g(f,r??[]),certificationStatus:!g(p,i??[])};return Object.values(e).some(Boolean)},[o,a,n,l,d,c,f,r,p,i]),L=F(()=>{const e=new URLSearchParams(t);e.delete("lifecycles"),e.delete("owners"),e.delete("types"),e.delete("systems"),e.delete("certificationStatuses"),n.length>0&&n.forEach(s=>e.append("lifecycles",s)),o.length>0&&o.forEach(({value:s})=>e.append("owners",s)),d.length>0&&d.forEach(s=>e.append("types",s)),f.length>0&&f.forEach(s=>e.append("systems",s)),p.length>0&&p.forEach(s=>e.append("certificationStatuses",s)),S(e)},[t,n,o,d,f,p,S]);return{handleClearFilters:F(()=>{h([]),w([]),E([]),A([]),C([]);const e=new URLSearchParams(t);e.delete("lifecycles"),e.delete("owners"),e.delete("types"),e.delete("systems"),e.delete("certificationStatuses"),S(e)},[t,S]),handleApplyFilters:L,hasFilterChanges:b,stagedTypes:d,stagedLifecycles:n,stagedSystems:f,stagedOwners:o,stagedCertificationStatuses:p,setStagedTypes:E,setStagedLifecycles:h,setStagedOwners:w,setStagedSystems:A,setStagedCertificationStatuses:C,owners:a,lifecycles:l,types:c,systems:r,certificationStatuses:i}};export{v as useTrackFilterSidebar};
1
+ import{isEqual as m}from"lodash";import{useMemo as y,useCallback as P,useState as S,useEffect as v}from"react";import{useSearchParams as T}from"react-router-dom";import{getSearchParamValues as u}from"./util.esm.js";const k=()=>{const[t,h]=T(),a=y(()=>u(t,"owners"),[t]),c=y(()=>u(t,"lifecycles"),[t]),r=y(()=>u(t,"types"),[t]),l=y(()=>u(t,"systems"),[t]),i=y(()=>u(t,"certificationStatuses"),[t]),g=P(()=>a.map(e=>({label:e,value:e})),[a]),[n,w]=S(c),[o,E]=S(g()),[d,C]=S(r),[f,b]=S(l),[p,L]=S(i);v(()=>{E(g()),w(c??[]),C(r??[]),b(l??[]),L(i??[])},[a,c,r,l,g,i]);const F=y(()=>{const e={owners:!m(o,a??[]),lifecycles:!m(n,c??[]),types:!m(d,r??[]),systems:!m(f,l??[]),certificationStatus:!m(p,i??[])};return Object.values(e).some(Boolean)},[o,a,n,c,d,r,f,l,p,i]),O=P(()=>{const e=new URLSearchParams(t);e.delete("lifecycles"),e.delete("owners"),e.delete("types"),e.delete("systems"),e.delete("certificationStatuses"),n.length>0&&n.forEach(s=>e.append("lifecycles",s)),o.length>0&&o.forEach(({value:s})=>e.append("owners",s)),d.length>0&&d.forEach(s=>e.append("types",s)),f.length>0&&f.forEach(s=>e.append("systems",s)),p.length>0&&p.forEach(s=>e.append("certificationStatuses",s)),h(e)},[t,n,o,d,f,p,h]);return{handleClearFilters:P(()=>{w([]),E([]),C([]),b([]),L([]);const e=new URLSearchParams(t);e.delete("lifecycles"),e.delete("owners"),e.delete("types"),e.delete("systems"),e.delete("certificationStatuses"),h(e)},[t,h]),handleApplyFilters:O,hasFilterChanges:F,stagedTypes:d,stagedLifecycles:n,stagedSystems:f,stagedOwners:o,stagedCertificationStatuses:p,setStagedTypes:C,setStagedLifecycles:w,setStagedOwners:E,setStagedSystems:b,setStagedCertificationStatuses:L,owners:a,lifecycles:c,types:r,systems:l,certificationStatuses:i}};export{k as useTrackFilterSidebar};
2
2
  //# sourceMappingURL=useTrackFilterSidebar.esm.js.map
@@ -1,2 +1,2 @@
1
- import{TrackCertificationState as e}from"../../graphql/generated/index.esm.js";const a=d=>{const{lifecycles:t,owners:o,types:i,systems:s}=d,r=t?.length?{"spec.lifecycle":t}:void 0,l=o?.length?{"relations.ownedBy":o}:void 0,n=i?.length?{"spec.type":i}:void 0,c=s?.length?{"relations.partOf":s}:void 0;if(r||l||n||c)return{...r,...l,...n,...c}},p={Passed:e.Passed,Failed:e.Failed,"Not Reported":e.NotReported};export{p as CERTIFICATION_STATUS_MAP,a as toFilter};
1
+ import{TrackCertificationState as l}from"../../graphql/generated/index.esm.js";const p=o=>{const{lifecycles:t,owners:e,types:i,systems:a}=o,s=t?.length?{"spec.lifecycle":t}:void 0,r=e?.length?{"relations.ownedBy":e}:void 0,n=i?.length?{"spec.type":i}:void 0,c=a?.length?{"relations.partOf":a}:void 0;if(s||r||n||c)return{...s,...r,...n,...c}},d={Passed:l.Passed,Failed:l.Failed,"Not Reported":l.NotReported},f=(o,t)=>o.getAll(t).flatMap(e=>e.split(",")).map(e=>e.trim()).filter(Boolean);export{d as CERTIFICATION_STATUS_MAP,f as getSearchParamValues,p as toFilter};
2
2
  //# sourceMappingURL=util.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as d}from"react/jsx-runtime";import{makeStyles as W,TextField as k}from"@material-ui/core";import{Autocomplete as w}from"@material-ui/lab";import{useCallback as A}from"react";import{Controller as M}from"react-hook-form";import{ListboxVirtualized as N}from"../ListboxVirtualized/ListboxVirtualized.esm.js";const f=W(o=>({clearIndicator:{marginRight:o.spacing(1)},helperText:{marginLeft:0},noMargin:{margin:0}})),V=({name:o,rules:h,label:b,control:x,options:a,filterOptions:C,getOptionLabel:S,getOptionValue:r,getOptionSelected:v,onChange:m,disabled:O,placeholder:L,freeSolo:T=!0,width:c,helperText:I,disableClearable:y,fullWidth:u})=>{const i=f(),F=A(l=>a.find(s=>s.value===l)||l,[a]);return d(M,{name:o,control:x,rules:h,render:({field:l,fieldState:n})=>{const s=F(l.value);return d(w,{...l,value:s,freeSolo:T,autoSelect:!0,"data-testid":`${o}-autocomplete`,style:c?{width:c}:{minWidth:u?void 0:250},disabled:O,options:a,getOptionLabel:S,getOptionSelected:v,classes:{clearIndicator:i.clearIndicator},disableClearable:y,fullWidth:u,filterOptions:C,onChange:(p,e)=>{let t=null;e===null?t=null:typeof e=="string"?t=e:t=e.value;const g=r?r(t):t;m?.(g),l.onChange(g)},onInputChange:(p,e)=>{const t=r?r(e):e;m?.(t)},renderInput:p=>d(k,{...p,variant:"outlined",label:b,error:n.invalid,placeholder:L,FormHelperTextProps:{className:i.helperText},margin:"dense",className:i.noMargin,helperText:I??(n.error?n.error.message:null)}),ListboxComponent:N})}})};export{V as FormControlledAutocomplete,f as useStyles};
1
+ import{jsx as d}from"react/jsx-runtime";import{makeStyles as W,TextField as k}from"@material-ui/core";import{Autocomplete as w}from"@material-ui/lab";import{useCallback as A}from"react";import{Controller as M}from"react-hook-form";import{ListboxVirtualized as N}from"../ListboxVirtualized/ListboxVirtualized.esm.js";const f=W(o=>({clearIndicator:{marginRight:o.spacing(1)},helperText:{marginLeft:0},noMargin:{margin:0}})),V=({name:o,rules:h,label:b,control:x,options:a,filterOptions:C,getOptionLabel:v,getOptionValue:r,getOptionSelected:O,onChange:m,disabled:S,placeholder:L,freeSolo:T=!0,width:c,helperText:I,disableClearable:y,fullWidth:u})=>{const i=f(),F=A(l=>a.find(s=>s.value===l)||l,[a]);return d(M,{name:o,control:x,rules:h,render:({field:l,fieldState:n})=>{const s=F(l.value);return d(w,{...l,value:s,freeSolo:T,"data-testid":`${o}-autocomplete`,style:c?{width:c}:{minWidth:u?void 0:250},disabled:S,options:a,getOptionLabel:v,getOptionSelected:O,classes:{clearIndicator:i.clearIndicator},disableClearable:y,fullWidth:u,filterOptions:C,onChange:(p,e)=>{let t=null;e===null?t=null:typeof e=="string"?t=e:t=e.value;const g=r?r(t):t;m?.(g),l.onChange(g)},onInputChange:(p,e)=>{const t=r?r(e):e;m?.(t)},renderInput:p=>d(k,{...p,variant:"outlined",label:b,error:n.invalid,placeholder:L,FormHelperTextProps:{className:i.helperText},margin:"dense",className:i.noMargin,helperText:I??(n.error?n.error.message:null)}),ListboxComponent:N})}})};export{V as FormControlledAutocomplete,f as useStyles};
2
2
  //# sourceMappingURL=FormControlledAutocomplete.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as r,jsx as e,Fragment as D}from"react/jsx-runtime";import{useApi as F}from"@backstage/core-plugin-api";import{entityPresentationApiRef as M,useEntityPresentation as O}from"@backstage/plugin-catalog-react";import{Button as w,Flex as p,TextField as I,ButtonIcon as U,Box as y,Card as $,Text as l,Skeleton as G,TagGroup as A}from"@backstage/ui";import{makeStyles as q}from"@material-ui/core";import{RiUserLine as z,RiSearchLine as J,RiHistoryLine as K}from"@remixicon/react";import{sortBy as N,isEmpty as C,uniq as H}from"lodash";import{useState as k,useCallback as Q,useMemo as S}from"react";import{DialogTrigger as V,Popover as W,Dialog as X}from"react-aria-components";import{useGroupHierarchy as Y}from"../../hooks/heirarchy/useGroupHierarchy.esm.js";import{getAllOwnedEntityCount as Z}from"../../utils/getAllOwnedEntityCount.esm.js";import{GroupSelectionHistory as _}from"./GroupSelectionHistory.esm.js";import{GroupSelectList as ee}from"./GroupSelectList.esm.js";import{GroupTag as P}from"./GroupTag.esm.js";import{useGroupHistory as re}from"./useGroupHistory.esm.js";import{usePreviousSelectedGroups as ie}from"./usePreviousSelectedGroups.esm.js";const E=q(()=>({dialog:{padding:"var(--bui-space-3)",backgroundColor:"var(--bui-bg-surface-1)",border:"1px solid var(--bui-border)",borderRadius:"var(--bui-radius-2)"},buttonArea:{marginTop:"var(--bui-space-2)"},selectedCard:{padding:"var(--bui-space-3)",gap:"var(--bui-space-2)",width:"36rem",margin:"var(--bui-space-3) 0"},relatedGroups:{marginTop:"var(--bui-space-2)"},tagArea:{height:"8rem",width:"16rem",overflow:"auto"}})),oe=({groupRef:o,onSelect:b})=>{const d=E(),{primaryTitle:i,secondaryTitle:f}=O(o),{isLoading:n,data:v}=Y(o,{includeParent:!0}),t=v?.[o],m=S(()=>Z(t),[t]),h=S(()=>{const a=t?.children??{};return N(Object.values(a).map(c=>({ref:c.entityRef,type:c.type})),"ref")},[t?.children]),u=S(()=>C(h)?[]:H(h.map(a=>a.ref)),[h]),g=S(()=>C(t?.parents)?[]:N(H(t.parents),a=>a),[t?.parents]);return r(y,{children:[r($,{className:d.selectedCard,children:[e(l,{variant:"body-medium",color:"secondary",children:"Currently Selected"}),r(p,{direction:"column",gap:"0",children:[e(l,{variant:"body-large",weight:"bold",children:i}),e(l,{variant:"body-medium",color:"secondary",children:f})]}),r(p,{gap:"0",direction:"column",children:[r(p,{gap:"1",align:"center",children:[r(l,{variant:"body-medium",children:[i," directly owns:"]}),n?e(G,{height:"1rem"}):r(l,{variant:"body-medium",color:"secondary",children:[u.length," ",u.length===1?"entity":"entities"]})]}),r(p,{gap:"1",align:"center",children:[r(l,{variant:"body-medium",children:[i," and it's subgroups owns:"]}),n?e(G,{height:"1rem"}):r(l,{variant:"body-medium",color:"secondary",children:[m," ",m===1?"entity":"entities"]})]})]})]}),r(p,{className:d.relatedGroups,children:[r(y,{style:{flex:1},children:[e(l,{color:"secondary",children:"Parent Groups"}),r(y,{className:d.tagArea,children:[n&&e(G,{width:"10rem"}),!n&&C(g)?e(l,{variant:"body-small",children:"No parent groups."}):e(A,{selectionMode:"single","aria-label":"Parent Groups",children:g.map(a=>e(P,{groupRef:a,handleClick:c=>b(c,o)},`${a}-parent`))})]})]}),r(y,{style:{flex:1},children:[e(l,{color:"secondary",children:"Child Groups"}),r(y,{className:d.tagArea,children:[n&&e(G,{width:"10rem"}),!n&&C(u)?e(l,{variant:"body-small",children:"No child groups."}):e(A,{selectionMode:"single","aria-label":"Child Groups",children:u.map(a=>e(P,{groupRef:a,handleClick:c=>b(c,void 0,o)},`${a}-child`))})]})]})]})]})},te=({selectedGroupRef:o,updateGroupRef:b})=>{const d=E(),[i,f]=k(o),[n,v]=k(""),[t,m]=k(!1),h=F(M),u=o?h.forEntity(o).snapshot.primaryTitle:void 0,{addGroupHistory:g,history:a}=re(),{addGroup:c,groupEntityRefs:B}=ie(),R=Q((s,x,T)=>{f(s),v(""),g(s,x,T)},[g]),L=!t&&(!i||n),j=!t&&i&&!n;return r(V,{onOpenChange:s=>{s&&o&&o!==i&&f(o),t&&m(!1)},children:[e(w,{variant:"secondary",iconStart:e(z,{}),children:u??"Select Group"}),e(W,{placement:"bottom right",children:e(X,{className:d.dialog,children:({close:s})=>{const x=()=>{i&&i!==o&&(b(i),c(i)),s()};return r(D,{children:[r(p,{align:"center",gap:"2",children:[e(I,{placeholder:"Search Groups",value:n,onChange:v,size:"small",icon:e(J,{}),"aria-label":"Search Groups",style:{flex:"1"}}),e(U,{"aria-label":"Show History",variant:"secondary",icon:e(K,{}),onClick:()=>m(!t)})]}),t&&e(_,{previouslySelectedGroups:B??[],history:a??[],selectRef:T=>{R(T),m(!1)}}),L&&e(ee,{searchTerm:n,selectedRef:i,selectRef:R}),j&&e(oe,{groupRef:i,onSelect:R}),r(p,{className:d.buttonArea,justify:"end",children:[e(w,{onClick:s,variant:"tertiary",children:"Close"}),e(w,{onClick:x,isDisabled:!i,children:"Apply"})]})]})}})})]})};export{te as GroupSelectorBUI};
1
+ import{jsxs as r,jsx as e,Fragment as D}from"react/jsx-runtime";import{useApi as F}from"@backstage/core-plugin-api";import{entityPresentationApiRef as M,useEntityPresentation as O}from"@backstage/plugin-catalog-react";import{Button as w,Flex as p,TextField as I,ButtonIcon as U,Box as y,Card as $,Text as l,Skeleton as G,TagGroup as A}from"@backstage/ui";import{makeStyles as q}from"@material-ui/core";import{RiUserLine as z,RiSearchLine as J,RiHistoryLine as K}from"@remixicon/react";import{sortBy as N,isEmpty as C,uniq as H}from"lodash";import{useState as k,useCallback as Q,useMemo as S}from"react";import{DialogTrigger as V,Popover as W,Dialog as X}from"react-aria-components";import{useGroupHierarchy as Y}from"../../hooks/heirarchy/useGroupHierarchy.esm.js";import{getAllOwnedEntityCount as Z}from"../../utils/getAllOwnedEntityCount.esm.js";import{GroupSelectionHistory as _}from"./GroupSelectionHistory.esm.js";import{GroupSelectList as ee}from"./GroupSelectList.esm.js";import{GroupTag as P}from"./GroupTag.esm.js";import{useGroupHistory as re}from"./useGroupHistory.esm.js";import{usePreviousSelectedGroups as ie}from"./usePreviousSelectedGroups.esm.js";const E=q(()=>({dialog:{padding:"var(--bui-space-3)",backgroundColor:"var(--bui-bg-popover)",border:"1px solid var(--bui-border)",borderRadius:"var(--bui-radius-2)"},buttonArea:{marginTop:"var(--bui-space-2)"},selectedCard:{padding:"var(--bui-space-3)",gap:"var(--bui-space-2)",width:"36rem",margin:"var(--bui-space-3) 0"},relatedGroups:{marginTop:"var(--bui-space-2)"},tagArea:{height:"8rem",width:"16rem",overflow:"auto"}})),oe=({groupRef:o,onSelect:b})=>{const d=E(),{primaryTitle:i,secondaryTitle:f}=O(o),{isLoading:n,data:v}=Y(o,{includeParent:!0}),t=v?.[o],m=S(()=>Z(t),[t]),h=S(()=>{const a=t?.children??{};return N(Object.values(a).map(c=>({ref:c.entityRef,type:c.type})),"ref")},[t?.children]),u=S(()=>C(h)?[]:H(h.map(a=>a.ref)),[h]),g=S(()=>C(t?.parents)?[]:N(H(t.parents),a=>a),[t?.parents]);return r(y,{children:[r($,{className:d.selectedCard,children:[e(l,{variant:"body-medium",color:"secondary",children:"Currently Selected"}),r(p,{direction:"column",gap:"0",children:[e(l,{variant:"body-large",weight:"bold",children:i}),e(l,{variant:"body-medium",color:"secondary",children:f})]}),r(p,{gap:"0",direction:"column",children:[r(p,{gap:"1",align:"center",children:[r(l,{variant:"body-medium",children:[i," directly owns:"]}),n?e(G,{height:"1rem"}):r(l,{variant:"body-medium",color:"secondary",children:[u.length," ",u.length===1?"entity":"entities"]})]}),r(p,{gap:"1",align:"center",children:[r(l,{variant:"body-medium",children:[i," and it's subgroups owns:"]}),n?e(G,{height:"1rem"}):r(l,{variant:"body-medium",color:"secondary",children:[m," ",m===1?"entity":"entities"]})]})]})]}),r(p,{className:d.relatedGroups,children:[r(y,{style:{flex:1},children:[e(l,{color:"secondary",children:"Parent Groups"}),r(y,{className:d.tagArea,children:[n&&e(G,{width:"10rem"}),!n&&C(g)?e(l,{variant:"body-small",children:"No parent groups."}):e(A,{selectionMode:"single","aria-label":"Parent Groups",children:g.map(a=>e(P,{groupRef:a,handleClick:c=>b(c,o)},`${a}-parent`))})]})]}),r(y,{style:{flex:1},children:[e(l,{color:"secondary",children:"Child Groups"}),r(y,{className:d.tagArea,children:[n&&e(G,{width:"10rem"}),!n&&C(u)?e(l,{variant:"body-small",children:"No child groups."}):e(A,{selectionMode:"single","aria-label":"Child Groups",children:u.map(a=>e(P,{groupRef:a,handleClick:c=>b(c,void 0,o)},`${a}-child`))})]})]})]})]})},te=({selectedGroupRef:o,updateGroupRef:b})=>{const d=E(),[i,f]=k(o),[n,v]=k(""),[t,m]=k(!1),h=F(M),u=o?h.forEntity(o).snapshot.primaryTitle:void 0,{addGroupHistory:g,history:a}=re(),{addGroup:c,groupEntityRefs:B}=ie(),R=Q((s,x,T)=>{f(s),v(""),g(s,x,T)},[g]),L=!t&&(!i||n),j=!t&&i&&!n;return r(V,{onOpenChange:s=>{s&&o&&o!==i&&f(o),t&&m(!1)},children:[e(w,{variant:"secondary",iconStart:e(z,{}),children:u??"Select Group"}),e(W,{placement:"bottom right",children:e(X,{className:d.dialog,children:({close:s})=>{const x=()=>{i&&i!==o&&(b(i),c(i)),s()};return r(D,{children:[r(p,{align:"center",gap:"2",children:[e(I,{placeholder:"Search Groups",value:n,onChange:v,size:"small",icon:e(J,{}),"aria-label":"Search Groups",style:{flex:"1"}}),e(U,{"aria-label":"Show History",variant:"secondary",icon:e(K,{}),onClick:()=>m(!t)})]}),t&&e(_,{previouslySelectedGroups:B??[],history:a??[],selectRef:T=>{R(T),m(!1)}}),L&&e(ee,{searchTerm:n,selectedRef:i,selectRef:R}),j&&e(oe,{groupRef:i,onSelect:R}),r(p,{className:d.buttonArea,justify:"end",children:[e(w,{onClick:s,variant:"tertiary",children:"Close"}),e(w,{onClick:x,isDisabled:!i,children:"Apply"})]})]})}})})]})};export{te as GroupSelectorBUI};
2
2
  //# sourceMappingURL=GroupSelectorBUI.esm.js.map
@@ -1,2 +1,2 @@
1
- import{getPercentage as n}from"../../../utils/formatters.esm.js";import{getTrackStatusTotal as R}from"../../../utils/tracks.esm.js";const u=(e,a)=>{if(!e||typeof e!="object")return null;if(e.groupRef===a)return e.status;if(e.children&&Array.isArray(e.children))for(const c of e.children){const l=u(c,a);if(l)return l}return null},p=(e,a,c,l,f)=>{const g=l.forEntity(e.entityRef).snapshot.primaryTitle,d=e.entityRef,r=a?u(a,d):null,h=c(r?.allPassPercentage||0),P=e.ownedEntityRefs?.length||0,t=r?R(r):0;if(!e.children||Object.keys(e.children).length===0){if(P===0)return;const i=Math.log(P+1);if(i===0)return;const s={id:g,name:g,entityRef:d,value:i,numberOfEntities:P,color:h,passPercentage:r?.allPassPercentage||0,failPercentage:n(r?.failed,t),warningPercentage:n(r?.warning,t),notReportedPercentage:n(r?.notReported,t),errorPercentage:n(r?.error,t),children:[]};return f&&(s.parent=f),s}const m=Object.values(e.children),o={id:g,name:g,entityRef:d,numberOfEntities:0,color:"",passPercentage:r?.allPassPercentage||0,failPercentage:n(r?.failed,t),warningPercentage:n(r?.warning,t),notReportedPercentage:n(r?.notReported,t),errorPercentage:n(r?.error,t),children:[]};f&&(o.parent=f);const y=m.map(i=>{const s=p(i,a,c,l,o);return o.numberOfEntities+=s?.numberOfEntities??0,s}).filter(i=>i!==void 0);return o.children=y,o.color=c(r?.allPassPercentage||0),o};export{p as hierarchyToNivo};
1
+ import{getPercentage as n}from"../../../utils/formatters.esm.js";import{getTrackStatusTotal as R}from"../../../utils/tracks.esm.js";const u=(e,a)=>{if(!e||typeof e!="object")return null;if(e.groupRef===a)return e.status;if(e.children&&Array.isArray(e.children))for(const c of e.children){const s=u(c,a);if(s)return s}return null},p=(e,a,c,s,f)=>{const g=e.entityRef,d=e.entityRef,r=a?u(a,d):null,h=c(r?.allPassPercentage||0),P=e.ownedEntityRefs?.length||0,t=r?R(r):0;if(!e.children||Object.keys(e.children).length===0){if(P===0)return;const i=Math.log(P+1);if(i===0)return;const l={id:g,name:g,entityRef:d,value:i,numberOfEntities:P,color:h,passPercentage:r?.allPassPercentage||0,failPercentage:n(r?.failed,t),warningPercentage:n(r?.warning,t),notReportedPercentage:n(r?.notReported,t),errorPercentage:n(r?.error,t),children:[]};return f&&(l.parent=f),l}const m=Object.values(e.children),o={id:g,name:g,entityRef:d,numberOfEntities:0,color:"",passPercentage:r?.allPassPercentage||0,failPercentage:n(r?.failed,t),warningPercentage:n(r?.warning,t),notReportedPercentage:n(r?.notReported,t),errorPercentage:n(r?.error,t),children:[]};f&&(o.parent=f);const y=m.map(i=>{const l=p(i,a,c,s,o);return o.numberOfEntities+=l?.numberOfEntities??0,l}).filter(i=>i!==void 0);return o.children=y,o.color=c(r?.allPassPercentage||0),o};export{p as hierarchyToNivo};
2
2
  //# sourceMappingURL=hierarchyToNivo.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as t}from"react/jsx-runtime";import{useRouteRef as L,useApi as N,configApiRef as x}from"@backstage/core-plugin-api";import{usePermission as n}from"@backstage/plugin-permission-react";import{RiEditBoxLine as E,RiArchiveLine as M,RiDeleteBinLine as P,RiNotificationLine as B}from"@remixicon/react";import{soundcheckCampaignUpdatePermission as T,soundcheckCampaignDeletePermission as U,soundcheckCampaignNotificationsCreatePermission as $}from"@spotify/backstage-plugin-soundcheck-common";import{useState as j,useCallback as r,useMemo as I}from"react";import{useNavigate as O}from"react-router-dom";import{v4 as q}from"uuid";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@backstage/plugin-catalog-react";import"../../hooks/useSoundcheckAlert.esm.js";import{useArchiveCampaign as z}from"../../hooks/campaigns/useArchiveCampaign.esm.js";import{useDeleteCampaign as F}from"../../hooks/campaigns/useDeleteCampaign.esm.js";import{useCreateTrack as G}from"../../hooks/tracks/useCreateTrack.esm.js";import{useConfirmationModal as H}from"../../hooks/useConfirmationModal.esm.js";import"react-use/lib/useLocalStorage";import{campaignEditRouteRef as J}from"../../routes.esm.js";import{useArchiveConfirmationModal as K}from"../CampaignsPage/CampaignListPage/useArchiveConfirmationModal.esm.js";const Q=i=>{const m=L(J),s=O(),c=i?.archived,{showModal:d}=H(),[S,p]=j(!1),{showArchiveModal:l}=K(),{mutate:u}=G(),{mutate:f}=F(),{mutate:g}=z(),h=N(x).getOptionalBoolean("soundcheck.notifications.enabled"),{loading:C,allowed:v}=n({permission:T,resourceRef:i?.id}),{loading:R,allowed:k}=n({permission:U,resourceRef:i?.id}),{loading:w,allowed:A}=n({permission:$}),y=r(async()=>{i?.id&&await d({title:"Delete Campaign",message:`Are you sure you want to delete campaign ${i.name??i.id}?`})&&f(i.id)},[d,f,i?.id,i?.name]),b=r(()=>{if(!i)return;const{track:e}=i,a={id:q(),ownerEntityRef:e.ownerEntityRef,description:e.description??"",name:e.name,documentationURL:e.documentationURL,type:"standard",levels:e.levels.map(o=>({checks:o.checks,description:o.description,name:o.name,ordinal:o.ordinal})),filter:e.filter??void 0,exclude:e.exclude??void 0,badgeType:"status",draft:e.draft??!1};u(a)},[i,u]),D=r(async()=>{if(!i?.id)return;const{saveTrack:e,confirmed:a}=await l({title:"Archive Campaign",message:`Are you sure you want to archive campaign ${i.name??i.id}?`});a&&(e&&b(),g(i.id))},[g,i?.id,i?.name,b,l]);return{actions:I(()=>{if(!i?.id)return[];const e=[];return!C&&v&&e.push({label:"Edit",id:"edit",onClick:()=>s(m({campaignId:i.id})),iconStart:t(E,{})}),!R&&k&&(c||e.push({label:"Archive",id:"archive",onClick:D,iconStart:t(M,{})}),e.push({label:"Delete",id:"delete",onClick:y,iconStart:t(P,{})})),!w&&h&&A&&i&&e.push({label:"Send Reminder",id:"send",onClick:()=>p(!0),iconStart:t(B,{})}),e},[i,m,k,v,A,D,y,c,h,R,C,w,s]),showNotificationDialog:S,setShowNotificationDialog:p}};export{Q as useCampaignActions};
1
+ import{jsx as t}from"react/jsx-runtime";import{useRouteRef as E,useApi as x,configApiRef as N}from"@backstage/core-plugin-api";import{usePermission as n}from"@backstage/plugin-permission-react";import{RiEditBoxLine as M,RiArchiveLine as P,RiDeleteBinLine as B,RiNotificationLine as T,RiExternalLinkLine as U}from"@remixicon/react";import{soundcheckCampaignUpdatePermission as $,soundcheckCampaignDeletePermission as j,soundcheckCampaignNotificationsCreatePermission as I}from"@spotify/backstage-plugin-soundcheck-common";import{useState as O,useCallback as m,useMemo as q}from"react";import{useNavigate as z}from"react-router-dom";import{v4 as F}from"uuid";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@backstage/plugin-catalog-react";import"../../hooks/useSoundcheckAlert.esm.js";import{useArchiveCampaign as G}from"../../hooks/campaigns/useArchiveCampaign.esm.js";import{useDeleteCampaign as H}from"../../hooks/campaigns/useDeleteCampaign.esm.js";import{useCreateTrack as J}from"../../hooks/tracks/useCreateTrack.esm.js";import{useConfirmationModal as K}from"../../hooks/useConfirmationModal.esm.js";import"react-use/lib/useLocalStorage";import{campaignEditRouteRef as Q}from"../../routes.esm.js";import{useExternalCampaignActions as V}from"../CampaignPage/CampaignActionsContext.esm.js";import{useArchiveConfirmationModal as W}from"../CampaignsPage/CampaignListPage/useArchiveConfirmationModal.esm.js";const X=i=>{const s=E(Q),r=z(),c=i?.archived,{showModal:d}=K(),[D,l]=O(!1),{showArchiveModal:p}=W(),{mutate:u}=J(),{mutate:f}=H(),{mutate:h}=G(),g=V(),C=x(N).getOptionalBoolean("soundcheck.notifications.enabled"),{loading:R,allowed:k}=n({permission:$,resourceRef:i?.id}),{loading:v,allowed:w}=n({permission:j,resourceRef:i?.id}),{loading:A,allowed:y}=n({permission:I}),b=m(async()=>{i?.id&&await d({title:"Delete Campaign",message:`Are you sure you want to delete campaign ${i.name??i.id}?`})&&f(i.id)},[d,f,i?.id,i?.name]),L=m(()=>{if(!i)return;const{track:e}=i,o={id:F(),ownerEntityRef:e.ownerEntityRef,description:e.description??"",name:e.name,documentationURL:e.documentationURL,type:"standard",levels:e.levels.map(a=>({checks:a.checks,description:a.description,name:a.name,ordinal:a.ordinal})),filter:e.filter??void 0,exclude:e.exclude??void 0,badgeType:"status",draft:e.draft??!1};u(o)},[i,u]),S=m(async()=>{if(!i?.id)return;const{saveTrack:e,confirmed:o}=await p({title:"Archive Campaign",message:`Are you sure you want to archive campaign ${i.name??i.id}?`});o&&(e&&L(),h(i.id))},[h,i?.id,i?.name,L,p]);return{actions:q(()=>{if(!i?.id)return[];const e=[];!R&&k&&e.push({label:"Edit",id:"edit",onClick:()=>r(s({campaignId:i.id})),iconStart:t(M,{})}),!v&&w&&(c||e.push({label:"Archive",id:"archive",onClick:S,iconStart:t(P,{})}),e.push({label:"Delete",id:"delete",onClick:b,iconStart:t(B,{})})),!A&&C&&y&&i&&e.push({label:"Send Reminder",id:"send",onClick:()=>l(!0),iconStart:t(T,{})});for(const o of g)e.push({label:o.label,id:o.id,onClick:()=>r(o.href(i.id)),iconStart:t(U,{})});return e},[i,s,w,k,y,g,S,b,c,C,v,R,A,r]),showNotificationDialog:D,setShowNotificationDialog:l}};export{X as useCampaignActions};
2
2
  //# sourceMappingURL=useCampaignActions.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as n,Fragment as m}from"react/jsx-runtime";import{useApi as E,featureFlagsApiRef as A,useRouteRef as p}from"@backstage/core-plugin-api";import{usePermission as s}from"@backstage/plugin-permission-react";import{Box as F}from"@backstage/ui";import{soundcheckCampaignCreatePermission as B,soundcheckCheckCreatePermission as O,soundcheckTrackCreatePermission as j}from"@spotify/backstage-plugin-soundcheck-common";import{Helmet as U}from"react-helmet";import{Routes as y,Route as t,useParams as h,Navigate as l}from"react-router-dom";import{useFeatureFlag as D}from"../../hooks/useFeatureFlag.esm.js";import{trackOverviewRouteRef as H,campaignOverviewRouteRef as N,techInsightsPageRouteRef as S}from"../../routes.esm.js";import{CampaignPage as V}from"../CampaignPage/CampaignPage.esm.js";import{CampaignTechInsightsExplorerPage as W}from"../CampaignPage/CampaignTechInsightsExplorerPage.esm.js";import{CampaignsPage as q}from"../CampaignsPage/CampaignsPage.esm.js";import{CampaignCreatePage as z}from"../CampaignCreatePage/CampaignCreatePage.esm.js";import{EditCampaignView as G}from"../CampaignsPage/EditCampaignView.esm.js";import{CheckCreatePage as J}from"../CheckCreatePage/CheckCreatePage.esm.js";import{CheckEditPage as K}from"../CheckPage/CheckEditPage.esm.js";import{CheckPage as g}from"../CheckPage/CheckPage.esm.js";import{ChecksTab as L}from"../ChecksTab/ChecksTab.esm.js";import"../CheckTemplatesPage/CheckTemplatesPageBUI.esm.js";import{CheckTemplatesPage as M}from"../CheckTemplatesPage/CheckTemplatesPage.esm.js";import"../CheckTemplatesPage/CheckTemplatesPageDeprecated.esm.js";import{CollectorPage as Q}from"../CollectorPage/CollectorPage.esm.js";import{CollectorDetailsPage as X}from"../CollectorPage/CollectorDetailsPage.esm.js";import"../CollectorPage/CollectorDetailsPageBUI.esm.js";import"../CollectorPage/CollectorDetailsPageDeprecated.esm.js";import{CollectorsPage as Y}from"../CollectorsPage/CollectorsPage.esm.js";import{OverviewPageContent as Z}from"../OverviewPage/OverviewPageContent.esm.js";import{TechInsightsPage as _}from"../TechInsights/TechInsightsPage.esm.js";import{TrackBuilderPage as $}from"../TrackBuilderPage/TrackBuilderPage.esm.js";import{TrackCreatePage as ee}from"../TrackCreatePage/TrackCreatePage.esm.js";import{TrackEditPage as te}from"../TrackEditPage/TrackEditPage.esm.js";import{TrackPage as ae}from"../TrackPage/TrackPage.esm.js";import{TrackTechInsightsExplorerPage as re}from"../TrackPage/TrackTechInsightsExplorerPage.esm.js";import{TracksTab as ie}from"../TracksTab/TracksTab.esm.js";import{RoutingPageWrapperBUI as oe}from"./RoutingPageWrapperBUI.esm.js";const ne=()=>{const{trackId:a}=h(),i=p(H);if(!a)return null;const r=i({trackId:a});return e(l,{to:r,replace:!0})},ce=()=>{const{campaignId:a}=h(),i=p(N);if(!a)return null;const r=i({campaignId:a});return e(l,{to:r,replace:!0})},me=()=>{const a=p(S)();return e(l,{to:a,replace:!0})},pe=({title:a="Soundcheck",integrations:i})=>{const r=E(A),c=r.getRegisteredFlags(),d=!c.find(o=>o.name==="soundcheck-enable-campaigns")||r.isActive("soundcheck-enable-campaigns"),{loading:k,allowed:f}=s({permission:B}),u=!k&&f,{loading:P,allowed:I}=s({permission:O}),C=!c.find(o=>o.name==="soundcheck-enable-check-creation")||r.isActive("soundcheck-enable-check-creation"),v=!P&&I&&C,{loading:R,allowed:T}=s({permission:j}),b=!c.find(o=>o.name==="soundcheck-enable-track-creation")||r.isActive("soundcheck-enable-track-creation"),w=!R&&T&&b,x=D("track-builder");return e(oe,{title:a,children:n(y,{children:[d&&n(m,{children:[e(t,{path:"/campaigns",element:e(q,{})}),e(t,{path:"/campaigns/:campaignId/edit",element:e(G,{})}),e(t,{path:"/campaigns/:campaignId",element:e(ce,{})}),e(t,{path:"/campaigns/:campaignId/overview",element:e(V,{})}),e(t,{path:"/campaigns/:campaignId/explorer",element:e(W,{})}),u&&e(t,{path:"/campaigns/create",element:e(z,{})})]}),x&&e(t,{path:"/track-builder",element:e($,{})}),e(t,{path:"/tracks",element:e(ie,{})}),e(t,{path:"/tracks/:trackId/edit",element:e(te,{})}),w&&e(t,{path:"/tracks/create",element:e(ee,{})}),e(t,{path:"/tracks/:trackId",element:e(ne,{})}),e(t,{path:"/tracks/:trackId/overview",element:e(ae,{})}),e(t,{path:"/tracks/:trackId/explorer",element:e(re,{})}),e(t,{path:"/tracks/:trackId/checks/:checkId",element:e(g,{})}),e(t,{path:"/checks",element:e(L,{})}),e(t,{path:"/checks/:checkId",element:e(g,{})}),e(t,{path:"/checks/:checkId/edit",element:e(K,{})}),v&&n(m,{children:[e(t,{path:"/checks/create",element:e(J,{})}),e(t,{path:"/checks/templates",element:e(M,{})})]}),e(t,{path:"/integrations",element:e(Y,{integrations:i})}),e(t,{path:"/integrations/:integrationId",element:e(X,{integrations:i})}),e(t,{path:"/integrations/:integrationId/edit",element:e(Q,{})}),e(t,{path:"/tech-insights",element:n(m,{children:[e(U,{title:"Tech Insights"}),e(_,{})]})}),e(t,{path:"/overview",element:e(F,{style:{margin:"var(--bui-space-6) var(--bui-space-6)"},children:e(Z,{})})}),e(t,{path:"/",element:e(me,{})})]})})};export{pe as RoutingPageBUI};
1
+ import{jsx as e,jsxs as p,Fragment as d}from"react/jsx-runtime";import{useApi as A,featureFlagsApiRef as O,useRouteRef as m}from"@backstage/core-plugin-api";import{usePermission as k}from"@backstage/plugin-permission-react";import{Box as E}from"@backstage/ui";import{soundcheckCampaignCreatePermission as y,soundcheckCheckCreatePermission as N,soundcheckTrackCreatePermission as F}from"@spotify/backstage-plugin-soundcheck-common";import{Helmet as j}from"react-helmet";import{Routes as U,Route as t,Outlet as W,useParams as P,useLocation as D,Navigate as l}from"react-router-dom";import{campaignOverviewRouteRef as H,techInsightsPageRouteRef as L,trackOverviewRouteRef as S,tracksPageRouteRef as V,trackCreateRouteRef as q,newTrackRouteRef as z,trackBuilderRouteRef as G}from"../../routes.esm.js";import{CampaignPage as J}from"../CampaignPage/CampaignPage.esm.js";import{CampaignActionsProvider as K}from"../CampaignPage/CampaignActionsContext.esm.js";import{CampaignTechInsightsExplorerPage as M}from"../CampaignPage/CampaignTechInsightsExplorerPage.esm.js";import{CampaignsPage as Q}from"../CampaignsPage/CampaignsPage.esm.js";import{CampaignCreatePage as X}from"../CampaignCreatePage/CampaignCreatePage.esm.js";import{EditCampaignView as Y}from"../CampaignsPage/EditCampaignView.esm.js";import{CheckCreatePage as Z}from"../CheckCreatePage/CheckCreatePage.esm.js";import{CheckEditPage as _}from"../CheckPage/CheckEditPage.esm.js";import{CheckPage as C}from"../CheckPage/CheckPage.esm.js";import{ChecksTab as $}from"../ChecksTab/ChecksTab.esm.js";import"../CheckTemplatesPage/CheckTemplatesPageBUI.esm.js";import{CheckTemplatesPage as ee}from"../CheckTemplatesPage/CheckTemplatesPage.esm.js";import"../CheckTemplatesPage/CheckTemplatesPageDeprecated.esm.js";import{CollectorPage as te}from"../CollectorPage/CollectorPage.esm.js";import{CollectorDetailsPage as re}from"../CollectorPage/CollectorDetailsPage.esm.js";import"../CollectorPage/CollectorDetailsPageBUI.esm.js";import"../CollectorPage/CollectorDetailsPageDeprecated.esm.js";import{CollectorsPage as ae}from"../CollectorsPage/CollectorsPage.esm.js";import{CreateNewTrackPage as ie}from"../CreateNewTrackPage/CreateNewTrackPage.esm.js";import{OverviewPageContent as ne}from"../OverviewPage/OverviewPageContent.esm.js";import{TechInsightsPage as oe}from"../TechInsights/TechInsightsPage.esm.js";import{TrackBuilderPage as ce}from"../TrackBuilderPage/TrackBuilderPage.esm.js";import{TrackCreatePage as me}from"../TrackCreatePage/TrackCreatePage.esm.js";import{TrackEditPage as pe}from"../TrackEditPage/TrackEditPage.esm.js";import{TrackPage as se}from"../TrackPage/TrackPage.esm.js";import{TrackTechInsightsExplorerPage as le}from"../TrackPage/TrackTechInsightsExplorerPage.esm.js";import{TracksTab as he}from"../TracksTab/TracksTab.esm.js";import{RoutingPageWrapperBUI as de}from"./RoutingPageWrapperBUI.esm.js";const ge=()=>{const r=m(S),i=m(V),n=m(q),a=m(z),o=m(G);return{buildOverview:r,buildTracks:i,buildCreate:n,buildNew:a,buildBuilder:o}},f=r=>{try{return r?.()??null}catch{return null}},v=()=>{const{trackId:r}=P(),i=D(),{buildOverview:n,buildTracks:a,buildCreate:o,buildNew:g,buildBuilder:u}=ge();if(!r)return null;const h=[f(o),f(g),f(u)].filter(Boolean).find(c=>i.pathname.endsWith(c));if(h)return e(l,{to:h,replace:!0});try{const c=n({trackId:r});return e(l,{to:c,replace:!0})}catch{const c=typeof a=="function"?a():"/tracks";return e(l,{to:c,replace:!0})}},ue=()=>{const{campaignId:r}=P(),i=m(H);if(!r)return null;const n=i({campaignId:r});return e(l,{to:n,replace:!0})},ke=()=>{const r=m(L)();return e(l,{to:r,replace:!0})},fe=({title:r="Soundcheck",integrations:i,campaignActions:n=[]})=>{const a=A(O),o=a.getRegisteredFlags(),g=!o.find(s=>s.name==="soundcheck-enable-campaigns")||a.isActive("soundcheck-enable-campaigns"),{loading:u,allowed:h}=k({permission:y}),c=!u&&h,{loading:I,allowed:R}=k({permission:N}),b=!o.find(s=>s.name==="soundcheck-enable-check-creation")||a.isActive("soundcheck-enable-check-creation"),T=!I&&R&&b,{loading:w,allowed:x}=k({permission:F}),B=!o.find(s=>s.name==="soundcheck-enable-track-creation")||a.isActive("soundcheck-enable-track-creation");return e(K,{actions:n,children:e(de,{title:r,children:p(U,{children:[g&&p(d,{children:[e(t,{path:"/campaigns",element:e(Q,{})}),e(t,{path:"/campaigns/:campaignId/edit",element:e(Y,{})}),e(t,{path:"/campaigns/:campaignId",element:e(ue,{})}),e(t,{path:"/campaigns/:campaignId/overview",element:e(J,{})}),e(t,{path:"/campaigns/:campaignId/explorer",element:e(M,{})}),c&&e(t,{path:"/campaigns/create",element:e(X,{})})]}),p(t,{path:"/tracks",element:e(W,{}),children:[e(t,{index:!0,element:e(he,{})}),e(t,{path:"builder",element:e(ce,{})}),!w&&x&&B&&p(d,{children:[e(t,{path:"create",element:e(me,{})}),e(t,{path:"new",element:e(ie,{})})]}),e(t,{path:":trackId/edit",element:e(pe,{})}),e(t,{path:":trackId",element:e(v,{})}),e(t,{path:":trackId/overview",element:e(se,{})}),e(t,{path:":trackId/explorer",element:e(le,{})}),e(t,{path:":trackId/checks/:checkId",element:e(C,{})})]}),e(t,{path:"/checks",element:e($,{})}),e(t,{path:"/checks/:checkId",element:e(C,{})}),e(t,{path:"/checks/:checkId/edit",element:e(_,{})}),T&&p(d,{children:[e(t,{path:"/checks/create",element:e(Z,{})}),e(t,{path:"/checks/templates",element:e(ee,{})})]}),e(t,{path:"/integrations",element:e(ae,{integrations:i})}),e(t,{path:"/integrations/:integrationId",element:e(re,{integrations:i})}),e(t,{path:"/integrations/:integrationId/edit",element:e(te,{})}),e(t,{path:"/tech-insights",element:p(d,{children:[e(j,{title:"Tech Insights"}),e(oe,{})]})}),e(t,{path:"/overview",element:e(E,{style:{margin:"var(--bui-space-6) var(--bui-space-6)"},children:e(ne,{})})}),e(t,{path:"/",element:e(ke,{})})]})})})};export{fe as RoutingPageBUI,v as TrackOverviewRedirect};
2
2
  //# sourceMappingURL=RoutingPageBUI.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as t,Fragment as R}from"react/jsx-runtime";import{useRouteRef as e,useApi as k,featureFlagsApiRef as b}from"@backstage/core-plugin-api";import{usePermission as S}from"@backstage/plugin-permission-react";import{Header as v,ButtonLink as x}from"@backstage/ui";import{RiCheckDoubleLine as y,RiSettings2Line as P}from"@remixicon/react";import{soundcheckCollectorReadPermission as A}from"@spotify/backstage-plugin-soundcheck-common";import{rootRouteRef as C,tracksPageRouteRef as w,checksPageRouteRef as I,campaignsPageRouteRef as L,integrationsPageRouteRef as F,overviewRouteRef as B,techInsightsPageRouteRef as H}from"../../routes.esm.js";const T=()=>{const o=e(C)(),c=e(w)(),s=e(I)(),n=e(L)(),l=e(F)(),m=e(B)(),f=e(H)(),i=k(b),r=i.getRegisteredFlags(),h=!r.find(a=>a.name==="soundcheck-enable-campaigns")||i.isActive("soundcheck-enable-campaigns"),{loading:g,allowed:d}=S({permission:A}),u=(!r.find(a=>a.name==="soundcheck-enable-collectors")||i.isActive("soundcheck-enable-collectors"))&&!g&&d,p=[{id:"tech-insights",label:"Tech Insights",href:f,matchStrategy:"prefix"},{id:"checks",label:"Checks",href:s,matchStrategy:"prefix"},{id:"tracks",label:"Tracks",href:c,matchStrategy:"prefix"},...h?[{id:"campaigns",label:"Campaigns",href:n,matchStrategy:"prefix"}]:[],...u?[{id:"integrations",label:"Integrations",href:l,matchStrategy:"prefix"}]:[],{id:"classic-overview",label:"Classic Overview",href:m,matchStrategy:"exact"}];return t(v,{title:"Soundcheck",icon:t(y,{size:18}),titleLink:o,tabs:p,customActions:t(R,{children:t(x,{href:"/settings",variant:"secondary",iconStart:t(P,{})})})})};export{T as SoundcheckHeaderBUI};
1
+ import{jsx as t,Fragment as R}from"react/jsx-runtime";import{useRouteRef as e,useApi as k,featureFlagsApiRef as b}from"@backstage/core-plugin-api";import{usePermission as S}from"@backstage/plugin-permission-react";import{PluginHeader as v,ButtonLink as x}from"@backstage/ui";import{RiCheckDoubleLine as P,RiSettings2Line as y}from"@remixicon/react";import{soundcheckCollectorReadPermission as A}from"@spotify/backstage-plugin-soundcheck-common";import{rootRouteRef as C,tracksPageRouteRef as w,checksPageRouteRef as I,campaignsPageRouteRef as L,integrationsPageRouteRef as F,overviewRouteRef as B,techInsightsPageRouteRef as H}from"../../routes.esm.js";const T=()=>{const o=e(C)(),c=e(w)(),s=e(I)(),n=e(L)(),l=e(F)(),m=e(B)(),f=e(H)(),i=k(b),r=i.getRegisteredFlags(),g=!r.find(a=>a.name==="soundcheck-enable-campaigns")||i.isActive("soundcheck-enable-campaigns"),{loading:h,allowed:u}=S({permission:A}),d=(!r.find(a=>a.name==="soundcheck-enable-collectors")||i.isActive("soundcheck-enable-collectors"))&&!h&&u,p=[{id:"tech-insights",label:"Tech Insights",href:f,matchStrategy:"prefix"},{id:"checks",label:"Checks",href:s,matchStrategy:"prefix"},{id:"tracks",label:"Tracks",href:c,matchStrategy:"prefix"},...g?[{id:"campaigns",label:"Campaigns",href:n,matchStrategy:"prefix"}]:[],...d?[{id:"integrations",label:"Integrations",href:l,matchStrategy:"prefix"}]:[],{id:"classic-overview",label:"Classic Overview",href:m,matchStrategy:"exact"}];return t(v,{title:"Soundcheck",icon:t(P,{size:18}),titleLink:o,tabs:p,customActions:t(R,{children:t(x,{href:"/settings",variant:"secondary",iconStart:t(y,{})})})})};export{T as SoundcheckHeaderBUI};
2
2
  //# sourceMappingURL=SoundcheckHeaderBUI.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as r}from"react/jsx-runtime";import{makeStyles as t}from"@material-ui/core";import n from"react-markdown";import d from"rehype-raw";import m from"remark-gfm";import"./SoundcheckMarkdownContentDeprecated.esm.js";import{components as l}from"./ComponentRenders.esm.js";const o=["h1","h2","h3","h4","h5","h6","p","div","span","a","img","table","th","td","tr","thead","tbody","ol","li","ul","details","summary","br","hr","del","pre","code","strong","em","blockquote","input"],c=t(()=>({markdown:{"& table":{borderCollapse:"collapse",border:"1px solid var(--bui-border)"},"& th, & td":{border:"1px solid var(--bui-border)",padding:"var(--bui-space-2)"},"& td":{wordBreak:"break-word",overflow:"hidden",verticalAlign:"middle",lineHeight:"1",margin:0,padding:"var(--bui-space-3) var(--bui-space-2)",borderBottom:0},"& th":{backgroundColor:"var(--bui-bg-surface-1)"},"& tr":{backgroundColor:"inherit"},"& a":{color:"var(--bui-fg-link)"},"& img":{maxWidth:"100%"},"& ul":{marginTop:"var(--bui-space-2)"},"& ol":{marginTop:"var(--bui-space-2)"},"& pre":{padding:"var(--bui-space-2)",background:"var(--bui-bg-surface-2) !important"},"& details":{width:"100%",marginBottom:"var(--bui-space-2)"},"& h1,h2,h3,h4,h5,h6":{marginBottom:"var(--bui-space-2)"}}}),{name:"SoundcheckMarkdownContent"}),p=({content:a,className:e=""})=>{const i=c();return r("div",{className:`${i.markdown} ${e}`.trim(),children:r(n,{components:l,remarkPlugins:[m],rehypePlugins:[d],allowedElements:o,children:a})})};export{o as ALLOWED_HTML_TAGS,p as SoundcheckMarkdownContentBUI};
1
+ import{jsx as r}from"react/jsx-runtime";import{makeStyles as i}from"@material-ui/core";import n from"react-markdown";import d from"rehype-raw";import m from"remark-gfm";import"./SoundcheckMarkdownContentDeprecated.esm.js";import{components as l}from"./ComponentRenders.esm.js";const o=["h1","h2","h3","h4","h5","h6","p","div","span","a","img","table","th","td","tr","thead","tbody","ol","li","ul","details","summary","br","hr","del","pre","code","strong","em","blockquote","input"],p=i(()=>({markdown:{"& table":{borderCollapse:"collapse",border:"1px solid var(--bui-border)"},"& th, & td":{border:"1px solid var(--bui-border)",padding:"var(--bui-space-2)"},"& td":{wordBreak:"break-word",overflow:"hidden",verticalAlign:"middle",lineHeight:"1",margin:0,padding:"var(--bui-space-3) var(--bui-space-2)",borderBottom:0},"& th":{backgroundColor:"var(--bui-bg-neutral-1)"},"& tr":{backgroundColor:"inherit"},"& a":{color:"var(--bui-fg-link)"},"& img":{maxWidth:"100%"},"& ul":{marginTop:"var(--bui-space-2)"},"& ol":{marginTop:"var(--bui-space-2)"},"& pre":{padding:"var(--bui-space-2)",background:"var(--bui-bg-neutral-2) !important"},"& details":{width:"100%",marginBottom:"var(--bui-space-2)"},"& h1,h2,h3,h4,h5,h6":{marginBottom:"var(--bui-space-2)"}}}),{name:"SoundcheckMarkdownContent"}),c=({content:a,className:e=""})=>{const t=p();return r("div",{className:`${t.markdown} ${e}`.trim(),children:r(n,{components:l,remarkPlugins:[m],rehypePlugins:[d],allowedElements:o,children:a})})};export{o as ALLOWED_HTML_TAGS,c as SoundcheckMarkdownContentBUI};
2
2
  //# sourceMappingURL=SoundcheckMarkdownContentBUI.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as r,jsxs as d}from"react/jsx-runtime";import{Box as t}from"@backstage/ui";import{makeStyles as u}from"@material-ui/core";const b=u(()=>({stepperHeader:{display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto"},stepperStep:{display:"flex",alignItems:"center",flex:1},stepperStepGrow:{flex:1},stepperStepFixed:{flex:0,whiteSpace:"nowrap"},stepperCircle:{width:32,height:32,borderRadius:"var(--bui-radius-full)",border:"2px solid var(--bui-fg-disabled)",background:"var(--bui-bg)",display:"flex",justifyContent:"center",alignItems:"center",fontSize:"0.9rem",fontWeight:500,color:"var(--bui-fg-disabled)",zIndex:2},stepperCircleActive:{borderColor:"var(--bui-border-success)",background:"var(--bui-bg-success)",color:"var(--bui-fg-success)",fontWeight:"bold"},stepperCircleCompleted:{borderColor:"var(--bui-border-success)",background:"var(--bui-bg-success)",color:"var(--bui-fg-success)",fontWeight:600},stepperLabel:{marginLeft:"var(--bui-space-2)",fontSize:14,whiteSpace:"nowrap",color:"var(--bui-fg-disabled)",fontWeight:500},stepperLabelSuccess:{marginLeft:"var(--bui-space-2)",fontSize:14,whiteSpace:"nowrap",color:"var(--bui-fg-success)",fontWeight:500},stepperLine:{flexGrow:1,height:2,background:"var(--bui-border)",margin:"0 var(--bui-space-2)",zIndex:1},stepperLineCompleted:{background:"var(--bui-border-success)"}})),f=3,g="50%",m="100%",h=({stepTitles:p,currentStep:o})=>{const e=b(),l=p.length<f?g:m;return r(t,{className:e.stepperHeader,style:{width:l},children:p.map((a,s)=>{const n=s===o,i=s<o,c=s===p.length-1;return d(t,{className:[e.stepperStep,c?e.stepperStepFixed:e.stepperStepGrow].join(" "),children:[r(t,{className:[e.stepperCircle,n?e.stepperCircleActive:"",i?e.stepperCircleCompleted:""].filter(Boolean).join(" "),children:i?r("span",{"aria-label":"Completed",role:"img",children:"\u2713"}):s+1}),r(t,{className:i?e.stepperLabelSuccess:e.stepperLabel,children:a}),!c&&r(t,{className:[e.stepperLine,i&&e.stepperLineCompleted].filter(Boolean).join(" ")})]},a)})})};export{h as Stepper};
1
+ import{jsx as t,jsxs as g}from"react/jsx-runtime";import{Box as p}from"@backstage/ui";import{makeStyles as f}from"@material-ui/core";const m=f(()=>({stepperHeader:{display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto"},stepperStep:{display:"flex",alignItems:"center",flex:1},stepperStepGrow:{flex:1},stepperStepFixed:{flex:0,whiteSpace:"nowrap"},stepperCircle:{width:32,height:32,borderRadius:"var(--bui-radius-full)",border:"2px solid var(--bui-fg-secondary)",background:"transparent",display:"flex",justifyContent:"center",alignItems:"center",fontSize:"0.9rem",fontWeight:500,color:"var(--bui-fg-secondary)",zIndex:2},stepperCircleActive:{borderColor:"var(--bui-border-success)",background:"var(--bui-bg-success)",color:"var(--bui-fg-success)",fontWeight:"bold"},stepperCircleCompleted:{borderColor:"var(--bui-border-success)",background:"var(--bui-bg-success)",color:"var(--bui-fg-success)",fontWeight:600},stepperLabel:{marginLeft:"var(--bui-space-2)",fontSize:14,whiteSpace:"nowrap",color:"var(--bui-fg-secondary)",fontWeight:500},stepperLabelHighlighted:{color:"var(--bui-fg-success)"},stepperLine:{flexGrow:1,height:2,background:"var(--bui-fg-secondary)",margin:"0 var(--bui-space-2)",zIndex:1},stepperLineCompleted:{background:"var(--bui-border-success)"},stepperLabelButton:{background:"transparent",border:0,padding:0,textAlign:"left"},stepperLabelClickable:{cursor:"pointer"},stepperLabelDisabled:{cursor:"default"}})),h=3,C="50%",v="100%",x=({stepTitles:i,currentStep:a,onStepClick:d})=>{const e=m(),b=i.length<h?C:v;return t(p,{className:e.stepperHeader,style:{width:b},children:i.map((l,r)=>{const n=r===a,s=r<a,c=r===i.length-1,o=r<a,u=n||s?`${e.stepperLabel} ${e.stepperLabelHighlighted}`:e.stepperLabel;return g(p,{className:[e.stepperStep,c?e.stepperStepFixed:e.stepperStepGrow].join(" "),children:[t(p,{className:[e.stepperCircle,n?e.stepperCircleActive:"",s?e.stepperCircleCompleted:""].filter(Boolean).join(" "),children:s?t("span",{"aria-label":"Completed",role:"img",children:"\u2713"}):r+1}),t("button",{type:"button",onClick:()=>o&&d(r),disabled:!o,className:[u,e.stepperLabelButton,o?e.stepperLabelClickable:e.stepperLabelDisabled].join(" "),children:l}),!c&&t(p,{className:[e.stepperLine,s&&e.stepperLineCompleted].filter(Boolean).join(" ")})]},l)})})};export{x as Stepper};
2
2
  //# sourceMappingURL=Stepper.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as u,jsx as i}from"react/jsx-runtime";import{useApi as h}from"@backstage/core-plugin-api";import{entityPresentationApiRef as g}from"@backstage/plugin-catalog-react";import{Row as R,CellText as k,CellProfile as y}from"@backstage/ui";import{useNavigate as A}from"react-router-dom";import{CustomCell as w}from"../CustomCell/CustomCell.esm.js";import{DescriptionCell as x}from"../DescriptionCell/DescriptionCell.esm.js";import{SimpleMenu as P}from"../Menus/SimpleMenu.esm.js";import"@backstage/plugin-permission-react";import"@remixicon/react";import"@spotify/backstage-plugin-soundcheck-common";import"react";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import"react-use/lib/useLocalStorage";import"../../routes.esm.js";import"js-yaml";import"lodash";import"../../contexts/TrackFormContext.esm.js";import"../../contexts/CheckFormContext.esm.js";import"../../contexts/CampaignFormContext.esm.js";import"../../contexts/UserProvider.esm.js";import"uuid";import"../CampaignsPage/CampaignListPage/useArchiveConfirmationModal.esm.js";const T=({ownerEntityRef:r,href:t,profileImageSrc:l,cells:c,menuActions:e,name:m,description:s,documentationURL:a})=>{const f=h(g),p=r?f.forEntity(r):void 0,n=A();return u(R,{onAction:()=>t&&n(t),children:[i(x,{title:m,description:s,onClick:()=>t&&n(t)}),c.map((o,d)=>i(k,{title:o.title,leadingIcon:o.icon,onClick:C=>{o.onClick&&(C.stopPropagation(),o.onClick())}},`cell-${d}`)),i(y,{name:p?.snapshot.primaryTitle,src:l??p?.snapshot.primaryTitle}),i(w,{onClick:o=>o.stopPropagation(),children:i(P,{label:`${m} actions`,disabled:!e?.length,placement:"left top",menuActions:e??[],documentationURL:a,isHeaderMenu:!1})})]})};export{T as TableRowWithOwner};
1
+ import{jsxs as u,jsx as i}from"react/jsx-runtime";import{useApi as h}from"@backstage/core-plugin-api";import{entityPresentationApiRef as g}from"@backstage/plugin-catalog-react";import{Row as R,CellText as k,CellProfile as y}from"@backstage/ui";import{useNavigate as A}from"react-router-dom";import{CustomCell as w}from"../CustomCell/CustomCell.esm.js";import{DescriptionCell as x}from"../DescriptionCell/DescriptionCell.esm.js";import{SimpleMenu as P}from"../Menus/SimpleMenu.esm.js";import"@backstage/plugin-permission-react";import"@remixicon/react";import"@spotify/backstage-plugin-soundcheck-common";import"react";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import"react-use/lib/useLocalStorage";import"../../routes.esm.js";import"js-yaml";import"lodash";import"../../contexts/TrackFormContext.esm.js";import"../../contexts/CheckFormContext.esm.js";import"../../contexts/CampaignFormContext.esm.js";import"../../contexts/UserProvider.esm.js";import"uuid";import"../CampaignPage/CampaignActionsContext.esm.js";import"../CampaignsPage/CampaignListPage/useArchiveConfirmationModal.esm.js";const T=({ownerEntityRef:r,href:t,profileImageSrc:l,cells:c,menuActions:e,name:m,description:s,documentationURL:a})=>{const f=h(g),p=r?f.forEntity(r):void 0,n=A();return u(R,{onAction:()=>t&&n(t),children:[i(x,{title:m,description:s,onClick:()=>t&&n(t)}),c.map((o,d)=>i(k,{title:o.title,leadingIcon:o.icon,onClick:C=>{o.onClick&&(C.stopPropagation(),o.onClick())}},`cell-${d}`)),i(y,{name:p?.snapshot.primaryTitle,src:l??p?.snapshot.primaryTitle}),i(w,{onClick:o=>o.stopPropagation(),children:i(P,{label:`${m} actions`,disabled:!e?.length,placement:"left top",menuActions:e??[],documentationURL:a,isHeaderMenu:!1})})]})};export{T as TableRowWithOwner};
2
2
  //# sourceMappingURL=TableRowWithOwner.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as a,jsxs as x,Fragment as ut}from"react/jsx-runtime";import{useApi as gt,useRouteRef as X}from"@backstage/core-plugin-api";import{entityPresentationApiRef as ft}from"@backstage/plugin-catalog-react";import{Box as U,HeaderPage as ht,Flex as kt,SearchField as yt,Container as Tt}from"@backstage/ui";import{makeStyles as St,LinearProgress as Ct}from"@material-ui/core";import{isEmpty as Et}from"lodash";import{useState as _,useMemo as i,useCallback as wt,useEffect as Rt}from"react";import{useSearchParams as Lt,useNavigate as vt}from"react-router-dom";import bt from"react-use/lib/useDebounce";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@spotify/backstage-plugin-soundcheck-common";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{useSortTableLocalStorage as It}from"../../hooks/useSortTableLocalStorage.esm.js";import{useBatchedHierarchicalTrackStatuses as Pt}from"../../hooks/heirarchy/useBatchedHierarchicalTrackStatuses.esm.js";import{useGroupHierarchy as Bt}from"../../hooks/heirarchy/useGroupHierarchy.esm.js";import{useTracksApplicableToGroup as At}from"../../hooks/tracks/useTracksApplicableToGroup.esm.js";import{useLCPReporting as xt}from"../../hooks/useLCPReporting.esm.js";import{useLoadTimeReporting as Ut}from"../../hooks/useLoadTimeReporting.esm.js";import{trackExplorerRouteRef as Mt,campaignExplorerRouteRef as $t}from"../../routes.esm.js";import{getAllOwnedEntityCount as Gt}from"../../utils/getAllOwnedEntityCount.esm.js";import{getEntitiesBucket as Nt,getTracksBucket as Dt}from"../../utils/helpers.esm.js";import{showTrack as Ft}from"../../utils/tracks.esm.js";import"../EmptyState/EmptyState.esm.js";import{EmptyStateBUI as Ht}from"../EmptyState/EmptyStateBUI.esm.js";import"@backstage/plugin-permission-react";import"@remixicon/react";import{TechInsightsGroupSelector as Ot}from"../TechInsightsGroupSelector/TechInsightsGroupSelector.esm.js";import{SummaryTilesBUI as jt}from"./SummaryTilesBUI.esm.js";import{TechInsightsTableBUI as Vt}from"./TechInsightsTableBUI.esm.js";const zt=St(()=>({container:{marginBottom:"var(--bui-space-12)"}})),Wt=()=>{const Y=zt(),[y,Z]=Lt(),r=y.get("group")||"",[l,tt]=_(y.get("search")||""),[g,et]=_(""),M=i(()=>({routeName:"soundcheck-tech-insights",additionalAttributes:{group:r||"",tracksSearch:g||""}}),[r,g]),{reportContentLoaded:$}=Ut({...M,enabled:!!r}),{reporter:rt}=xt(M),G=vt(),T=gt(ft),{order:ot,orderBy:at,handleSort:it}=It({localStoragePrefix:"soundcheck-tech-insights",defaultSortBy:"entities",defaultDirection:"desc"});bt(()=>{et(l);const t=new URLSearchParams(y.toString());l?t.set("search",l):t.delete("search"),Z(t,{replace:!0})},500,[l]);const{tracks:S,campaigns:N,counts:C,isLoading:f,error:E,activeTrackCount:w}=At(r,{},{enabled:!!r}),p=S.filter(t=>t.type==="campaign"),R=S.filter(t=>t.type!=="campaign"),D=p.filter(t=>{const e=g.toLowerCase(),s=(t.ownerEntityRef?T.forEntity(t.ownerEntityRef):void 0)?.snapshot.primaryTitle?.toLowerCase()||"";return e===""||t.name.toLowerCase().includes(e)||t.ownerEntityRef?.toLowerCase().includes(e)||s.includes(e)}),F=R.filter(t=>{const e=g.toLowerCase(),s=(t.ownerEntityRef?T.forEntity(t.ownerEntityRef):void 0)?.snapshot.primaryTitle?.toLowerCase()||"";return e===""||t.name.toLowerCase().includes(e)||t.ownerEntityRef?.toLowerCase().includes(e)||s.includes(e)}),L=i(()=>[...D,...F],[D,F]),m=i(()=>[...p.map(t=>t.id),...R.map(t=>t.id)],[p,R]),{data:v,isLoading:nt,error:st,progress:o}=Pt({trackIds:m,groupRef:r||"",skip:!r||m.length===0}),{data:H,isLoading:h}=Bt(r,{includeParent:!0}),b=i(()=>{const t=new Map;return Array.isArray(v)&&v.forEach(e=>{e&&e.trackId&&t.set(e.trackId,e)}),t},[v]),ct=i(()=>{const t=new Map;return Array.isArray(C)&&C.forEach(e=>{e&&e.id&&t.set(e.id,e.applicableEntityCount)}),t},[C]),O=f&&!E&&!!r,j=E||st,I=m.length>0&&nt&&!j&&!!r,V=i(()=>({totalActiveTracksCampaigns:w}),[w]),z=i(()=>{if(I)return{numTeams:void 0,avgCompliance:void 0,totalCampaigns:void 0,totalTracks:void 0};let t=0,e=0,s=0,u=0;const n=new Set;return L.forEach(k=>{const c=b.get(k.id);if(c){c.status&&typeof c.status.allPassPercentage=="number"&&(t+=c.status.allPassPercentage,e++),c.groupRef&&n.add(c.groupRef);const B=[c];for(;B.length>0;){const dt=B.pop();for(const A of dt.children)n.has(A.groupRef)||(n.add(A.groupRef),B.push(A))}}Ft(c?.status)&&(k.type==="campaign"?s++:u++)}),{numTeams:n.size,avgCompliance:e>0?Math.round(t/e):0,totalCampaigns:s,totalTracks:u}},[L,b,I]),d=i(()=>{if(h)return{numEntities:void 0};const t=H?.[r];return{numEntities:Gt(t)}},[H,h,r]),mt=i(()=>({...V,...z,...d}),[V,z,d]),W=X(Mt),q=X($t),lt=wt(t=>{if(!r)return;const e=new URLSearchParams;e.set("group",r),e.set("node",r);const s=p.find(({id:n})=>n===t);let u=W({trackId:t});if(s){const n=N?.edges.find(({node:k})=>k.track.id===t)?.node.id;n&&(u=q({campaignId:n}))}G(`${u}?${e.toString()}`)},[r,G,p,N,q,W]),J=r?T.forEntity(r).snapshot.primaryTitle:void 0,P=i(()=>!o||o.totalTracks===0?0:o.loadedTracks/o.totalTracks*100,[o]),K=f&&r&&!E||I&&o&&o.totalTracks>0,Q=rt?.getLCPValue();Rt(()=>{if(!h&&!f&&(P===100||m.length===0)){const t=d.numEntities??0,e=m.length;$({lcp:Q,numberOfEntities:d.numEntities,entitiesBucket:Nt(t),numberOfTracks:m.length,tracksBucket:Dt(e)})}},[h,f,P,m.length,d.numEntities,$,Q]);const pt=a(jt,{summaryStats:mt,isLoading:O});return j?a(U,{mt:"6",children:a(Ht,{title:"No Tech Insights Data",body:"There was an error loading Tech Insights data."})}):x(ut,{children:[a(ht,{title:`${J?`${J}'s `:""}Tech Insights`,customActions:x(kt,{align:"center",gap:"3",children:[a(Ot,{hideSelected:!0}),a(yt,{isDisabled:Et(S),value:l,onChange:tt,placeholder:"Search tracks or campaigns",style:{minWidth:250},"aria-label":"Search"})]})}),x(Tt,{className:Y.container,children:[a(U,{style:{marginTop:0},children:pt}),K&&a(U,{style:{marginBottom:16},children:a(Ct,{variant:o&&o.totalTracks>0?"determinate":"indeterminate",value:o&&o.totalTracks>0?P:void 0,"data-testid":"batch-loading-indicator"})}),a(Vt,{tracks:L,trackStatusMap:b,trackCountsMap:ct,sortColumn:at,order:ot,handleSort:it,handleTrackClick:lt,isLoading:O||!!K,isSearch:!!l,activeTrackCount:w,hasGroupSelected:!!r})]})]})};export{Wt as TechInsightsPageBUI};
1
+ import{jsx as a,jsxs as g,Fragment as Te}from"react/jsx-runtime";import{useRouteRef as R,useApi as ye}from"@backstage/core-plugin-api";import{entityPresentationApiRef as Ce}from"@backstage/plugin-catalog-react";import{Box as S,HeaderPage as Re,Flex as N,SearchField as Se,Container as Ee,Text as we,Button as Z}from"@backstage/ui";import{makeStyles as Le,LinearProgress as ve}from"@material-ui/core";import{RiAddLine as _}from"@remixicon/react";import{isEmpty as be}from"lodash";import{useState as ee,useMemo as i,useCallback as Be,useEffect as Ie}from"react";import{useSearchParams as Pe,useNavigate as Ae}from"react-router-dom";import xe from"react-use/lib/useDebounce";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@spotify/backstage-plugin-soundcheck-common";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{useSortTableLocalStorage as Me}from"../../hooks/useSortTableLocalStorage.esm.js";import{useBatchedHierarchicalTrackStatuses as Ue}from"../../hooks/heirarchy/useBatchedHierarchicalTrackStatuses.esm.js";import{useGroupHierarchy as $e}from"../../hooks/heirarchy/useGroupHierarchy.esm.js";import{useTracksApplicableToGroup as Ne}from"../../hooks/tracks/useTracksApplicableToGroup.esm.js";import{useLCPReporting as je}from"../../hooks/useLCPReporting.esm.js";import{useLoadTimeReporting as De}from"../../hooks/useLoadTimeReporting.esm.js";import{newTrackRouteRef as Fe,campaignCreateRouteRef as Ge,trackExplorerRouteRef as He,campaignExplorerRouteRef as Oe}from"../../routes.esm.js";import{getAllOwnedEntityCount as ze}from"../../utils/getAllOwnedEntityCount.esm.js";import{getEntitiesBucket as Ve,getTracksBucket as We}from"../../utils/helpers.esm.js";import{showTrack as Xe}from"../../utils/tracks.esm.js";import"../EmptyState/EmptyState.esm.js";import{EmptyStateBUI as qe}from"../EmptyState/EmptyStateBUI.esm.js";import"@backstage/plugin-permission-react";import{TechInsightsGroupSelector as Je}from"../TechInsightsGroupSelector/TechInsightsGroupSelector.esm.js";import{SummaryTilesBUI as Ke}from"./SummaryTilesBUI.esm.js";import{TechInsightsTableBUI as Qe}from"./TechInsightsTableBUI.esm.js";const Ye=Le(()=>({container:{marginBottom:"var(--bui-space-12)"}})),Ze=()=>{const te=Ye(),[E,re]=Pe(),r=E.get("group")||"",[l,ae]=ee(E.get("search")||""),[h,oe]=ee(""),j=i(()=>({routeName:"soundcheck-tech-insights",additionalAttributes:{group:r||"",tracksSearch:h||""}}),[r,h]),{reportContentLoaded:D}=De({...j,enabled:!!r}),{reporter:ie}=je(j),f=Ae(),ne=R(Fe),se=R(Ge),w=ye(Ce),{order:ce,orderBy:me,handleSort:le}=Me({localStoragePrefix:"soundcheck-tech-insights",defaultSortBy:"entities",defaultDirection:"desc"});xe(()=>{oe(l);const e=new URLSearchParams(E.toString());l?e.set("search",l):e.delete("search"),re(e,{replace:!0})},500,[l]);const{tracks:L,campaigns:F,counts:v,isLoading:k,error:b,activeTrackCount:B}=Ne(r,{},{enabled:!!r}),d=L.filter(e=>e.type==="campaign"),I=L.filter(e=>e.type!=="campaign"),G=d.filter(e=>{const t=h.toLowerCase(),s=(e.ownerEntityRef?w.forEntity(e.ownerEntityRef):void 0)?.snapshot.primaryTitle?.toLowerCase()||"";return t===""||e.name.toLowerCase().includes(t)||e.ownerEntityRef?.toLowerCase().includes(t)||s.includes(t)}),H=I.filter(e=>{const t=h.toLowerCase(),s=(e.ownerEntityRef?w.forEntity(e.ownerEntityRef):void 0)?.snapshot.primaryTitle?.toLowerCase()||"";return t===""||e.name.toLowerCase().includes(t)||e.ownerEntityRef?.toLowerCase().includes(t)||s.includes(t)}),T=i(()=>[...G,...H],[G,H]),m=i(()=>[...d.map(e=>e.id),...I.map(e=>e.id)],[d,I]),{data:P,isLoading:de,error:pe,progress:o}=Ue({trackIds:m,groupRef:r||"",skip:!r||m.length===0}),{data:O,isLoading:y}=$e(r,{includeParent:!0}),A=i(()=>{const e=new Map;return Array.isArray(P)&&P.forEach(t=>{t&&t.trackId&&e.set(t.trackId,t)}),e},[P]),ue=i(()=>{const e=new Map;return Array.isArray(v)&&v.forEach(t=>{t&&t.id&&e.set(t.id,t.applicableEntityCount)}),e},[v]),z=k&&!b&&!!r,V=b||pe,x=m.length>0&&de&&!V&&!!r,W=i(()=>({totalActiveTracksCampaigns:B}),[B]),X=i(()=>{if(x)return{numTeams:void 0,avgCompliance:void 0,totalCampaigns:void 0,totalTracks:void 0};let e=0,t=0,s=0,u=0;const n=new Set;return T.forEach(C=>{const c=A.get(C.id);if(c){c.status&&typeof c.status.allPassPercentage=="number"&&(e+=c.status.allPassPercentage,t++),c.groupRef&&n.add(c.groupRef);const U=[c];for(;U.length>0;){const ke=U.pop();for(const $ of ke.children)n.has($.groupRef)||(n.add($.groupRef),U.push($))}}Xe(c?.status)&&(C.type==="campaign"?s++:u++)}),{numTeams:n.size,avgCompliance:t>0?Math.round(e/t):0,totalCampaigns:s,totalTracks:u}},[T,A,x]),p=i(()=>{if(y)return{numEntities:void 0};const e=O?.[r];return{numEntities:ze(e)}},[O,y,r]),ge=i(()=>({...W,...X,...p}),[W,X,p]),q=R(He),J=R(Oe),he=Be(e=>{if(!r)return;const t=new URLSearchParams;t.set("group",r),t.set("node",r);const s=d.find(({id:n})=>n===e);let u=q({trackId:e});if(s){const n=F?.edges.find(({node:C})=>C.track.id===e)?.node.id;n&&(u=J({campaignId:n}))}f(`${u}?${t.toString()}`)},[r,f,d,F,J,q]),K=r?w.forEntity(r).snapshot.primaryTitle:void 0,M=i(()=>!o||o.totalTracks===0?0:o.loadedTracks/o.totalTracks*100,[o]),Q=k&&r&&!b||x&&o&&o.totalTracks>0,Y=ie?.getLCPValue();Ie(()=>{if(!y&&!k&&(M===100||m.length===0)){const e=p.numEntities??0,t=m.length;D({lcp:Y,numberOfEntities:p.numEntities,entitiesBucket:Ve(e),numberOfTracks:m.length,tracksBucket:We(t)})}},[y,k,M,m.length,p.numEntities,D,Y]);const fe=a(Ke,{summaryStats:ge,isLoading:z});return V?a(S,{mt:"6",children:a(qe,{title:"No Tech Insights Data",body:"There was an error loading Tech Insights data."})}):g(Te,{children:[a(Re,{title:`${K?`${K}'s `:""}Tech Insights`,customActions:g(N,{align:"center",gap:"3",children:[a(Je,{hideSelected:!0}),a(Se,{isDisabled:be(L),value:l,onChange:ae,placeholder:"Search tracks or campaigns",style:{minWidth:250},"aria-label":"Search"})]})}),g(Ee,{className:te.container,children:[a(S,{style:{marginTop:0},children:fe}),Q&&a(S,{style:{marginBottom:16},children:a(ve,{variant:o&&o.totalTracks>0?"determinate":"indeterminate",value:o&&o.totalTracks>0?M:void 0,"data-testid":"batch-loading-indicator"})}),g(N,{align:"center",justify:"between",mb:"6",mt:"6",children:[a(S,{children:a(we,{variant:"title-x-small",weight:"bold",children:"Tracks & Campaigns"})}),T.length>0&&g(N,{align:"center",gap:"1",children:[a(Z,{iconStart:a(_,{}),onClick:()=>f(ne()),children:"Create Track"}),a(Z,{iconStart:a(_,{}),onClick:()=>f(se()),children:"Create Campaign"})]})]}),a(Qe,{tracks:T,trackStatusMap:A,trackCountsMap:ue,sortColumn:me,order:ce,handleSort:le,handleTrackClick:he,isLoading:z||!!Q,isSearch:!!l,activeTrackCount:B,hasGroupSelected:!!r})]})]})};export{Ze as TechInsightsPageBUI};
2
2
  //# sourceMappingURL=TechInsightsPageBUI.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as t,jsxs as c,Fragment as v}from"react/jsx-runtime";import{useRouteRef as S}from"@backstage/core-plugin-api";import{TableRoot as N,TableHeader as T,Column as h,TableBody as B,TablePagination as E,Row as k,CellProfile as O,CellText as z,Flex as M,Box as w,Text as D}from"@backstage/ui";import{makeStyles as L}from"@material-ui/core";import{sortBy as $}from"lodash";import{useMemo as u}from"react";import{useNavigate as j,createSearchParams as F}from"react-router-dom";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@backstage/plugin-catalog-react";import"@spotify/backstage-plugin-soundcheck-common";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{useSearchName as H}from"../../hooks/useSearchName.esm.js";import{usePagination as A}from"../../hooks/usePagination.esm.js";import{useSortTableLocalStorage as G}from"../../hooks/useSortTableLocalStorage.esm.js";import{useProfileImages as Q}from"../../hooks/catalog/useProfileImages.esm.js";import{trackOverviewRouteRef as U,campaignOverviewRouteRef as V}from"../../routes.esm.js";import{CustomCell as W}from"../CustomCell/CustomCell.esm.js";import"../EmptyState/EmptyState.esm.js";import{EmptyStateBUI as X}from"../EmptyState/EmptyStateBUI.esm.js";import"@backstage/plugin-permission-react";import"@remixicon/react";import{LoadingTableSkeleton as q}from"../LoadingTableSkeleton/LoadingTableSkeleton.esm.js";import{StatusBar as J}from"../StatusBar/StatusBar.esm.js";const y=10,K=(e,m=[])=>{const o=[],a=r=>{!r.children||r.children.length===0?r.numberOfEntities>0&&o.push(r):(m.includes(r.entityRef)&&r.numberOfEntities>0&&o.push(r),r.children.forEach(l=>a(l)))};return a(e),o},Y=L(()=>({statusPercent:{width:"var(--bui-space-12)"},statusBar:{width:"100%"}})),Z=({row:e,profileImageMap:m,trackId:o,campaignId:a})=>{const r=Y(),l=S(U),p=S(V),s=j();return c(k,{onAction:()=>{o&&s({pathname:a?p({campaignId:a}):l({trackId:o}),search:`?${F({owners:[e.entityRef]})}`})},children:[t(O,{name:e.name,src:m[e.entityRef]??e.name}),t(z,{title:`${e.numberOfEntities} ${e.numberOfEntities===1?"entity":"entities"}`}),t(W,{children:c(M,{align:"center",gap:"2",children:[t(w,{className:r.statusPercent,children:c(D,{children:[e.passPercentage,"%"]})}),t(w,{className:r.statusBar,children:t(J,{passedPercent:e.passPercentage,failedPercent:e.failPercentage,warningPercent:e.warningPercentage,notReportedPercent:e.notReportedPercentage,errorPercent:e.errorPercentage})})]})})]})},_=({tableData:e,isLoading:m,trackId:o,selectedGroup:a,searchValue:r,campaignId:l})=>{const{order:p,orderBy:s,handleSort:b}=G({localStoragePrefix:"soundcheck-tech-insights-explorer",defaultSortBy:"entities",defaultDirection:"desc"}),d=u(()=>e?K(e,a?[a]:[]):[],[a,e]),P=H({items:d,searchTerm:r}),g=u(()=>{const i=$(P??[],f=>s==="name"?f.name:s==="passPercentage"?f.passPercentage:s==="entities"?f.numberOfEntities:0);return p==="desc"&&i.reverse(),i},[P,p,s]),R=u(()=>d.map(i=>i.entityRef),[d]),{paginatedItems:I,paginationProps:n}=A({pageParam:"perPage",defaultPageSize:y,items:g}),x=g.length>y,{profileImageMap:C}=Q(R);return m?t(q,{rowCount:10}):!m&&!g.length?t(X,{title:"No groups found",body:"No groups found for the current selection."}):c(v,{children:[c(N,{sortDescriptor:{column:s,direction:p==="asc"?"ascending":"descending"},onSortChange:i=>b(i.column),children:[c(T,{children:[t(h,{allowsSorting:!0,id:"name",isRowHeader:!0,style:{width:"75%"},children:"Name"}),t(h,{allowsSorting:!0,id:"entities",style:{width:"10%"},children:"Entities"}),t(h,{allowsSorting:!0,id:"passPercentage",style:{width:"15%"},children:"Compliance"})]}),t(B,{children:I.map(i=>t(Z,{profileImageMap:C??{},row:i,trackId:o,campaignId:l},i.entityRef))})]}),x&&t(E,{totalCount:g.length,offset:n.offset,hasNextPage:n.offset+n.pageSize<(g.length??0),hasPreviousPage:n.offset>0,onNextPage:n.onNextPage,onPreviousPage:n.onPreviousPage,onPageSizeChange:n.onPageSizeChange,pageSize:n.pageSize})]})};export{_ as TechInsightsExplorerTable};
1
+ import{jsx as t,jsxs as c,Fragment as v}from"react/jsx-runtime";import{useRouteRef as y}from"@backstage/core-plugin-api";import{useEntityPresentation as C}from"@backstage/plugin-catalog-react";import{TableRoot as N,TableHeader as E,Column as h,TableBody as B,TablePagination as k,Row as O,CellProfile as z,CellText as M,Flex as D,Box as w,Text as L}from"@backstage/ui";import{makeStyles as $}from"@material-ui/core";import{sortBy as j}from"lodash";import{useMemo as P}from"react";import{useNavigate as F,createSearchParams as H}from"react-router-dom";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@spotify/backstage-plugin-soundcheck-common";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{useSearchName as A}from"../../hooks/useSearchName.esm.js";import{usePagination as G}from"../../hooks/usePagination.esm.js";import{useSortTableLocalStorage as U}from"../../hooks/useSortTableLocalStorage.esm.js";import{useProfileImages as V}from"../../hooks/catalog/useProfileImages.esm.js";import{trackOverviewRouteRef as W,campaignOverviewRouteRef as X}from"../../routes.esm.js";import{CustomCell as Y}from"../CustomCell/CustomCell.esm.js";import"../EmptyState/EmptyState.esm.js";import{EmptyStateBUI as q}from"../EmptyState/EmptyStateBUI.esm.js";import"@backstage/plugin-permission-react";import"@remixicon/react";import{LoadingTableSkeleton as J}from"../LoadingTableSkeleton/LoadingTableSkeleton.esm.js";import{StatusBar as K}from"../StatusBar/StatusBar.esm.js";const R=10,Q=(e,m=[])=>{const o=[],a=r=>{!r.children||r.children.length===0?r.numberOfEntities>0&&o.push(r):(m.includes(r.entityRef)&&r.numberOfEntities>0&&o.push(r),r.children.forEach(l=>a(l)))};return a(e),o},Z=$(()=>({statusPercent:{width:"var(--bui-space-12)"},statusBar:{width:"100%"}})),_=({row:e,profileImageMap:m,trackId:o,campaignId:a})=>{const r=Z(),l=y(W),p=y(X),s=F(),{primaryTitle:d}=C(e.entityRef);return c(O,{onAction:()=>{o&&s({pathname:a?p({campaignId:a}):l({trackId:o}),search:`?${H({owners:[e.entityRef]})}`})},children:[t(z,{name:d,src:m[e.entityRef]??d}),t(M,{title:`${e.numberOfEntities} ${e.numberOfEntities===1?"entity":"entities"}`}),t(Y,{children:c(D,{align:"center",gap:"2",children:[t(w,{className:r.statusPercent,children:c(L,{children:[e.passPercentage,"%"]})}),t(w,{className:r.statusBar,children:t(K,{passedPercent:e.passPercentage,failedPercent:e.failPercentage,warningPercent:e.warningPercentage,notReportedPercent:e.notReportedPercentage,errorPercent:e.errorPercentage})})]})})]})},ee=({tableData:e,isLoading:m,trackId:o,selectedGroup:a,searchValue:r,campaignId:l})=>{const{order:p,orderBy:s,handleSort:d}=U({localStoragePrefix:"soundcheck-tech-insights-explorer",defaultSortBy:"entities",defaultDirection:"desc"}),f=P(()=>e?Q(e,a?[a]:[]):[],[a,e]),S=A({items:f,searchTerm:r}),g=P(()=>{const i=j(S??[],u=>s==="name"?u.name:s==="passPercentage"?u.passPercentage:s==="entities"?u.numberOfEntities:0);return p==="desc"&&i.reverse(),i},[S,p,s]),b=P(()=>f.map(i=>i.entityRef),[f]),{paginatedItems:I,paginationProps:n}=G({pageParam:"perPage",defaultPageSize:R,items:g}),x=g.length>R,{profileImageMap:T}=V(b);return m?t(J,{rowCount:10}):!m&&!g.length?t(q,{title:"No groups found",body:"No groups found for the current selection."}):c(v,{children:[c(N,{sortDescriptor:{column:s,direction:p==="asc"?"ascending":"descending"},onSortChange:i=>d(i.column),children:[c(E,{children:[t(h,{allowsSorting:!0,id:"name",isRowHeader:!0,style:{width:"75%"},children:"Name"}),t(h,{allowsSorting:!0,id:"entities",style:{width:"10%"},children:"Entities"}),t(h,{allowsSorting:!0,id:"passPercentage",style:{width:"15%"},children:"Compliance"})]}),t(B,{children:I.map(i=>t(_,{profileImageMap:T??{},row:i,trackId:o,campaignId:l},i.entityRef))})]}),x&&t(k,{totalCount:g.length,offset:n.offset,hasNextPage:n.offset+n.pageSize<(g.length??0),hasPreviousPage:n.offset>0,onNextPage:n.onNextPage,onPreviousPage:n.onPreviousPage,onPageSizeChange:n.onPageSizeChange,pageSize:n.pageSize})]})};export{ee as TechInsightsExplorerTable};
2
2
  //# sourceMappingURL=TechInsightsExplorerTable.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as r,Fragment as y,jsxs as i}from"react/jsx-runtime";import{Flex as f,Text as h,Button as s,Box as g}from"@backstage/ui";import{makeStyles as z}from"@material-ui/core/styles";import{RiSubtractLine as O,RiAddLine as _}from"@remixicon/react";import{useState as v,useContext as M}from"react";import{DialogTrigger as P,Popover as F,Dialog as R,OverlayTriggerStateContext as C,NumberField as E,Label as U,Group as L,Input as j}from"react-aria-components";import{useSearchParams as k}from"react-router-dom";import"../../utils/facetFilters/types.esm.js";import{MAX_NUMBER_OF_DAYS as N,DEFAULT_NUMBER_OF_DAYS as x,MIN_NUMBER_OF_DAYS as p}from"../../utils/facetFilters/utils.esm.js";const V=[{label:"7D",value:7},{label:"1M",value:x},{label:"2M",value:60},{label:"3M",value:N}],Y=z(()=>({centerText:{textAlign:"center"},group:{display:"flex",alignItems:"center",justifyContent:"center"},inputButton:{display:"flex",alignItems:"center"},dialog:{background:"var(--bui-bg-surface-1)",padding:"var(--bui-space-3)",borderRadius:"var(--bui-radius-3)",border:"1px solid var(--bui-border)"},pointer:{cursor:"pointer"},dialogTriggerButton:{padding:"0 !important",fontWeight:"normal",height:"0 !important",color:"var(--bui-fg-secondary) !important",fontSize:"var(--bui-font-size-2) !important"}})),w=({maxNumberOfDays:o=N})=>{const a=Y(),[c,S]=k(),m=c.get("numberOfDays"),T=m!==null&&!isNaN(Number(m))?Number(m):x,[B,D]=v(T),u=t=>{if(D(t),c.get("numberOfDays")!==String(t)){const l=new URLSearchParams(c);l.set("numberOfDays",String(t)),S(l,{replace:!0})}},I=()=>{const t=M(C),[l,d]=v(String(B)),b=e=>{let n;if(typeof e=="string"){if(!e.length)return!0;n=parseInt(e,10)}else n=e;return!isNaN(n)&&n>=p&&n<=o},A=e=>{if(e.key==="Enter"){const n=parseInt(e.currentTarget.value,10);b(n)&&(u(n),t?.close())}};return i(y,{children:[i(E,{minValue:p,maxValue:o,value:parseInt(l,10),children:[i(g,{mb:"2",children:[r(g,{style:{textAlign:"center"},children:r(U,{className:a.centerText,id:"number-days",children:"Number of days"})}),r(g,{style:{textAlign:"center"},children:i(h,{variant:"body-small",color:"secondary","aria-labelledby":"number-days",children:["Enter a value from ",p," to ",o]})})]}),i(L,{className:a.group,children:[r(s,{slot:"decrement",variant:"tertiary",size:"small",className:a.inputButton,onPress:()=>{d(e=>String(parseInt(e,10)-1))},children:r(O,{size:8})}),r(j,{onKeyDown:A,size:5,className:a.centerText,onChange:e=>d(e.currentTarget.value)}),r(s,{slot:"increment",variant:"tertiary",size:"small",className:a.inputButton,onPress:()=>{d(e=>String(parseInt(e,10)+1))},children:r(_,{size:8})})]})]}),r(f,{align:"center",justify:"center",mt:"2",children:r(s,{style:{height:"auto"},variant:"tertiary",size:"small",onPress:()=>{const e=parseInt(l,10);b(e)&&(u(e),t?.close())},children:"Apply"})})]})};return r(y,{children:i(f,{align:"center",children:[V.filter(({value:t})=>t<=o).map(t=>r(h,{variant:"body-small",color:"secondary",className:a.pointer,onClick:()=>u(t.value),children:t.label},t.value)),i(P,{children:[r(s,{variant:"tertiary",size:"small",className:a.dialogTriggerButton,children:"Custom"}),r(F,{children:r(R,{className:a.dialog,children:r(I,{})})})]})]})})};export{w as TimePeriodBarBUI};
1
+ import{jsx as r,Fragment as y,jsxs as i}from"react/jsx-runtime";import{Flex as f,Text as h,Button as s,Box as g}from"@backstage/ui";import{makeStyles as z}from"@material-ui/core/styles";import{RiSubtractLine as O,RiAddLine as _}from"@remixicon/react";import{useState as v,useContext as M}from"react";import{DialogTrigger as P,Popover as F,Dialog as R,OverlayTriggerStateContext as C,NumberField as E,Label as U,Group as L,Input as j}from"react-aria-components";import{useSearchParams as k}from"react-router-dom";import"../../utils/facetFilters/types.esm.js";import{MAX_NUMBER_OF_DAYS as N,DEFAULT_NUMBER_OF_DAYS as x,MIN_NUMBER_OF_DAYS as p}from"../../utils/facetFilters/utils.esm.js";const V=[{label:"7D",value:7},{label:"1M",value:x},{label:"2M",value:60},{label:"3M",value:N}],Y=z(()=>({centerText:{textAlign:"center"},group:{display:"flex",alignItems:"center",justifyContent:"center"},inputButton:{display:"flex",alignItems:"center"},dialog:{background:"var(--bui-bg-popover)",padding:"var(--bui-space-3)",borderRadius:"var(--bui-radius-3)",border:"1px solid var(--bui-border)"},pointer:{cursor:"pointer"},dialogTriggerButton:{padding:"0 !important",fontWeight:"normal",height:"0 !important",color:"var(--bui-fg-secondary) !important",fontSize:"var(--bui-font-size-2) !important"}})),w=({maxNumberOfDays:o=N})=>{const a=Y(),[c,S]=k(),m=c.get("numberOfDays"),T=m!==null&&!isNaN(Number(m))?Number(m):x,[B,D]=v(T),u=t=>{if(D(t),c.get("numberOfDays")!==String(t)){const l=new URLSearchParams(c);l.set("numberOfDays",String(t)),S(l,{replace:!0})}},I=()=>{const t=M(C),[l,d]=v(String(B)),b=e=>{let n;if(typeof e=="string"){if(!e.length)return!0;n=parseInt(e,10)}else n=e;return!isNaN(n)&&n>=p&&n<=o},A=e=>{if(e.key==="Enter"){const n=parseInt(e.currentTarget.value,10);b(n)&&(u(n),t?.close())}};return i(y,{children:[i(E,{minValue:p,maxValue:o,value:parseInt(l,10),children:[i(g,{mb:"2",children:[r(g,{style:{textAlign:"center"},children:r(U,{className:a.centerText,id:"number-days",children:"Number of days"})}),r(g,{style:{textAlign:"center"},children:i(h,{variant:"body-small",color:"secondary","aria-labelledby":"number-days",children:["Enter a value from ",p," to ",o]})})]}),i(L,{className:a.group,children:[r(s,{slot:"decrement",variant:"tertiary",size:"small",className:a.inputButton,onPress:()=>{d(e=>String(parseInt(e,10)-1))},children:r(O,{size:8})}),r(j,{onKeyDown:A,size:5,className:a.centerText,onChange:e=>d(e.currentTarget.value)}),r(s,{slot:"increment",variant:"tertiary",size:"small",className:a.inputButton,onPress:()=>{d(e=>String(parseInt(e,10)+1))},children:r(_,{size:8})})]})]}),r(f,{align:"center",justify:"center",mt:"2",children:r(s,{style:{height:"auto"},variant:"tertiary",size:"small",onPress:()=>{const e=parseInt(l,10);b(e)&&(u(e),t?.close())},children:"Apply"})})]})};return r(y,{children:i(f,{align:"center",children:[V.filter(({value:t})=>t<=o).map(t=>r(h,{variant:"body-small",color:"secondary",className:a.pointer,onClick:()=>u(t.value),children:t.label},t.value)),i(P,{children:[r(s,{variant:"tertiary",size:"small",className:a.dialogTriggerButton,children:"Custom"}),r(F,{children:r(R,{className:a.dialog,children:r(I,{})})})]})]})})};export{w as TimePeriodBarBUI};
2
2
  //# sourceMappingURL=TimePeriodBarBUI.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as o,jsx as t}from"react/jsx-runtime";import{useMemo as g,useCallback as B,createElement as S}from"react";import{useRouteRef as $,useApi as G}from"@backstage/core-plugin-api";import{entityPresentationApiRef as W}from"@backstage/plugin-catalog-react";import{Flex as b,Card as k,Text as N,Box as v,Avatar as D}from"@backstage/ui";import{makeStyles as U}from"@material-ui/core";import{isEmpty as C}from"lodash";import{useNavigate as q,createSearchParams as J}from"react-router-dom";import{useProfileImages as K}from"../../hooks/catalog/useProfileImages.esm.js";import{trackOverviewRouteRef as Q,campaignOverviewRouteRef as V}from"../../routes.esm.js";import{getPercentage as T}from"../../utils/formatters.esm.js";import"../EmptyState/EmptyState.esm.js";import{EmptyStateBUI as A}from"../EmptyState/EmptyStateBUI.esm.js";import"@backstage/plugin-permission-react";import"@remixicon/react";import"@spotify/backstage-plugin-soundcheck-common";import{getLeafNodes as X}from"../HierarchicalTechInsightsPage/getLeafNodes.esm.js";import{LoadingTableSkeleton as E}from"../LoadingTableSkeleton/LoadingTableSkeleton.esm.js";import{StatusBar as Y}from"../StatusBar/StatusBar.esm.js";const M=U(()=>({topTeamCard:{padding:"var(--bui-space-3) var(--bui-space-5)",minWidth:400},topTeamCardRows:{minHeight:"calc(var(--bui-space-6) * 6.5)",cursor:"pointer"},topTeamCardRow:{display:"flex",flexDirection:"row",gridGap:1,alignItems:"center",width:"100%",padding:"var(--bui-space-2)",marginBottom:"var(--bui-space-2)",backgroundColor:"var(--bui-bg-surface-2)",border:"1px solid var(--bui-bg-surface-2)",borderRadius:"var(--bui-radius-2)"},infoButton:{"&:hover":{backgroundColor:"inherit !important"}},teamName:{width:"75%"},percentBar:{width:"25%"},statusPercent:{width:"var(--bui-space-12)"},statusBar:{width:"100%"}})),H=({groupRef:a,teamName:i,passPercentage:m,failPercentage:c,warningPercentage:u,notReportedPercentage:f,errorPercentage:P,profileImageMap:l,onClick:h})=>{const s=M();return t(k,{className:`${s.topTeamCardRow}`,onClick:h,children:o(b,{align:"center",gap:"1",style:{flex:1},children:[o(b,{align:"center",gap:"2",className:s.teamName,children:[t(D,{name:i,size:"small",src:l[a]?l[a]:i}),t(N,{children:i})]}),o(b,{align:"center",gap:"1",className:s.percentBar,children:[t(v,{className:s.statusPercent,children:o(N,{color:"secondary",children:[m,"%"]})}),t(v,{className:s.statusBar,children:t(Y,{passedPercent:m,failedPercent:c,warningPercent:u,notReportedPercent:f,errorPercent:P})})]})]})})},Z=({trackStatus:a,isLoading:i,campaignId:m})=>{const c=M(),u=$(Q),f=$(V),P=q(),l=80,h=50,s=G(W),y=g(()=>a?X(a):[],[a]),R=g(()=>y.filter(e=>{const{passed:r,failed:n,warning:O,error:j,notReported:z,exempt:F}=e.status;return r+n+O+j+z+F>0&&!e.children?.length}).sort((e,r)=>(e.status.allPassPercentage??0)-(r.status.allPassPercentage??0)),[y]),w=B(e=>{const r=s.forEntity(e.groupRef).snapshot,n=e.status.failed+e.status.passed+e.status.error+e.status.exempt+e.status.warning+e.status.notReported;return{groupRef:e.groupRef,teamName:r.primaryTitle,passPercentage:e.status.allPassPercentage??0,failPercentage:T(e.status.failed,n),warningPercentage:T(e.status.warning,n),notReportedPercentage:T(e.status.notReported,n),errorPercentage:T(e.status.warning,n),teamInfo:r.secondaryTitle}},[s]),p=g(()=>R.filter(e=>(e.status.allPassPercentage??0)<h).slice(0,3).map(w),[R,w]),d=g(()=>{const e=R.filter(r=>(r.status.allPassPercentage??0)>=l);return e.reverse(),e.slice(0,3).map(w)},[R,w]),L=g(()=>[...d.map(e=>e.groupRef),...p.map(e=>e.groupRef)],[p,d]),{profileImageMap:x}=K(L),I=B(e=>{let r;if(m?r=f({campaignId:m}):a?.trackId&&(r=u({trackId:a.trackId})),r){const n=`${r}?${J({owners:[e]})}`;P(n)}},[f,u,P,m,a?.trackId]);return o(b,{children:[o(k,{className:c.topTeamCard,children:[t(N,{variant:"title-x-small",weight:"bold",children:"Teams Needing Attention"}),i&&t(E,{rowCount:3,rowHeight:40}),!i&&o(v,{className:c.topTeamCardRows,children:[!C(p)&&p.map(e=>S(H,{profileImageMap:x??{},...e,key:e.groupRef,onClick:()=>I(e.groupRef)})),C(p)&&t(A,{title:"No teams eligible",body:`None of your teams are performing below ${h}% compliance.`})]})]}),o(k,{className:c.topTeamCard,children:[t(N,{variant:"title-x-small",weight:"bold",children:"Top Performing Teams"}),i&&t(E,{rowCount:3,rowHeight:40}),!i&&o(v,{className:c.topTeamCardRows,children:[!C(d)&&d.map(e=>S(H,{profileImageMap:x??{},...e,key:e.groupRef,onClick:()=>I(e.groupRef)})),C(d)&&t(A,{title:"No teams eligible",body:`None of your teams are performing above ${l}% compliance.`})]})]})]})};export{Z as TopAndBottomPerformingTeams};
1
+ import{jsxs as o,jsx as t}from"react/jsx-runtime";import{useMemo as g,useCallback as B,createElement as S}from"react";import{useRouteRef as $,useApi as G}from"@backstage/core-plugin-api";import{entityPresentationApiRef as W}from"@backstage/plugin-catalog-react";import{Flex as b,Card as k,Text as N,Box as v,Avatar as D}from"@backstage/ui";import{makeStyles as U}from"@material-ui/core";import{isEmpty as C}from"lodash";import{useNavigate as q,createSearchParams as J}from"react-router-dom";import{useProfileImages as K}from"../../hooks/catalog/useProfileImages.esm.js";import{trackOverviewRouteRef as Q,campaignOverviewRouteRef as V}from"../../routes.esm.js";import{getPercentage as T}from"../../utils/formatters.esm.js";import"../EmptyState/EmptyState.esm.js";import{EmptyStateBUI as A}from"../EmptyState/EmptyStateBUI.esm.js";import"@backstage/plugin-permission-react";import"@remixicon/react";import"@spotify/backstage-plugin-soundcheck-common";import{getLeafNodes as X}from"../HierarchicalTechInsightsPage/getLeafNodes.esm.js";import{LoadingTableSkeleton as E}from"../LoadingTableSkeleton/LoadingTableSkeleton.esm.js";import{StatusBar as Y}from"../StatusBar/StatusBar.esm.js";const M=U(()=>({topTeamCard:{padding:"var(--bui-space-3) var(--bui-space-5)",minWidth:400},topTeamCardRows:{minHeight:"calc(var(--bui-space-6) * 6.5)",cursor:"pointer"},topTeamCardRow:{display:"flex",flexDirection:"row",gridGap:1,alignItems:"center",width:"100%",padding:"var(--bui-space-2)",marginBottom:"var(--bui-space-2)",backgroundColor:"var(--bui-bg-neutral-2)",border:"1px solid var(--bui-bg-neutral-2)",borderRadius:"var(--bui-radius-2)"},infoButton:{"&:hover":{backgroundColor:"inherit !important"}},teamName:{width:"75%"},percentBar:{width:"25%"},statusPercent:{width:"var(--bui-space-12)"},statusBar:{width:"100%"}})),H=({groupRef:a,teamName:i,passPercentage:m,failPercentage:l,warningPercentage:u,notReportedPercentage:f,errorPercentage:P,profileImageMap:p,onClick:h})=>{const n=M();return t(k,{className:`${n.topTeamCardRow}`,onClick:h,children:o(b,{align:"center",gap:"1",style:{flex:1},children:[o(b,{align:"center",gap:"2",className:n.teamName,children:[t(D,{name:i,size:"small",src:p[a]?p[a]:i}),t(N,{children:i})]}),o(b,{align:"center",gap:"1",className:n.percentBar,children:[t(v,{className:n.statusPercent,children:o(N,{color:"secondary",children:[m,"%"]})}),t(v,{className:n.statusBar,children:t(Y,{passedPercent:m,failedPercent:l,warningPercent:u,notReportedPercent:f,errorPercent:P})})]})]})})},Z=({trackStatus:a,isLoading:i,campaignId:m})=>{const l=M(),u=$(Q),f=$(V),P=q(),p=80,h=50,n=G(W),y=g(()=>a?X(a):[],[a]),R=g(()=>y.filter(e=>{const{passed:r,failed:s,warning:O,error:j,notReported:z,exempt:F}=e.status;return r+s+O+j+z+F>0&&!e.children?.length}).sort((e,r)=>(e.status.allPassPercentage??0)-(r.status.allPassPercentage??0)),[y]),w=B(e=>{const r=n.forEntity(e.groupRef).snapshot,s=e.status.failed+e.status.passed+e.status.error+e.status.exempt+e.status.warning+e.status.notReported;return{groupRef:e.groupRef,teamName:r.primaryTitle,passPercentage:e.status.allPassPercentage??0,failPercentage:T(e.status.failed,s),warningPercentage:T(e.status.warning,s),notReportedPercentage:T(e.status.notReported,s),errorPercentage:T(e.status.warning,s),teamInfo:r.secondaryTitle}},[n]),c=g(()=>R.filter(e=>(e.status.allPassPercentage??0)<h).slice(0,3).map(w),[R,w]),d=g(()=>{const e=R.filter(r=>(r.status.allPassPercentage??0)>=p);return e.reverse(),e.slice(0,3).map(w)},[R,w]),L=g(()=>[...d.map(e=>e.groupRef),...c.map(e=>e.groupRef)],[c,d]),{profileImageMap:x}=K(L),I=B(e=>{let r;if(m?r=f({campaignId:m}):a?.trackId&&(r=u({trackId:a.trackId})),r){const s=`${r}?${J({owners:[e]})}`;P(s)}},[f,u,P,m,a?.trackId]);return o(b,{children:[o(k,{className:l.topTeamCard,children:[t(N,{variant:"title-x-small",weight:"bold",children:"Teams Needing Attention"}),i&&t(E,{rowCount:3,rowHeight:40}),!i&&o(v,{className:l.topTeamCardRows,children:[!C(c)&&c.map(e=>S(H,{profileImageMap:x??{},...e,key:e.groupRef,onClick:()=>I(e.groupRef)})),C(c)&&t(A,{title:"No teams eligible",body:`None of your teams are performing below ${h}% compliance.`})]})]}),o(k,{className:l.topTeamCard,children:[t(N,{variant:"title-x-small",weight:"bold",children:"Top Performing Teams"}),i&&t(E,{rowCount:3,rowHeight:40}),!i&&o(v,{className:l.topTeamCardRows,children:[!C(d)&&d.map(e=>S(H,{profileImageMap:x??{},...e,key:e.groupRef,onClick:()=>I(e.groupRef)})),C(d)&&t(A,{title:"No teams eligible",body:`None of your teams are performing above ${p}% compliance.`})]})]})]})};export{Z as TopAndBottomPerformingTeams};
2
2
  //# sourceMappingURL=TopAndBottomPerformingTeams.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as i}from"react/jsx-runtime";import{useRouteRef as F}from"@backstage/core-plugin-api";import{Container as L,Box as g,Flex as o,Button as t,Dialog as z,DialogHeader as E,DialogBody as N,DialogFooter as I}from"@backstage/ui";import{makeStyles as O}from"@material-ui/core";import{RiCloseLine as A,RiArrowLeftLine as P,RiRestartLine as G,RiArrowRightLine as H}from"@remixicon/react";import{useState as s}from"react";import{useNavigate as Q}from"react-router-dom";import{tracksPageRouteRef as q}from"../../routes.esm.js";import{Stepper as J}from"../Stepper/Stepper.esm.js";import{RunFirstCheckStep as K}from"./RunFirstCheckStep.esm.js";import{SelectTracksStep as M}from"./SelectTracksStep.esm.js";const U=O(()=>({container:{margin:"0 0 var(--bui-space-12)"},content:{width:"50%",margin:"0 auto"}})),V=()=>{const d=U(),k=F(q),y=Q(),[n,a]=s(0),[l,m]=s([]),C=l.length>0,u=["Select Tracks","Run First Check"],R=n===0,h=n===u.length-1,[x,p]=s(!1),S=()=>p(!0),f=()=>p(!1),T=()=>y(k()),v=()=>{h||a(r=>r+1)},b=()=>{R||a(r=>r-1)},w=(r,j)=>{m(c=>j?c.includes(r)?c:[...c,r]:c.filter(D=>D!==r))},B=()=>{a(0),m([])};return e(L,{className:d.container,children:i(g,{className:d.content,children:[e(o,{justify:"center",align:"center",children:e(J,{stepTitles:u,currentStep:n})}),i(g,{children:[n===0&&e(M,{selectedTrackIds:l,onToggleTrack:w}),n===1&&e(K,{selectedTrackIds:l})]}),i(o,{align:"center",justify:"between",children:[e(o,{align:"center",justify:"between",children:i(t,{size:"medium",variant:"tertiary",onClick:S,children:[e(A,{})," Exit"]})}),h?i(o,{align:"center",justify:"between",children:[i(t,{size:"medium",variant:"secondary",onClick:b,children:[e(P,{})," Go Back"]}),i(t,{size:"medium",variant:"secondary",onClick:B,children:[e(G,{})," Start Over"]})]}):i(t,{size:"medium",variant:"secondary",onClick:v,isDisabled:!C,children:["Next ",e(H,{})]})]}),i(z,{isOpen:x,onOpenChange:f,children:[e(E,{children:"Exit Track Builder?"}),e(N,{children:"If you exit now, your current selections may be lost."}),i(I,{children:[e(t,{variant:"tertiary",onClick:f,children:"Cancel"}),e(t,{variant:"secondary",onClick:T,children:"Exit"})]})]})]})})};export{V as TrackBuilderPage};
1
+ import{jsx as e,jsxs as o,Fragment as st}from"react/jsx-runtime";import{useRouteRef as at}from"@backstage/core-plugin-api";import{Container as z,Flex as S,HeaderPage as ct,Box as U,Button as u,Dialog as nt,DialogHeader as it,DialogBody as ot,DialogFooter as lt}from"@backstage/ui";import{makeStyles as ut}from"@material-ui/core";import{RiCloseLine as dt}from"@remixicon/react";import{useMemo as k,useState as $,useCallback as G,useEffect as x}from"react";import{useSearchParams as mt,useNavigate as St}from"react-router-dom";import ht from"react-use/lib/useLocalStorage";import{useOutOfBoxTracks as pt}from"../../hooks/tracks/useOutOfBoxTracks.esm.js";import{useSaveOutOfBoxTracks as ft}from"../../hooks/tracks/useSaveOutOfBoxTracks.esm.js";import{tracksPageRouteRef as kt}from"../../routes.esm.js";import{LoadingIndicator as gt}from"../LoadingIndicator/LoadingIndicator.esm.js";import{Stepper as bt}from"../Stepper/Stepper.esm.js";import{RunChecksStep as vt}from"./components/RunChecksStep/RunChecksStep.esm.js";import{SelectProviderStep as yt}from"./components/SelectProviderStep/SelectProviderStep.esm.js";import{SelectTracksStep as Tt}from"./components/SelectTracksStep/SelectTracksStep.esm.js";import{PROVIDER_STORAGE_KEY as Ct,fromUrlStep as xt,hasInstallableIntegrations as Bt,getAllowedStep as J,readSessionJSON as It,toUrlStep as Pt,writeSessionJSON as Ot,INTEGRATION_ALIASES as Rt}from"./utils.esm.js";const jt=ut(()=>({container:{margin:"0 0 var(--bui-space-12)"},content:{width:"50%",margin:"0 auto"},successButton:{background:"var(--bui-fg-success) !important","& .bui-ButtonContent":{color:"var(--bui-fg-solid) !important"},'&:not([aria-disabled="true"]):not([data-disabled="true"]):not(:disabled)':{"&:hover":{background:"color-mix(in srgb, var(--bui-fg-success) 75%, white) !important"}},'&[aria-disabled="true"], &[data-disabled="true"], &:disabled':{opacity:.5}}})),B=["Select Provider","Select Tracks","Run Checks"],_=0,H=B.length-1,wt=()=>{const d=jt(),[g,I]=mt(),h=at(kt),b=St(),[v,V]=ht(Ct,null),r=g.get("provider"),p=g.get("tracks"),c=k(()=>p?.split(",").filter(Boolean)??[],[p]),l=c.length>0,P=xt(g.get("step"),_,H),[Y,O]=$(!1),{isLoading:q,data:R,isSuccess:j,isFetchedAfterMount:w}=pt(),{isPending:K,mutateAsync:Q}=ft(),[y,N]=$({tracksStatus:null,checksStatus:null,collectorsStatus:null}),m=k(()=>R?.filter(t=>Bt(t,r)),[R,r]),T=k(()=>{const t=c.slice().sort().join(",");return`trackBuilderStatus:${r??"none"}:${t}`},[r,c]),n=G(t=>{I(s=>{const i=new URLSearchParams(s);for(const[f,M]of Object.entries(t))M===null?i.delete(f):i.set(f,M);return i})},[I]),a=k(()=>J(P,r,l),[P,r,l]),A=a===0,E=a===1,D=a===B.length-1;x(()=>{!r&&v&&n({provider:v})},[r,v,n]),x(()=>{const t=It(T);N(t||{tracksStatus:null,checksStatus:null,collectorsStatus:null})},[T]);const C=G(t=>{const s=Math.max(_,Math.min(H,t)),i=J(s,r,l);n({step:Pt(i)})},[r,l,n]),W=()=>E?O(!0):b(h()),F=()=>O(!1),X=()=>b(h()),L=(t,s)=>{const i=s?Array.from(new Set([...c,t])):c.filter(f=>f!==t);n({tracks:i.length?i.join(","):null})},Z=t=>{const s=Rt[t];V(s??null),n({provider:s??null})};x(()=>{if(!r||!m||p||!j||!w)return;const t=m.filter(s=>s.isInstalled).map(s=>s.id);t.length&&n({tracks:t.join(",")})},[r,p,j,w,m,n]);const tt=async()=>{if(E&&l)try{const t=await Q({trackIds:c,selectedProvider:r}),s={tracksStatus:t.tracksStatus,checksStatus:t.checksStatus,collectorsStatus:t.collectorsStatus};N(s),Ot(T,s)}catch{}D||C(a+1)},et=()=>{A||C(a-1)},rt=()=>b(h());return q?e(z,{className:d.container,children:e(gt,{})}):o(st,{children:[e(S,{justify:"center",align:"center",children:e(ct,{title:"Use Spotify Templates",breadcrumbs:[{label:"All Tracks",href:h()}]})}),e(z,{className:d.container,children:o(U,{className:d.content,children:[e(S,{justify:"center",align:"center",mt:"6",children:e(bt,{stepTitles:B,currentStep:a,onStepClick:C})}),o(U,{children:[a===0&&e(yt,{selectedProvider:r,onSelect:Z}),a===1&&e(Tt,{selectedProvider:r,tracks:m??[],selectedTrackIds:c,onToggleTrack:L}),a===2&&e(vt,{tracksStatus:y.tracksStatus,checksStatus:y.checksStatus,collectorsStatus:y.collectorsStatus,selectedProvider:r,tracks:m??[],selectedTrackIds:c,onToggleTrack:L})]}),o(S,{align:"center",justify:"between",children:[e(S,{align:"center",justify:"between",children:o(u,{size:"small",variant:"tertiary",onClick:W,children:[e(dt,{})," Exit"]})}),o(S,{align:"center",justify:"between",gap:"2",children:[!A&&e(u,{size:"small",variant:"secondary",onClick:et,children:"Back"}),D?e(u,{size:"small",variant:"secondary",onClick:rt,className:d.successButton,children:"Finish"}):e(u,{size:"small",variant:"primary",onClick:tt,isDisabled:a===0&&!r||a===1&&!l,isPending:K,className:d.successButton,children:"Next"})]})]}),o(nt,{isOpen:Y,onOpenChange:F,children:[e(it,{children:"Exit Track Builder?"}),e(ot,{children:"If you exit now, your current selections may be lost."}),o(lt,{children:[e(u,{variant:"tertiary",onClick:F,children:"Cancel"}),e(u,{variant:"secondary",onClick:X,children:"Exit"})]})]})]})})]})};export{wt as TrackBuilderPage};
2
2
  //# sourceMappingURL=TrackBuilderPage.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{jsx as r,jsxs as u,Fragment as $}from"react/jsx-runtime";import{Card as F,CardBody as S,Box as s,Text as o,Button as v}from"@backstage/ui";import{makeStyles as j,CircularProgress as q}from"@material-ui/core";import{RiCheckboxCircleLine as Q,RiCloseCircleLine as f,RiErrorWarningLine as k,RiInformationLine as C,RiCircleLine as x,RiPlayLine as U}from"@remixicon/react";import{NotesSchema as V}from"@spotify/backstage-plugin-soundcheck-common";import{startCase as y}from"lodash";import{ResultState as e}from"../../../../graphql/generated/index.esm.js";import{getUniqueIntegrationFacts as G,getCheckRunsAtString as H,formatCheckItemError as J,checkResultTooltips as K}from"../../utils.esm.js";import{IntegrationTags as O}from"../IntegrationTags/IntegrationTags.esm.js";const X=j(()=>({checkDetailsExpanded:{flex:1,minWidth:0},checkItem:{display:"flex",alignItems:"flex-start",gap:"var(--bui-space-4)",borderBottom:"1px solid var(--bui-border)","&:last-child":{borderBottom:"none"}},checkIconWrapper:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--bui-radius-full)"},installedCircle:{background:"var(--bui-bg-neutral-1)",color:"var(--bui-fg-success)"},notInstalledCircle:{background:"var(--bui-bg-neutral-1)",color:"var(--bui-fg-warning)"},passCircle:{background:"var(--bui-bg-neutral-1)",color:"var(--bui-fg-success)"},failCircle:{background:"var(--bui-bg-neutral-1)",color:"var(--bui-fg-danger)"},warningCircle:{background:"var(--bui-bg-neutral-1)",color:"var(--bui-fg-warning)"},notApplicableCircle:{background:"var(--bui-bg-neutral-1)",color:"var(--bui-fg-secondary)"},checkDetails:{flex:1},checkName:{display:"block",fontWeight:500,marginBottom:"var(--bui-space-1)"},checkDescriptionText:{color:"var(--bui-fg-secondary)",marginBottom:"var(--bui-space-1)"},checkRunsAtText:{color:"var(--bui-fg-primary)"},checkActionsRight:{display:"flex",alignItems:"center",gap:"var(--bui-space-3)",flexShrink:0},passedButton:{backgroundColor:"var(--bui-bg-success)",color:"var(--bui-fg-success)",borderColor:"var(--bui-border-success)"},failedButton:{backgroundColor:"var(--bui-bg-danger)",color:"var(--bui-fg-danger)",borderColor:"var(--bui-border-danger)"},warningButton:{backgroundColor:"var(--bui-bg-warning)",color:"var(--bui-fg-warning)",borderColor:"var(--bui-border-warning)"},notApplicableButton:{backgroundColor:"var(--bui-bg-neutral-2)",color:"var(--bui-fg-secondary)",borderColor:"var(--bui-border)"},resultMessage:{padding:"var(--bui-space-1) var(--bui-space-2)",borderRadius:"var(--bui-radius-2)",marginTop:"var(--bui-space-2)",display:"inline-block",opacity:.8},passMessage:{backgroundColor:"var(--bui-bg-success)",color:"var(--bui-fg-success)"},failMessage:{backgroundColor:"var(--bui-bg-danger)",color:"var(--bui-fg-danger)"},warningMessage:{backgroundColor:"var(--bui-bg-warning)",color:"var(--bui-fg-warning)"},notApplicableMessage:{backgroundColor:"var(--bui-bg-neutral-2)",color:"var(--bui-fg-secondary)"},errorsBulletList:{margin:"var(--bui-space-1) 0 0 var(--bui-space-4)",padding:0,color:"var(--bui-fg-danger)"}})),Y={[e.Passed]:r(Q,{size:16}),[e.Failed]:r(f,{size:16}),[e.Warning]:r(k,{size:16}),[e.Error]:r(f,{size:16}),[e.Exempt]:r(k,{size:16}),[e.NotReported]:r(C,{size:16}),[e.NotApplicable]:r(C,{size:16})},Z=({check:l,selectedProvider:N,mode:w="view",variant:R="select",entityRef:E,isExecutable:d=!0,isExecuting:g=!1,isExecutingAll:I=!1,executingCheckId:A,executedChecks:B=new Map,onExecute:z})=>{const a=X(),b=w==="run",i=B.get(l.id),t=i!==void 0,W=E&&d&&!t&&!g&&!I,p=(l.integrations??[]).flatMap(c=>G(c)),m=H(p),M=()=>{if(t)switch(i.result){case e.Passed:return a.passCircle;case e.Failed:case e.Error:return a.failCircle;case e.Warning:case e.Exempt:return a.warningCircle;case e.NotApplicable:case e.NotReported:default:return a.notApplicableCircle}},L=()=>t?r("div",{title:K[i.result],children:r(s,{className:`${a.checkIconWrapper} ${M()}`,children:Y[i.result]})}):d?r("div",{title:"Integration(s) configured",children:r(s,{className:`${a.checkIconWrapper} ${a.installedCircle}`,children:r(x,{size:16})})}):r("div",{title:"Integration(s) not configured",children:r(s,{className:`${a.checkIconWrapper} ${a.notInstalledCircle}`,children:r(x,{size:16})})}),P=()=>{if(t)switch(i.result){case e.Passed:return a.passedButton;case e.Failed:case e.Error:return a.failedButton;case e.Warning:case e.Exempt:return a.warningButton;case e.NotApplicable:case e.NotReported:default:return a.notApplicableButton}},T=()=>g?r(q,{size:14}):t?y(i.result.toLowerCase()):u($,{children:[r(U,{size:14}),"Execute"]}),D=()=>{if(t)switch(i.result){case e.Passed:return a.passMessage;case e.Failed:case e.Error:return a.failMessage;case e.Warning:case e.Exempt:return a.warningMessage;case e.NotApplicable:case e.NotReported:default:return a.notApplicableMessage}},h=()=>{if(t)switch(i.result){case e.Passed:return"success";case e.Failed:case e.Error:return"danger";case e.Warning:case e.Exempt:return"warning";case e.NotApplicable:case e.NotReported:default:return"secondary"}},n=(()=>{if(!t)return;const c=i.details?.notes?V.safeParse(i.details.notes):void 0;return i.result===e.Error?c?.data?.data?J(c?.data.data):{title:"Execution failed"}:c?.success?{title:c.data.data}:{title:y(i.result.toLowerCase())}})();return r(F,{children:r(S,{children:u(s,{className:a.checkItem,children:[L(),u(s,{className:b?a.checkDetailsExpanded:a.checkDetails,children:[r(o,{className:a.checkName,variant:"body-large",children:l.name}),r(s,{children:r(o,{className:a.checkDescriptionText,variant:"body-small",children:l.description})}),R==="run"&&m&&r(s,{mt:"2",children:r(o,{className:a.checkRunsAtText,variant:"body-small",children:m})}),t&&n&&u(s,{className:`${a.resultMessage} ${D()}`,children:[r(s,{children:r(o,{variant:"body-small",color:h(),children:n.subtitle??n.title})}),n.bullets?.length&&r(s,{children:r("ul",{className:a.errorsBulletList,children:n.bullets.map(c=>r("li",{children:r(o,{variant:"body-small",color:h(),children:c})},c))})})]}),r(s,{mt:"2",children:r(O,{facts:p,selectedProvider:N})})]}),(b||t)&&r(s,{className:a.checkActionsRight,children:d?r(v,{variant:t?"tertiary":"secondary",size:"small",isDisabled:!W||t||!!A,onClick:()=>z?.(l.id),className:P(),children:T()}):r(v,{variant:"tertiary",size:"small",isDisabled:!0,children:"Setup Required"})})]})})},l.id)};export{Z as CheckItem};
2
+ //# sourceMappingURL=CheckItem.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{jsx as o,jsxs as i}from"react/jsx-runtime";import{TagGroup as a,Tag as g,Flex as m}from"@backstage/ui";import{IntegrationLogoBUI as c}from"../../../CollectorsPage/IntegrationLogoBUI.esm.js";import{computeIntegrationTags as p}from"../../utils.esm.js";const s=({facts:e,selectedProvider:t})=>{const n=p(e,t);return o(a,{children:n.map(r=>o(g,{children:i(m,{align:"center",gap:"2",children:[o(c,{integrationId:r.id}),r.name]})},r.id))})};export{s as IntegrationTags};
2
+ //# sourceMappingURL=IntegrationTags.esm.js.map