@spotify/backstage-plugin-soundcheck 0.19.1 → 0.19.3

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 (155) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/config.d.ts +54 -7
  3. package/dist/api.esm.js +1 -1
  4. package/dist/components/CampaignCreatePage/CampaignCreatePage.esm.js +1 -1
  5. package/dist/components/CampaignForm/Steps/CampaignDetailsStep/CampaignOwnerField.esm.js +1 -1
  6. package/dist/components/CampaignPage/CampaignPage.esm.js +2 -0
  7. package/dist/components/CampaignPage/CampaignPageBUI.esm.js +2 -0
  8. package/dist/components/CampaignPage/CampaignPageDeprecated.esm.js +2 -0
  9. package/dist/components/{CampaignInsightsPage → CampaignPage}/CampaignStatusTile.esm.js +1 -1
  10. package/dist/components/CampaignsPage/CampaignListPage/CampaignListPageDeprecated.esm.js +2 -0
  11. package/dist/components/CampaignsPage/CampaignListPageBUI.esm.js +2 -0
  12. package/dist/components/CampaignsPage/CampaignsPage.esm.js +1 -1
  13. package/dist/components/Cards/CurrentStatusCard/CurrentStatusCard.esm.js +2 -0
  14. package/dist/components/Cards/CurrentStatusCard/CurrentStatusCardRow.esm.js +2 -0
  15. package/dist/components/Cards/DescriptionCard/DescriptionCard.esm.js +2 -0
  16. package/dist/components/CertificationsPage/CertificationTabs.esm.js +1 -1
  17. package/dist/components/CertificationsPage/CertificationsPage.esm.js +1 -1
  18. package/dist/components/CertificationsPage/Playlist/PlaylistComponent.esm.js +1 -1
  19. package/dist/components/CheckCreatePage/CheckCreatePage.esm.js +1 -1
  20. package/dist/components/CheckDetails/CheckDetails.esm.js +1 -1
  21. package/dist/components/CheckForm/FormFields/CheckPathResolverInput.esm.js +1 -1
  22. package/dist/components/CheckForm/FormFields/RuleInput/Conditions/RuleConditionInput.esm.js +1 -1
  23. package/dist/components/CheckForm/FormFields/TeamDetailsInput/TeamDetailsInput.esm.js +1 -1
  24. package/dist/components/CheckPage/CheckEditView.esm.js +1 -1
  25. package/dist/components/CheckPage/CheckInsightsPage.esm.js +1 -1
  26. package/dist/components/CheckPage/CheckStatusHistoryChart.esm.js +1 -1
  27. package/dist/components/CheckPage/CheckStatusTable.esm.js +1 -1
  28. package/dist/components/CheckPage/utils.esm.js +1 -1
  29. package/dist/components/CheckStatusBar/CheckStatusBar.esm.js +1 -1
  30. package/dist/components/CheckStatusBar/CheckStatusBarBUI.esm.js +2 -0
  31. package/dist/components/CheckStatusBar/CheckStatusBarCell.esm.js +2 -0
  32. package/dist/components/CheckTemplatesPage/CheckTemplatesPage.esm.js +1 -1
  33. package/dist/components/ChecksPage/CheckListPage/CheckListPageDeprecated.esm.js +2 -0
  34. package/dist/components/ChecksPage/ChecksListPageBUI.esm.js +2 -0
  35. package/dist/components/ChecksPage/ChecksPage.esm.js +1 -1
  36. package/dist/components/ChecksTable/ChecksTable.esm.js +2 -0
  37. package/dist/components/ChipSelector/ChipSelector.esm.js +2 -0
  38. package/dist/components/CollectorPage/CollectorDetailsPage.esm.js +1 -1
  39. package/dist/components/CollectorPage/CollectorFactTable.esm.js +1 -1
  40. package/dist/components/CollectorPage/CollectorPage.esm.js +1 -1
  41. package/dist/components/CollectorPage/Configurators/AzureDevOps/AzureDevOpsConfigurator.esm.js +1 -1
  42. package/dist/components/CollectorPage/Configurators/BigQuery/BigQueryConfigurator.esm.js +1 -1
  43. package/dist/components/CollectorPage/Configurators/Catalog/CatalogConfigurator.esm.js +1 -1
  44. package/dist/components/CollectorPage/Configurators/DataDog/DataDogConfigurator.esm.js +1 -1
  45. package/dist/components/CollectorPage/Configurators/DataRegistry/DataRegistryConfigurator.esm.js +1 -1
  46. package/dist/components/CollectorPage/Configurators/Github/CodeScanningAlertsFactDetails.esm.js +1 -1
  47. package/dist/components/CollectorPage/Configurators/Github/GithubConfigurator.esm.js +1 -1
  48. package/dist/components/CollectorPage/Configurators/Github/SecretScanningAlertsFactDetails.esm.js +1 -1
  49. package/dist/components/CollectorPage/Configurators/Github/SecurityAdvisoriesFactDetails.esm.js +1 -1
  50. package/dist/components/CollectorPage/Configurators/Gitlab/GitlabConfigurator.esm.js +1 -1
  51. package/dist/components/CollectorPage/Configurators/HTTP/HttpConfigurator.esm.js +1 -1
  52. package/dist/components/CollectorPage/Configurators/Jira/IssuesFactDetailsComponent.esm.js +2 -0
  53. package/dist/components/CollectorPage/Configurators/Jira/JiraConfigurator.esm.js +1 -1
  54. package/dist/components/CollectorPage/Configurators/Jira/utils.esm.js +1 -1
  55. package/dist/components/CollectorPage/Configurators/Jira/validation.esm.js +1 -1
  56. package/dist/components/CollectorPage/Configurators/Kubernetes/KubernetesConfigurator.esm.js +1 -1
  57. package/dist/components/CollectorPage/Configurators/NewRelic/NewRelicConfigurator.esm.js +1 -1
  58. package/dist/components/CollectorPage/Configurators/PagerDuty/PagerDutyConfigurator.esm.js +1 -1
  59. package/dist/components/CollectorPage/Configurators/SCM/ScmConfigurator.esm.js +1 -1
  60. package/dist/components/CollectorPage/Configurators/SonarQube/SonarQubeConfigurator.esm.js +1 -1
  61. package/dist/components/CollectorsPage/CollectorListPage/CollectorListPage.esm.js +1 -1
  62. package/dist/components/CollectorsPage/CollectorsPage.esm.js +1 -1
  63. package/dist/components/CustomCell/CustomCell.esm.js +2 -0
  64. package/dist/components/EmptyState/EmptyStateBUI.esm.js +2 -0
  65. package/dist/components/EmptyState/EmptyStateNoCampaigns.esm.js +2 -0
  66. package/dist/components/EmptyState/EmptyStateNoChecks.esm.js +2 -0
  67. package/dist/components/EmptyState/EmptyStateNoTracks.esm.js +2 -0
  68. package/dist/components/EntitiesAutocompletePicker/EntitiesAutocompletePicker.esm.js +1 -1
  69. package/dist/components/EntitySoundcheckCard/Card.esm.js +1 -1
  70. package/dist/components/FactExplorer/FactExplorer.esm.js +1 -1
  71. package/dist/components/Filter/FilterPreviewTable/FilterPreviewTable.esm.js +1 -1
  72. package/dist/components/Filter/KeyValueInputDialog.esm.js +1 -1
  73. package/dist/components/FilterSidebar/FilterSidebar.esm.js +1 -1
  74. package/dist/components/FilterSidebar/StateFilter.esm.js +1 -1
  75. package/dist/components/FilterSidebar/useTrackFilterSidebar.esm.js +1 -1
  76. package/dist/components/FilterSidebar/util.esm.js +1 -1
  77. package/dist/components/FormControlledAutocomplete/FormControlledAutocomplete.esm.js +1 -1
  78. package/dist/components/FormControlledAutocomplete/useLabelValueOptions.esm.js +2 -0
  79. package/dist/components/GroupHierarchySelector/GroupHierarchySelector.esm.js +1 -1
  80. package/dist/components/HierarchicalTechInsightsPage/HierarchicalTechInsightsPage.esm.js +1 -1
  81. package/dist/components/LevelUpParty/LevelUpParty.esm.js +1 -1
  82. package/dist/components/LevelsTable/CheckRowContent.esm.js +1 -1
  83. package/dist/components/LevelsTable/LevelsTable.esm.js +1 -1
  84. package/dist/components/ListPageCustomActions/ListPageCustomActions.esm.js +2 -0
  85. package/dist/components/LoadingTableSkeleton/LoadingTableSkeleton.esm.js +2 -0
  86. package/dist/components/OverviewPage/OverviewPage.esm.js +1 -1
  87. package/dist/components/OverviewPage/OverviewPageContent.esm.js +1 -1
  88. package/dist/components/OverviewTable/OverviewTable.esm.js +1 -1
  89. package/dist/components/OverviewTable/ResultsTable.esm.js +1 -1
  90. package/dist/components/PageCustomActions/PageCustomActions.esm.js +2 -0
  91. package/dist/components/QuickstartPage/QuickstartPage.esm.js +2 -2
  92. package/dist/components/Router.esm.js +1 -1
  93. package/dist/components/RoutingPage/RoutingPage.esm.js +1 -1
  94. package/dist/components/SearchFilters/SearchFilters.esm.js +1 -1
  95. package/dist/components/SummaryCard/SummaryCard.esm.js +1 -1
  96. package/dist/components/SummaryCard/SummaryCardActionsMenu.esm.js +1 -1
  97. package/dist/components/TableRowWithOwner/TableRowWithOwner.esm.js +2 -0
  98. package/dist/components/TeamStatusBar/TeamStatusBar.esm.js +1 -1
  99. package/dist/components/TechInsights/FilterControls.esm.js +1 -1
  100. package/dist/components/TechInsights/SummaryTiles.esm.js +1 -1
  101. package/dist/components/TechInsights/TechInsightsPage.esm.js +1 -1
  102. package/dist/components/TechInsights/TechInsightsTableBUI.esm.js +2 -0
  103. package/dist/components/TechInsights/TechInsightsTableView.esm.js +1 -1
  104. package/dist/components/TechInsightsGroupSelector/TechInsightsGroupSelector.esm.js +1 -1
  105. package/dist/components/TimePeriodBar/TimePeriodBar.esm.js +1 -1
  106. package/dist/components/TopFailingChecksTable/TopFailingChecksTableBUI.esm.js +2 -0
  107. package/dist/components/TrackCreatePage/TrackCreatePage.esm.js +1 -1
  108. package/dist/components/TrackEditPage/TrackEditView.esm.js +1 -1
  109. package/dist/components/TrackForm/Steps/TrackDetailsStep/TrackBadgeTypeSelect/TrackBadgeTypeSelect.esm.js +1 -1
  110. package/dist/components/TrackForm/Steps/TrackDetailsStep/TrackOwnerSelect/TrackOwnerSelect.esm.js +1 -1
  111. package/dist/components/TrackPage/TrackEntitiesTable/TrackEntitiesTable.esm.js +1 -1
  112. package/dist/components/TrackPage/TrackEntitiesTable/TrackEntitiesTableBUI.esm.js +2 -0
  113. package/dist/components/TrackPage/TrackHistoryChart.esm.js +1 -1
  114. package/dist/components/TrackPage/TrackPage.esm.js +1 -1
  115. package/dist/components/TrackPage/TrackPageBUI.esm.js +2 -0
  116. package/dist/components/TrackPage/TrackPageDeprecated.esm.js +2 -0
  117. package/dist/components/TracksPage/TrackListPage/TrackListPageDeprecated.esm.js +2 -0
  118. package/dist/components/TracksPage/TrackListPage/TrackSummaryCard.esm.js +1 -1
  119. package/dist/components/TracksPage/TracksListPageBUI.esm.js +2 -0
  120. package/dist/components/TracksPage/TracksPage.esm.js +1 -1
  121. package/dist/graphql/generated/index.esm.js +125 -117
  122. package/dist/hooks/aggregations/useCheckStatus.esm.js +1 -1
  123. package/dist/hooks/catalog/useGetEntityRefs.esm.js +1 -1
  124. package/dist/hooks/catalog/useGetLimitedEntityRefs.esm.js +1 -1
  125. package/dist/hooks/catalog/useProfileImages.esm.js +2 -0
  126. package/dist/hooks/checks/useCheckDetails.esm.js +1 -1
  127. package/dist/hooks/checks/useCheckStatusTotals.esm.js +2 -0
  128. package/dist/hooks/entities/useTrackEntities.esm.js +1 -1
  129. package/dist/hooks/graphqlKeys.esm.js +1 -1
  130. package/dist/hooks/groups/useAllGroups.esm.js +1 -1
  131. package/dist/hooks/groups/useGroupOptions.esm.js +1 -1
  132. package/dist/hooks/groups/useUsersGroupClaims.esm.js +1 -1
  133. package/dist/hooks/heirarchy/useBatchedHierarchicalTrackStatuses.esm.js +1 -1
  134. package/dist/hooks/tracks/useRecertifyTrack.esm.js +2 -0
  135. package/dist/hooks/tracks/useTracksApplicableToGroup.esm.js +1 -1
  136. package/dist/hooks/useConfirmationModal.esm.js +1 -1
  137. package/dist/hooks/useLoadTimeReporting.esm.js +2 -0
  138. package/dist/hooks/usePagination.esm.js +2 -0
  139. package/dist/hooks/useSearchName.esm.js +2 -0
  140. package/dist/utils/checks.esm.js +2 -0
  141. package/dist/utils/formatters.esm.js +1 -1
  142. package/dist/utils/helpers.esm.js +1 -1
  143. package/dist/utils/lcpReporting.esm.js +1 -1
  144. package/package.json +18 -27
  145. package/dist/components/CampaignInsightsPage/CampaignInsightsPage.esm.js +0 -2
  146. package/dist/components/CampaignsPage/CampaignListPage/CampaignListPage.esm.js +0 -2
  147. package/dist/components/ChecksPage/CheckListPage/CheckListPage.esm.js +0 -2
  148. package/dist/components/CollectorPage/Configurators/Jira/IssuesSearchFactDetailsComponent.esm.js +0 -2
  149. package/dist/components/TechInsights/TechInsightsCardsView.esm.js +0 -2
  150. package/dist/components/TechInsights/TrackStatusCard.esm.js +0 -2
  151. package/dist/components/TechInsights/ViewModeControls.esm.js +0 -2
  152. package/dist/components/TechInsights/convertToCommonTrackStatus.esm.js +0 -2
  153. package/dist/components/TracksPage/TrackListPage/TrackListPage.esm.js +0 -2
  154. /package/dist/components/{CampaignInsightsPage → CampaignPage}/CampaignStatusHistoryTile.esm.js +0 -0
  155. /package/dist/components/{CampaignInsightsPage → CampaignPage}/DaysRemainingTile.esm.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # @spotify/backstage-plugin-soundcheck
2
2
 
3
+ ## 0.19.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Support tracks in addition to programs in Soundcheck configs
8
+ - Updated track insights page default sort order to be applicable entity count desc.
9
+ - Added Soundcheck Tech Insights page that provides analytics for tracking software quality metrics across your organization.
10
+ - Added navigation performance metric (page load time on client-side route navigation).
11
+ - Fixed owners filter to support name, title, description on the Check & Track creation pages
12
+ - Removed tooltip from Tech Insights Table bars and displayed Compliance percentage.
13
+ - ** Breaking Changes **: Jira's [Search for issues using JQL](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-search/#api-rest-api-2-search-get) API was removed for Jira Cloud instances.
14
+ Soundcheck will now fetch `issue-search` fact data from Jira's [Search for issues using JQL enhanced search](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-jql-post) API for Jira Cloud instances.
15
+
16
+ - Updated deprecated API calls for issues-search facts for Jira Cloud instances.
17
+ - Added support for issues-count fact that returns a number of issues matching JQL.
18
+ - Added support for personal access token (bearer token) authentication.
19
+ - Added support for top-level configuration for Jira Fact Collector.
20
+
21
+ - Cleanup unused packages in Soundcheck
22
+ - On-demand track recertification is now available in the UI. This feature allows for the generation
23
+ of historical certification data that accurately reflects the current state of a track.
24
+ - Fixed Check Insights Page History when Status Filters are applied.
25
+ - Fixes some tests.
26
+ - Added total track/campaign count to distinguish from applicable ones on the tech insights page.
27
+ - Removed card view from Tech Insights Page and updated stats cards.
28
+ - Added a filter by status for the entities table on the Campaign insights page.
29
+ - Updated dependencies
30
+ - Updated dependencies
31
+ - Updated dependencies
32
+ - Updated dependencies
33
+ - Updated dependencies
34
+ - Updated dependencies
35
+ - @spotify/backstage-plugin-soundcheck-common@0.19.1
36
+
37
+ ## 0.19.2
38
+
39
+ ### Patch Changes
40
+
41
+ - Added Soundcheck Tech Insights page that provides analytics for tracking software quality metrics across your organization.
42
+
3
43
  ## 0.19.1
4
44
 
5
45
  ### Patch Changes
package/config.d.ts CHANGED
@@ -1,8 +1,61 @@
1
+ import { EntityFilter } from '@spotify/backstage-plugin-soundcheck-common';
2
+
1
3
  export interface Config {
2
4
  /**
3
5
  * Configuration options for the soundcheck plugin.
4
6
  */
5
7
  soundcheck?: {
8
+ /**
9
+ * Configuration options for soundcheck check results.
10
+ *
11
+ * @visibility frontend
12
+ */
13
+ results?: {
14
+ /**
15
+ * Configuration options for the check result history.
16
+ *
17
+ * @visibility frontend
18
+ */
19
+ history?: {
20
+ /**
21
+ * Flag that enables/disables tracking check result history and recording check result
22
+ * state changes into a check_result_history table. Default value is 'false'.
23
+ *
24
+ * @visibility frontend
25
+ */
26
+ enable?: boolean;
27
+ /**
28
+ * Indicates retention time of the records in check_result_history table in days.
29
+ * Default value is 120 days.
30
+ *
31
+ * @visibility frontend
32
+ */
33
+ retentionTimeInDays?: number;
34
+ };
35
+ };
36
+ /**
37
+ * Configuration options for the certification history.
38
+ *
39
+ * @visibility frontend
40
+ */
41
+ certifications?: {
42
+ history?: {
43
+ /**
44
+ * Flag that enables/disables tracking certification history and recording the level
45
+ * certification changes into a certification_history table. Default value is 'false'.
46
+ *
47
+ * @visibility frontend
48
+ */
49
+ enable?: boolean;
50
+ /**
51
+ * Indicates retention time of the records in certification_history table in days.
52
+ * Default value is 120 days.
53
+ *
54
+ * @visibility frontend
55
+ */
56
+ retentionTimeInDays?: number;
57
+ };
58
+ };
6
59
  /**
7
60
  * @visibility frontend
8
61
  */
@@ -40,7 +93,7 @@ export interface Config {
40
93
  */
41
94
  notifications?: {
42
95
  /**
43
- * Enabled or disable notification on a global level.
96
+ * Enable or disable notifications on a global level.
44
97
  *
45
98
  * @visibility frontend
46
99
  */
@@ -52,12 +105,6 @@ export interface Config {
52
105
  * @visibility frontend
53
106
  */
54
107
  techInsights?: {
55
- /**
56
- * Enable of disable Tech Insights page. The page is disabled by default.
57
- *
58
- * @visibility frontend
59
- */
60
- enabled?: boolean;
61
108
  /**
62
109
  * Show or hide experimental visualizations on Tech Insights page.
63
110
  * Experimental visualizations are hidden by default.
package/dist/api.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import{createApiRef as c}from"@backstage/core-plugin-api";import{GraphQLClient as h}from"graphql-request";import{getSdk as u}from"./graphql/generated/index.esm.js";const y=c({id:"plugin.soundcheck"}),o=i=>"response"in i&&"errors"in i.response,l=i=>"response"in i&&"message"in i.response;class g{#a;#s;#t;constructor(t){this.#a=t.fetchApi,this.#s=t.discoveryApi;const e=new h("/graphql",{fetch:async(a,s)=>{const r=`${await this.#s.getBaseUrl("soundcheck")}${a}`;return this.#a.fetch(r,s)}});this.#t=u(e)}#i=t=>o(t)?t.response?.errors?.[0].message??`${t}`:l(t)?t.response.message:`${t}`;#e=async t=>{try{return await t()}catch(e){throw new Error(`Error from Soundcheck backend: ${this.#i(e)}`)}};async getMultipleTrackStatuses(t){return this.#e(async()=>{const{multipleTrackStatuses:e}=await this.#t.getMultipleTrackStatuses({input:t});return e})}async getAllCertifications(t,e=!1,a=!1){return this.#e(async()=>{const{certifications:s}=await this.#t.getAllCertifications({entityRef:t,includeFilteredChecks:e,includeDraftTracks:a});return s})}async getCertificationDetails(t,e=!1,a=!1){return this.#e(async()=>{const{certifications:s}=await this.#t.getCertificationDetails({entityRef:t,includeFilteredChecks:e,includeDraftTracks:a});return s})}async getCertificationDetailsForTrack(t,e,a){return this.#e(async()=>{const{trackCertification:s}=await this.#t.getCertificationDetailsForTrack({entityRef:t,trackId:e,includeFilteredChecks:a});return s})}async getCheckResultDetails(t,e,a){return this.#e(async()=>{const{checkResult:s}=await this.#t.getCheckResultDetails({entityRef:t,trackId:e,checkId:a});return s})}async getFacetsForOwner(t){return this.#e(async()=>{const{facetsForOwner:e}=await this.#t.getFacetsForOwner({ownerEntityRef:t});return e})}async getTrackOverviewForOwner(t,e,a,s,r){return this.#e(async()=>{const{trackOverviewForOwner:n}=await this.#t.getTrackOverviewForOwner({ownerEntityRef:t,facet:e,first:a,after:s,entitySearch:r});return n})}async getTracks(t){return this.#e(async()=>{const{tracks:e}=await this.#t.getTracks({filter:t});return e})}async getTracksApplicableEntityCount(t,e){return this.#e(async()=>{const{tracks:a}=await this.#t.getTracksApplicableEntityCount({filter:t,groupRef:e});return a?.edges?.map(({node:s})=>({id:s.id,applicableEntityCount:s.applicableEntityCount??0}))})}async getTrack(t){return this.#e(async()=>{const{track:e}=await this.#t.getTrack({id:t});return e})}async createTrack(t){return this.#e(async()=>{const{track:e}=await this.#t.createTrack({input:t});return e})}async updateTrack(t){return this.#e(async()=>{const{track:e}=await this.#t.updateTrack({input:t});return e})}async deleteTrack(t){return this.#e(async()=>{const{trackDeleted:e}=await this.#t.deleteTrack({trackId:t});return e})}async importTracks(t){return this.#e(async()=>{const{status:e}=await this.#t.importTracks({tracks:t});return e})}async getPlaylists(t){return this.#e(async()=>{const{playlists:e}=await this.#t.getPlaylists({entityRef:t});return e})}async getOperators(){return this.#e(async()=>{const{operators:t}=await this.#t.getOperators();return t})}async getCheck(t){return this.#e(async()=>(await this.#t.getCheck({id:t})).check)}async getChecks(t){return this.#e(async()=>{const{checkers:e}=await this.#t.getCheckers({filter:t});return e})}async getExecutableChecks(){return this.#e(async()=>{const{executableChecks:t}=await this.#t.getExecutableChecks();return t})}async createCheck(t){return this.#e(async()=>{const{check:e}=await this.#t.createCheck({input:t});return e})}async updateCheck(t){return this.#e(async()=>{const{check:e}=await this.#t.updateCheck({input:t});return e})}async deleteCheck(t){return this.#e(async()=>await this.#t.deleteChecker({checkerId:t}))}async executeCheck(t){return this.#e(async()=>{const{result:e}=await this.#t.executeCheck({input:t});return e})}async importChecks(t){return this.#e(async()=>{const{status:e}=await this.#t.importCheckers({checkers:t});return e})}async setEntityExempt(t){return this.#e(async()=>{const{setEntityExempt:e}=await this.#t.setEntityExempt({input:t});return e})}async setManualCheckResult(t){return this.#e(async()=>await this.#t.setManualCheckResult({input:t}))}async deleteExemption(t,e){return this.#e(async()=>await this.#t.deleteExemption({checkId:t,entityRef:e}))}async getExemption(t,e){return this.#e(async()=>await this.#t.getExemption({checkId:t,entityRef:e}))}async getExemptions(t,e,a,s,r){return this.#e(async()=>await this.#t.getExemptions({checkId:t,first:e,after:a,last:s,before:r}))}async getExemptCheckIds(t,e){return this.#e(async()=>await this.#t.getExemptCheckIds({entityRef:t,trackId:e}))}async getCollectors(t){return this.#e(async()=>{const{collectors:e}=await this.#t.getCollectors({ids:t});return e})}async getFactSchema(t,e){if(!(!t||!e))return this.#e(async()=>{const{factSchema:a}=await this.#t.getFactSchemas({collectorId:t,factName:e});return a})}async updateCollectorConfig(t){return this.#e(async()=>{const{collector:e}=await this.#t.updateCollectorConfig({input:t});return e})}async deleteCollectorConfig(t){return this.#e(async()=>await this.#t.deleteCollectorConfig({collectorId:t}))}async getOverallCheckPassRates(t){return this.#e(async()=>await this.#t.getOverallCheckPassRates({filter:t}))}async getIndividualCheckPassRates(t){return this.#e(async()=>await this.#t.getIndividualCheckPassRates({filter:t}))}async getOverallTrackPassRate(t){return this.#e(async()=>await this.#t.getOverallTrackPassRate({filter:t}))}async getIndividualTrackPassRate(t){return this.#e(async()=>await this.#t.getIndividualTrackPassRate({filter:t}))}async getOverallEntityPassRates(t){return this.#e(async()=>await this.#t.getOverallEntityPassRates({filter:t}))}async getIndividualEntityPassRates(t){return this.#e(async()=>await this.#t.getIndividualEntityPassRates({input:t}))}async getOverallGroupPassRates(t){return this.#e(async()=>await this.#t.getOverallGroupPassRates({input:t}))}async getIndividualGroupPassRates(t){return this.#e(async()=>await this.#t.getIndividualGroupPassRates({input:t}))}async getEntityRefsForTechHealthFilter(t){return this.#e(async()=>await this.#t.getEntityRefsForTechHealthFilter({ownerEntityRef:t}))}async getTrackEntities(t){return this.#e(async()=>await this.#t.getTrackEntities({input:t}))}async getCampaigns(t,e){return this.#e(async()=>{const{campaigns:a}=await this.#t.getCampaigns({filter:t,byTrackIds:e});return a})}async createCampaign(t){return this.#e(async()=>{const{campaign:e}=await this.#t.createCampaign({input:t});return e})}async updateCampaign(t){return this.#e(async()=>{const{campaign:e}=await this.#t.updateCampaign({input:t});return e})}async deleteCampaign(t){return this.#e(async()=>{const{campaignDeleted:e}=await this.#t.deleteCampaign({campaignId:t});return e})}async sendCampaignNotification(t){return this.#e(async()=>{const{sendCampaignNotification:e}=await this.#t.sendCampaignNotification({input:t});return e})}async archiveCampaign(t){return this.#e(async()=>{const{campaignArchived:e}=await this.#t.archiveCampaign({campaignId:t});return e})}async getCampaignOwners(){return this.#e(async()=>{const{campaignOwners:t}=await this.#t.getCampaignOwners();return t})}async getCheckOwners(){return this.#e(async()=>{const{checkOwners:t}=await this.#t.getCheckOwners();return t})}async getTrackOwners(){return this.#e(async()=>{const{trackOwners:t}=await this.#t.getTrackOwners();return t})}async getCertificationStatus(t){return this.#e(async()=>this.#t.getCertificationStatus({input:t}))}async getCertificationStatusHistory(t){return this.#e(async()=>this.#t.getCertificationStatusHistory({input:t}))}async getTrackStatusHistory(t){return this.#e(async()=>(await this.#t.getTrackStatusHistory({input:t})).trackStatusHistory)}async getTrackStatusHistories(t){return this.#e(async()=>(await this.#t.getTrackStatusHistories({input:t})).trackStatusHistories)}async getCheckStatus(t){return this.#e(async()=>(await this.#t.getCheckStatus({input:t})).checkStatus)}async getCheckStatuses(t){return this.#e(async()=>(await this.#t.getCheckStatuses({input:t})).checkStatuses)}async getCheckStatusHistory(t){return this.#e(async()=>(await this.#t.getCheckStatusHistory({input:t})).checkStatusHistory)}async getCheckStatusHistoriesMultiFilter(t){return this.#e(async()=>(await this.#t.getCheckStatusHistoriesMultiFilter({input:t})).checkStatusHistoriesMultiFilter)}async getCheckStatusHistories(t){return this.#e(async()=>(await this.#t.getCheckStatusHistories({input:t})).checkStatusHistories)}async getCheckEntities(t){return this.#e(async()=>await this.#t.getCheckEntities({input:t}))}async getSavedViews(t){return this.#e(async()=>await this.#t.getSavedViews({input:t}))}async saveView(t){return this.#e(async()=>{const{saveView:e}=await this.#t.saveView({input:t});return e})}async deleteView(t){return this.#e(async()=>{const{deleteView:e}=await this.#t.deleteView({input:t});return e})}async getPathResolvers(){return this.#e(async()=>{const{pathResolvers:t}=await this.#t.getPathResolvers();return t})}async getCheckTemplates(){return this.#e(async()=>{const{checkerTemplates:t}=await this.#t.getCheckTemplates();return t})}async getFact(t){return this.#e(async()=>{const{fact:e}=await this.#t.getFact(t);return e})}async getGroupTypeHierarchy(){return this.#e(async()=>{const{groupTypeHierarchy:t}=await this.#t.getGroupTypeHierarchy();return t})}async getGroupHierarchy(t,e,a){return this.#e(async()=>{const{groupHierarchy:s}=await this.#t.getGroupHierarchy({groupRef:t,ownedEntitiesFilter:e,includeParent:a});return s})}async getHierarchicalTrackStatus(t,e){return this.#e(async()=>{const{hierarchicalTrackStatus:a}=await this.#t.getHierarchicalTrackStatus({trackId:t,groupRef:e});return a})}async getHierarchicalTrackStatuses(t,e){return this.#e(async()=>{const{hierarchicalTrackStatuses:a}=await this.#t.getHierarchicalTrackStatuses({trackIds:t,groupRef:e});return a})}async recordLoadTime(t){return this.#e(async()=>await this.#t.recordLoadTime({input:{routeName:t.routeName,loadTimeMs:t.loadTimeMs,additionalAttributes:t.additionalAttributes}}))}}export{g as SoundcheckApi,y as soundcheckApiRef};
1
+ import{createApiRef as c}from"@backstage/core-plugin-api";import{GraphQLClient as h}from"graphql-request";import{getSdk as u}from"./graphql/generated/index.esm.js";const y=c({id:"plugin.soundcheck"}),o=r=>"response"in r&&"errors"in r.response,l=r=>"response"in r&&"message"in r.response;class g{#a;#s;#t;constructor(t){this.#a=t.fetchApi,this.#s=t.discoveryApi;const e=new h("/graphql",{fetch:async(a,s)=>{const i=`${await this.#s.getBaseUrl("soundcheck")}${a}`;return this.#a.fetch(i,s)}});this.#t=u(e)}#r=t=>o(t)?t.response?.errors?.[0].message??`${t}`:l(t)?t.response.message:`${t}`;#e=async t=>{try{return await t()}catch(e){throw new Error(`Error from Soundcheck backend: ${this.#r(e)}`)}};async getMultipleTrackStatuses(t){return this.#e(async()=>{const{multipleTrackStatuses:e}=await this.#t.getMultipleTrackStatuses({input:t});return e})}async getAllCertifications(t,e=!1,a=!1){return this.#e(async()=>{const{certifications:s}=await this.#t.getAllCertifications({entityRef:t,includeFilteredChecks:e,includeDraftTracks:a});return s})}async getCertificationDetails(t,e=!1,a=!1){return this.#e(async()=>{const{certifications:s}=await this.#t.getCertificationDetails({entityRef:t,includeFilteredChecks:e,includeDraftTracks:a});return s})}async getCertificationDetailsForTrack(t,e,a){return this.#e(async()=>{const{trackCertification:s}=await this.#t.getCertificationDetailsForTrack({entityRef:t,trackId:e,includeFilteredChecks:a});return s})}async getCheckResultDetails(t,e,a){return this.#e(async()=>{const{checkResult:s}=await this.#t.getCheckResultDetails({entityRef:t,trackId:e,checkId:a});return s})}async getFacetsForOwner(t){return this.#e(async()=>{const{facetsForOwner:e}=await this.#t.getFacetsForOwner({ownerEntityRef:t});return e})}async getTrackOverviewForOwner(t,e,a,s,i){return this.#e(async()=>{const{trackOverviewForOwner:n}=await this.#t.getTrackOverviewForOwner({ownerEntityRef:t,facet:e,first:a,after:s,entitySearch:i});return n})}async getTracks(t){return this.#e(async()=>{const{tracks:e}=await this.#t.getTracks({filter:t});return e})}async getTracksApplicableEntityCount(t,e){return this.#e(async()=>{const{tracks:a}=await this.#t.getTracksApplicableEntityCount({filter:t,groupRef:e});return a?.edges?.map(({node:s})=>({id:s.id,applicableEntityCount:s.applicableEntityCount??0}))})}async getTrack(t){return this.#e(async()=>{const{track:e}=await this.#t.getTrack({id:t});return e})}async createTrack(t){return this.#e(async()=>{const{track:e}=await this.#t.createTrack({input:t});return e})}async updateTrack(t){return this.#e(async()=>{const{track:e}=await this.#t.updateTrack({input:t});return e})}async deleteTrack(t){return this.#e(async()=>{const{trackDeleted:e}=await this.#t.deleteTrack({trackId:t});return e})}async importTracks(t){return this.#e(async()=>{const{status:e}=await this.#t.importTracks({tracks:t});return e})}async recertifyTrack(t,e,a){return this.#e(async()=>{const{trackRecertified:s}=await this.#t.recertifyTrack({trackId:t,numberOfDays:e,loggedInUserRef:a});return s})}async getPlaylists(t){return this.#e(async()=>{const{playlists:e}=await this.#t.getPlaylists({entityRef:t});return e})}async getOperators(){return this.#e(async()=>{const{operators:t}=await this.#t.getOperators();return t})}async getCheck(t){return this.#e(async()=>(await this.#t.getCheck({id:t})).check)}async getChecks(t){return this.#e(async()=>{const{checkers:e}=await this.#t.getCheckers({filter:t});return e})}async getExecutableChecks(){return this.#e(async()=>{const{executableChecks:t}=await this.#t.getExecutableChecks();return t})}async createCheck(t){return this.#e(async()=>{const{check:e}=await this.#t.createCheck({input:t});return e})}async updateCheck(t){return this.#e(async()=>{const{check:e}=await this.#t.updateCheck({input:t});return e})}async deleteCheck(t){return this.#e(async()=>await this.#t.deleteChecker({checkerId:t}))}async executeCheck(t){return this.#e(async()=>{const{result:e}=await this.#t.executeCheck({input:t});return e})}async importChecks(t){return this.#e(async()=>{const{status:e}=await this.#t.importCheckers({checkers:t});return e})}async setEntityExempt(t){return this.#e(async()=>{const{setEntityExempt:e}=await this.#t.setEntityExempt({input:t});return e})}async setManualCheckResult(t){return this.#e(async()=>await this.#t.setManualCheckResult({input:t}))}async deleteExemption(t,e){return this.#e(async()=>await this.#t.deleteExemption({checkId:t,entityRef:e}))}async getExemption(t,e){return this.#e(async()=>await this.#t.getExemption({checkId:t,entityRef:e}))}async getExemptions(t,e,a,s,i){return this.#e(async()=>await this.#t.getExemptions({checkId:t,first:e,after:a,last:s,before:i}))}async getExemptCheckIds(t,e){return this.#e(async()=>await this.#t.getExemptCheckIds({entityRef:t,trackId:e}))}async getCollectors(t){return this.#e(async()=>{const{collectors:e}=await this.#t.getCollectors({ids:t});return e})}async getFactSchema(t,e){if(!(!t||!e))return this.#e(async()=>{const{factSchema:a}=await this.#t.getFactSchemas({collectorId:t,factName:e});return a})}async updateCollectorConfig(t){return this.#e(async()=>{const{collector:e}=await this.#t.updateCollectorConfig({input:t});return e})}async deleteCollectorConfig(t){return this.#e(async()=>await this.#t.deleteCollectorConfig({collectorId:t}))}async getOverallCheckPassRates(t){return this.#e(async()=>await this.#t.getOverallCheckPassRates({filter:t}))}async getIndividualCheckPassRates(t){return this.#e(async()=>await this.#t.getIndividualCheckPassRates({filter:t}))}async getOverallTrackPassRate(t){return this.#e(async()=>await this.#t.getOverallTrackPassRate({filter:t}))}async getIndividualTrackPassRate(t){return this.#e(async()=>await this.#t.getIndividualTrackPassRate({filter:t}))}async getOverallEntityPassRates(t){return this.#e(async()=>await this.#t.getOverallEntityPassRates({filter:t}))}async getIndividualEntityPassRates(t){return this.#e(async()=>await this.#t.getIndividualEntityPassRates({input:t}))}async getOverallGroupPassRates(t){return this.#e(async()=>await this.#t.getOverallGroupPassRates({input:t}))}async getIndividualGroupPassRates(t){return this.#e(async()=>await this.#t.getIndividualGroupPassRates({input:t}))}async getEntityRefsForTechHealthFilter(t){return this.#e(async()=>await this.#t.getEntityRefsForTechHealthFilter({ownerEntityRef:t}))}async getTrackEntities(t){return this.#e(async()=>await this.#t.getTrackEntities({input:t}))}async getCampaigns(t,e){return this.#e(async()=>{const{campaigns:a}=await this.#t.getCampaigns({filter:t,byTrackIds:e});return a})}async createCampaign(t){return this.#e(async()=>{const{campaign:e}=await this.#t.createCampaign({input:t});return e})}async updateCampaign(t){return this.#e(async()=>{const{campaign:e}=await this.#t.updateCampaign({input:t});return e})}async deleteCampaign(t){return this.#e(async()=>{const{campaignDeleted:e}=await this.#t.deleteCampaign({campaignId:t});return e})}async sendCampaignNotification(t){return this.#e(async()=>{const{sendCampaignNotification:e}=await this.#t.sendCampaignNotification({input:t});return e})}async archiveCampaign(t){return this.#e(async()=>{const{campaignArchived:e}=await this.#t.archiveCampaign({campaignId:t});return e})}async getCampaignOwners(){return this.#e(async()=>{const{campaignOwners:t}=await this.#t.getCampaignOwners();return t})}async getCheckOwners(){return this.#e(async()=>{const{checkOwners:t}=await this.#t.getCheckOwners();return t})}async getTrackOwners(){return this.#e(async()=>{const{trackOwners:t}=await this.#t.getTrackOwners();return t})}async getCertificationStatus(t){return this.#e(async()=>this.#t.getCertificationStatus({input:t}))}async getCertificationStatusHistory(t){return this.#e(async()=>this.#t.getCertificationStatusHistory({input:t}))}async getTrackStatusHistory(t){return this.#e(async()=>(await this.#t.getTrackStatusHistory({input:t})).trackStatusHistory)}async getTrackStatusHistories(t){return this.#e(async()=>(await this.#t.getTrackStatusHistories({input:t})).trackStatusHistories)}async getCheckStatus(t){return this.#e(async()=>(await this.#t.getCheckStatus({input:t})).checkStatus)}async getCheckStatuses(t){return this.#e(async()=>(await this.#t.getCheckStatuses({input:t})).checkStatuses)}async getCheckStatusHistory(t){return this.#e(async()=>(await this.#t.getCheckStatusHistory({input:t})).checkStatusHistory)}async getCheckStatusHistoriesMultiFilter(t){return this.#e(async()=>(await this.#t.getCheckStatusHistoriesMultiFilter({input:t})).checkStatusHistoriesMultiFilter)}async getCheckStatusHistories(t){return this.#e(async()=>(await this.#t.getCheckStatusHistories({input:t})).checkStatusHistories)}async getCheckEntities(t){return this.#e(async()=>await this.#t.getCheckEntities({input:t}))}async getSavedViews(t){return this.#e(async()=>await this.#t.getSavedViews({input:t}))}async saveView(t){return this.#e(async()=>{const{saveView:e}=await this.#t.saveView({input:t});return e})}async deleteView(t){return this.#e(async()=>{const{deleteView:e}=await this.#t.deleteView({input:t});return e})}async getPathResolvers(){return this.#e(async()=>{const{pathResolvers:t}=await this.#t.getPathResolvers();return t})}async getCheckTemplates(){return this.#e(async()=>{const{checkerTemplates:t}=await this.#t.getCheckTemplates();return t})}async getFact(t){return this.#e(async()=>{const{fact:e}=await this.#t.getFact(t);return e})}async getGroupTypeHierarchy(){return this.#e(async()=>{const{groupTypeHierarchy:t}=await this.#t.getGroupTypeHierarchy();return t})}async getGroupHierarchy(t,e,a){return this.#e(async()=>{const{groupHierarchy:s}=await this.#t.getGroupHierarchy({groupRef:t,ownedEntitiesFilter:e,includeParent:a});return s})}async getHierarchicalTrackStatus(t,e){return this.#e(async()=>{const{hierarchicalTrackStatus:a}=await this.#t.getHierarchicalTrackStatus({trackId:t,groupRef:e});return a})}async getHierarchicalTrackStatuses(t,e){return this.#e(async()=>{const{hierarchicalTrackStatuses:a}=await this.#t.getHierarchicalTrackStatuses({trackIds:t,groupRef:e});return a})}async recordLoadTime(t){return this.#e(async()=>await this.#t.recordLoadTime({input:{metricType:t.metricType,routeName:t.routeName,loadTimeMs:t.loadTimeMs,additionalAttributes:t.additionalAttributes}}))}}export{g as SoundcheckApi,y as soundcheckApiRef};
2
2
  //# sourceMappingURL=api.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as o}from"react/jsx-runtime";import{useEffect as s}from"react";import"../../contexts/TrackFormContext.esm.js";import"../../contexts/CheckFormContext.esm.js";import{CampaignFormProvider as i,useCampaignFormContext as c}from"../../contexts/CampaignFormContext.esm.js";import"../../contexts/UserProvider.esm.js";import"@backstage/catalog-model";import"@backstage/core-plugin-api";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{useCreateCampaign as g}from"../../hooks/campaigns/useCreateCampaign.esm.js";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{useNavigateBack as f}from"../../hooks/useNavigateBack.esm.js";import{campaignsPageRouteRef as d}from"../../routes.esm.js";import{CampaignForm as u}from"../CampaignForm/CampaignForm.esm.js";import"../SoundcheckHeader/SoundcheckHeader.esm.js";import"../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as C}from"../SoundcheckHeader/useHeader.esm.js";const l=()=>{const{setIsLoading:t}=c(),{mutateAsync:m,isLoading:r}=g();s(()=>{t(r)},[t,r]);const[a,e]=f(d),p=async n=>{await m(n,{onSuccess:e})};return C({title:"Create a Campaign",description:"Create, monitor, and manage software updates or system transitions.",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/campaigns"}),o(i,{children:o(u,{onSave:p,onCancel:a})})},h=()=>o(i,{children:o(l,{})});export{h as CampaignCreatePage};
1
+ import{jsx as o}from"react/jsx-runtime";import{useEffect as s}from"react";import"../../contexts/TrackFormContext.esm.js";import"../../contexts/CheckFormContext.esm.js";import{CampaignFormProvider as i,useCampaignFormContext as c}from"../../contexts/CampaignFormContext.esm.js";import"../../contexts/UserProvider.esm.js";import"@backstage/catalog-model";import"@backstage/core-plugin-api";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{useCreateCampaign as g}from"../../hooks/campaigns/useCreateCampaign.esm.js";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{useNavigateBack as f}from"../../hooks/useNavigateBack.esm.js";import"react-router-dom";import{campaignsPageRouteRef as d}from"../../routes.esm.js";import{CampaignForm as u}from"../CampaignForm/CampaignForm.esm.js";import"../SoundcheckHeader/SoundcheckHeader.esm.js";import"../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as C}from"../SoundcheckHeader/useHeader.esm.js";const l=()=>{const{setIsLoading:t}=c(),{mutateAsync:m,isLoading:r}=g();s(()=>{t(r)},[t,r]);const[a,e]=f(d),p=async n=>{await m(n,{onSuccess:e})};return C({title:"Create a Campaign",description:"Create, monitor, and manage software updates or system transitions.",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/campaigns"}),o(i,{children:o(u,{onSave:p,onCancel:a})})},h=()=>o(i,{children:o(l,{})});export{h as CampaignCreatePage};
2
2
  //# sourceMappingURL=CampaignCreatePage.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as l,jsx as o}from"react/jsx-runtime";import{makeStyles as g,Typography as m}from"@material-ui/core";import{uniqBy as h}from"lodash";import"../../../../contexts/TrackFormContext.esm.js";import"../../../../contexts/CheckFormContext.esm.js";import"../../../../contexts/CampaignFormContext.esm.js";import"react";import{useLoggedInUser as v}from"../../../../contexts/UserProvider.esm.js";import{useGroupOptions as x}from"../../../../hooks/groups/useGroupOptions.esm.js";import{FormControlledAutocomplete as y}from"../../../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import"@material-ui/icons/CheckBox";import"@material-ui/icons/CheckBoxOutlineBlank";import"@material-ui/lab";import"react-hook-form";import"../../../ListboxVirtualized/ListboxVirtualized.esm.js";import{useLabelOptions as w}from"../../../FormControlledAutocomplete/useLabelOptions.esm.js";import"../../../FormControlledAutocomplete/ControlledAutocomplete.esm.js";import{CAMPAIGN_FIELDS as b}from"../../utils/campaignFormUtils.esm.js";const C=g(e=>({helperText:{marginLeft:0},selectField:{display:"flex",flexDirection:"column",gap:e.spacing(1),marginBottom:e.spacing(2)},fieldContainer:{width:"250px"}})),F=({control:e,errors:p,isLoading:s,disabled:d})=>{const t=C(),{owner:n}=b.details,{options:c}=x(),{user:f,userEntityRef:r}=v();let i=h(c?.map(a=>({value:a.ref,label:a.name})),"value");const u=w(i);return r&&(i=[{value:r,label:f?.metadata.name??r},...i]),l("div",{className:t.selectField,children:[l("header",{children:[o(m,{variant:"subtitle2",children:n.name}),o(m,{variant:"caption",children:n.description})]}),o("div",{className:t.fieldContainer,children:o(y,{name:"detailsStep.ownerEntityRef",control:e,placeholder:"Owner",freeSolo:!1,disabled:d||s,helperText:p?.ownerEntityRef?.message??void 0,...u})})]})};export{F as CampaignOwnerField};
1
+ import{jsxs as m,jsx as i}from"react/jsx-runtime";import{makeStyles as g,Typography as p}from"@material-ui/core";import{uniqBy as h}from"lodash";import"../../../../contexts/TrackFormContext.esm.js";import"../../../../contexts/CheckFormContext.esm.js";import"../../../../contexts/CampaignFormContext.esm.js";import"react";import{useLoggedInUser as v}from"../../../../contexts/UserProvider.esm.js";import{useGroupOptions as x}from"../../../../hooks/groups/useGroupOptions.esm.js";import{FormControlledAutocomplete as y}from"../../../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import"@material-ui/icons/CheckBox";import"@material-ui/icons/CheckBoxOutlineBlank";import"@material-ui/lab";import"react-hook-form";import"../../../ListboxVirtualized/ListboxVirtualized.esm.js";import{useLabelValueOptions as w}from"../../../FormControlledAutocomplete/useLabelValueOptions.esm.js";import"../../../FormControlledAutocomplete/ControlledAutocomplete.esm.js";import{CAMPAIGN_FIELDS as b}from"../../utils/campaignFormUtils.esm.js";const C=g(e=>({helperText:{marginLeft:0},selectField:{display:"flex",flexDirection:"column",gap:e.spacing(1),marginBottom:e.spacing(2)},fieldContainer:{width:"250px"}})),F=({control:e,errors:s,isLoading:d,disabled:c})=>{const n=C(),{owner:a}=b.details,{options:f}=x(),{user:l,userEntityRef:r}=v();let t=h(f?.map(o=>({value:o.ref,label:o.name,description:o.description})),"value");const u=w(t);return r&&(t=[{value:r,label:l?.metadata.name??r,description:l?.metadata.description},...t]),m("div",{className:n.selectField,children:[m("header",{children:[i(p,{variant:"subtitle2",children:a.name}),i(p,{variant:"caption",children:a.description})]}),i("div",{className:n.fieldContainer,children:i(y,{name:"detailsStep.ownerEntityRef",control:e,placeholder:"Owner",freeSolo:!1,disabled:c||d,helperText:s?.ownerEntityRef?.message??void 0,...u})})]})};export{F as CampaignOwnerField};
2
2
  //# sourceMappingURL=CampaignOwnerField.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{jsx as a}from"react/jsx-runtime";import{useFeatureFlag as e}from"../../hooks/useFeatureFlag.esm.js";import{CampaignPageBUI as m}from"./CampaignPageBUI.esm.js";import{CampaignPageDeprecated as r}from"./CampaignPageDeprecated.esm.js";const o=()=>e("backstage-ui")?a(m,{}):a(r,{});export{o as CampaignPage};
2
+ //# sourceMappingURL=CampaignPage.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{jsx as e,jsxs as r,Fragment as y}from"react/jsx-runtime";import{useRouteRef as ne,useApi as j,configApiRef as se}from"@backstage/core-plugin-api";import{EntityRefLink as ce,entityPresentationApiRef as le}from"@backstage/plugin-catalog-react";import{usePermission as M}from"@backstage/plugin-permission-react";import{Button as me,Box as n,HeaderPage as de,Tabs as pe,TabList as he,Tab as O,TabPanel as _,Flex as b,Text as l,Grid as S,Card as fe,CardHeader as ue}from"@backstage/ui";import{makeStyles as ge}from"@material-ui/core";import{soundcheckCampaignUpdatePermission as Ce,soundcheckCampaignNotificationsCreatePermission as ye}from"@spotify/backstage-plugin-soundcheck-common";import{isEmpty as be}from"lodash";import{DateTime as k}from"luxon";import{useState as K,useMemo as h,useEffect as Se}from"react";import{useParams as ke,useNavigate as ve}from"react-router-dom";import{useCheckStatuses as Ee}from"../../hooks/aggregations/useCheckStatuses.esm.js";import{useCheckStatusTotals as Te}from"../../hooks/checks/useCheckStatusTotals.esm.js";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"../../hooks/useSoundcheckAlert.esm.js";import{useGetCampaigns as Ie}from"../../hooks/campaigns/useGetCampaigns.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{useCertificationStatus as we}from"../../hooks/aggregations/useCertificationStatus.esm.js";import{useLCPReporting as Le}from"../../hooks/useLCPReporting.esm.js";import{useLoadTimeReporting as Ne}from"../../hooks/useLoadTimeReporting.esm.js";import{campaignEditRouteRef as Re}from"../../routes.esm.js";import{DescriptionCard as Pe}from"../Cards/DescriptionCard/DescriptionCard.esm.js";import{CurrentStatusCard as xe}from"../Cards/CurrentStatusCard/CurrentStatusCard.esm.js";import{ChecksTable as Be}from"../ChecksTable/ChecksTable.esm.js";import{ChipSelector as Fe}from"../ChipSelector/ChipSelector.esm.js";import{EmptyStateBUI as Ae}from"../EmptyState/EmptyStateBUI.esm.js";import"../FilterSidebar/FilterSidebar.esm.js";import"../FilterSidebar/StateFilter.esm.js";import{useTrackFilterSidebar as De}from"../FilterSidebar/useTrackFilterSidebar.esm.js";import{toFilter as He,CERTIFICATION_STATUS_MAP as je}from"../FilterSidebar/util.esm.js";import{LoadingTableSkeleton as Me}from"../LoadingTableSkeleton/LoadingTableSkeleton.esm.js";import{PageCustomActions as Oe}from"../PageCustomActions/PageCustomActions.esm.js";import{SendCampaignNotificationDialog as _e}from"../SendCampaignNotificationDialog/SendCampaignNotificationDialog.esm.js";import"../SoundcheckHeader/SoundcheckHeader.esm.js";import"../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as Ke}from"../SoundcheckHeader/useHeader.esm.js";import{SoundcheckMarkdownContent as Ue}from"../SoundcheckMarkdownContent/SoundcheckMarkdownContent.esm.js";import"@backstage/core-components";import"react-markdown";import"rehype-raw";import"remark-gfm";import{TopFailingChecksTableBUI as ze}from"../TopFailingChecksTable/TopFailingChecksTableBUI.esm.js";import{TrackEntitiesTableBUI as Ge}from"../TrackPage/TrackEntitiesTable/TrackEntitiesTableBUI.esm.js";const Ve=ge(a=>({editButton:{marginLeft:"auto"},notificationButton:{marginRight:a.spacing(1)},headerDescription:{fontSize:a.typography.body2.fontSize,margin:a.spacing(.5,0,0),"& p":{margin:0},"& a":{color:"inherit",textDecoration:"underline"}},ownerLink:{"& span":{color:"inherit","&:hover":{textDecoration:"underline"}}},emptyContainer:{padding:"var(--bui-space-1)"},container:{padding:"0 var(--bui-space-3)"},tables:{margin:"0 var(--bui-space-2)"},tableContent:{margin:"var(--bui-space-3) 0 var(--bui-space-6)"},tabPanel:{padding:"var(--bui-space-6) 0 0"},tabs:{marginBottom:"var(--bui-space-6)"}})),u={CHECKS:"Checks",TOP_FAILING_CHECKS:"Top Failing Checks",ENTITIES:"Entities"},qe=()=>{const{owners:a,lifecycles:m,types:d,systems:p,certificationStatuses:v}=De(),{campaignId:s}=ke(),[U,z]=K(""),[E,G]=K(new Set([u.CHECKS])),g=E.values().next().value??u.CHECKS,T=h(()=>({routeName:"soundcheck-campaign-insights",additionalAttributes:{campaignId:s||"",filtersApplied:a.length+m.length+d.length+p.length,ownersFilter:a?.join(",")||"",lifecyclesFilter:m?.join(",")||"",typesFilter:d?.join(",")||"",systemsFilter:p?.join(",")||""}}),[s,a,m,d,p]),{reportContentLoaded:I}=Ne(T),{reporter:V}=Le(T),t=Ve(),w=h(()=>He({lifecycles:m,owners:a,types:d,systems:p}),[m,a,d,p]),{data:q,isLoading:f}=Ie({ids:[s],first:1}),o=q?.edges?.[0]?.node,i=o?.track,$=h(()=>i?.levels.flatMap(c=>c.checks),[i?.levels]),{loading:L,allowed:N}=M({permission:Ce,resourceRef:s}),J=Array.from(new Set(i?.levels.flatMap(c=>c.checks).map(c=>c.id)??[])),{data:C,isLoading:Q}=Ee({trackId:i?.id,checkIds:J,filter:w},!!i),W=Te(C),R=ve(),P=ne(Re),X=h(()=>i?.ownerEntityRef?e(ce,{color:"inherit",entityRef:i.ownerEntityRef,className:t.ownerLink}):null,[i?.ownerEntityRef,t.ownerLink]),x=j(se).getOptionalBoolean("soundcheck.notifications.enabled"),{loading:B,allowed:F}=M({permission:ye}),{data:Y,isLoading:A}=we({trackId:i?.id??"",filter:w},!!o),Z=h(()=>r(y,{children:[x&&!B&&F&&o&&e(_e,{campaign:o,buttonClass:t.notificationButton}),!L&&N&&i?.isEditable?e(me,{className:t.editButton,variant:"primary",onClick:()=>{R(P({campaignId:s}))},children:"Edit Campaign"}):null]}),[x,B,F,o,t.notificationButton,t.editButton,L,N,i?.isEditable,R,P,s]),ee=h(()=>i?.description?e(Ue,{className:t.headerDescription,content:i.description}):null,[t.headerDescription,i?.description]),ie=j(le);Ke({title:i?.name,description:ee,customSubtitle:X,sectionRight:Z});const D=V?.getLCPValue();if(Se(()=>{!f&&!A&&I({lcp:D})},[f,A,I,D]),f)return e(Me,{});if(!f&&!o)return e(n,{className:t.emptyContainer,children:e(Ae,{title:"Campaign not found",body:`There is no campaign with the requested id: ${s}.`})});const te=o?ie.forEntity(o.ownerEntityRef):void 0,re=k.fromISO(o?.startDate),H=k.fromISO(o?.targetCompletionDate),oe=k.now(),ae=Math.max(Math.ceil(H.diff(oe,"days").days),0);return r(y,{children:[e(n,{children:e(de,{title:o?.name})}),r(n,{className:t.container,children:[r(pe,{className:t.tabs,children:[r(he,{children:[e(O,{id:"campaign-overview",children:"Campaign Overview"}),e(O,{id:"tech-insights-explorer",children:"Tech Insights Explorer"})]}),e(_,{id:"campaign-overview",children:r(b,{className:t.tabPanel,children:[e(Pe,{description:o?.description??void 0,owner:te?.snapshot.primaryTitle??void 0}),e(xe,{totals:W,children:r(y,{children:[r(b,{align:"baseline",children:[e(l,{as:"h1",variant:"title-medium",weight:"bold",children:ae}),e(l,{variant:"body-small",children:"Days remaining"})]}),r(S.Root,{children:[r(S.Item,{children:[e(n,{children:e(l,{color:"secondary",variant:"body-small",children:"Start date"})}),e(n,{children:e(l,{variant:"body-small",children:re.toLocaleString({month:"short",day:"numeric",year:"numeric"})})})]}),r(S.Item,{children:[e(n,{children:e(l,{color:"secondary",variant:"body-small",children:"End date"})}),e(n,{children:e(l,{variant:"body-small",children:H.toLocaleString({month:"short",day:"numeric",year:"numeric"})})})]})]})]})}),e(fe,{children:e(ue,{children:e(l,{color:"secondary",children:"Historical Status"})})})]})}),e(_,{id:"tech-insights-explorer",children:e(n,{className:t.tabPanel,children:"Tech Insights Explorer"})})]}),i&&r(n,{className:t.tables,children:[r(b,{justify:"between",children:[e(Fe,{options:["Checks","Top Failing Checks","Entities"],selected:E,ariaLabel:"Sections",onSelectionChange:G}),e(Oe,{searchValue:U,setSearchValue:c=>z(c)})]}),r(n,{className:t.tableContent,children:[g===u.CHECKS&&e(Be,{checks:$,checkStatuses:C,isLoading:f||Q}),g===u.TOP_FAILING_CHECKS&&e(ze,{track:i,checkStatuses:C,certificationStatus:Y?.certificationStatus}),g===u.ENTITIES&&e(Ge,{track:i,lifecycles:m,owners:a,types:d,systems:p,certificationStatus:be(v)?void 0:je[v[0]]})]})]})]})]})};export{qe as CampaignPageBUI};
2
+ //# sourceMappingURL=CampaignPageBUI.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{jsx as i,jsxs as n,Fragment as ne}from"react/jsx-runtime";import{useRouteRef as re,useApi as se,configApiRef as ce}from"@backstage/core-plugin-api";import{EntityRefLink as le}from"@backstage/plugin-catalog-react";import{usePermission as y}from"@backstage/plugin-permission-react";import{makeStyles as me,Button as pe,Box as s,Typography as D,Divider as de,Tabs as ge,Tab as C}from"@material-ui/core";import{soundcheckCampaignReadPermission as fe,soundcheckCampaignUpdatePermission as he,soundcheckCampaignNotificationsCreatePermission as ue,toEntityFilterQuery as ye}from"@spotify/backstage-plugin-soundcheck-common";import{isEmpty as Ce}from"lodash";import{useMemo as d,useState as ke,useCallback as Se,useEffect as be}from"react";import{useParams as Te,useNavigate as we}from"react-router-dom";import{useCheckStatuses as ve}from"../../hooks/aggregations/useCheckStatuses.esm.js";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"../../hooks/useSoundcheckAlert.esm.js";import{useGetCampaigns as Fe}from"../../hooks/campaigns/useGetCampaigns.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{useCertificationStatus as xe}from"../../hooks/aggregations/useCertificationStatus.esm.js";import{useLCPReporting as Le}from"../../hooks/useLCPReporting.esm.js";import{useLoadTimeReporting as Ne}from"../../hooks/useLoadTimeReporting.esm.js";import{campaignEditRouteRef as Re}from"../../routes.esm.js";import{FilterSidebar as Ae}from"../FilterSidebar/FilterSidebar.esm.js";import"../FilterSidebar/StateFilter.esm.js";import{useTrackFilterSidebar as Be}from"../FilterSidebar/useTrackFilterSidebar.esm.js";import{toFilter as Ee,CERTIFICATION_STATUS_MAP as De}from"../FilterSidebar/util.esm.js";import{LevelsTable as Ie}from"../LevelsTable/LevelsTable.esm.js";import{LoadingIndicator as Pe}from"../LoadingIndicator/LoadingIndicator.esm.js";import{PageWarningMessage as je}from"../PageWarningMessage/PageWarningMessage.esm.js";import{SendCampaignNotificationDialog as Oe}from"../SendCampaignNotificationDialog/SendCampaignNotificationDialog.esm.js";import"../SoundcheckHeader/SoundcheckHeader.esm.js";import"../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as Me}from"../SoundcheckHeader/useHeader.esm.js";import{SoundcheckMarkdownContent as ze}from"../SoundcheckMarkdownContent/SoundcheckMarkdownContent.esm.js";import"@backstage/core-components";import"react-markdown";import"rehype-raw";import"remark-gfm";import{TopFailingChecksTable as He}from"../TopFailingChecksTable/TopFailingChecksTable.esm.js";import{TrackEntitiesTable as We}from"../TrackPage/TrackEntitiesTable/TrackEntitiesTable.esm.js";import{CampaignStatusHistoryTile as _e}from"./CampaignStatusHistoryTile.esm.js";import{CampaignStatusTile as $e}from"./CampaignStatusTile.esm.js";import{DaysRemainingTile as Ue}from"./DaysRemainingTile.esm.js";const Ve=me(e=>({root:{height:"100%",background:e.palette.background.default,display:"flex",width:"100%",borderTop:`1px solid ${e.palette.divider}`},progressContainer:{flex:1,borderBottom:`1px solid ${e.palette.divider}`,padding:e.spacing(2)},campaignContainerContent:{paddingTop:e.spacing(1),paddingBottom:e.spacing(1),backgroundColor:e.palette.background.paper},editButton:{marginLeft:"auto"},notificationButton:{marginRight:e.spacing(1)},checksContainer:{},entitiesContainer:{marginTop:e.spacing(3)},headerDescription:{fontSize:e.typography.body2.fontSize,margin:e.spacing(.5,0,0),"& p":{margin:0},"& a":{color:"inherit",textDecoration:"underline"}},content:{paddingTop:0,flex:1},ownerLink:{"& span":{color:"inherit","&:hover":{textDecoration:"underline"}}},sectionTitle:{paddingBottom:e.spacing(1)},chartSection:{flex:1,flexBasis:"auto",minWidth:320,display:"flex",flexDirection:"column",height:"100%"},title:{fontWeight:"bold",fontSize:"1.1rem",lineHeight:`${e.typography.h5.fontSize}px`,cursor:"default",marginBottom:e.spacing(2)},divider:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},tabs:{padding:e.spacing(2,2,0,2)},contentArea:{flex:1,padding:e.spacing(0,2)},tableArea:{margin:e.spacing(1,0,2)}})),Ge=()=>{const{owners:e,lifecycles:l,types:m,systems:p,certificationStatuses:k,stagedLifecycles:I,setStagedLifecycles:P,stagedOwners:j,setStagedOwners:O,stagedTypes:M,setStagedTypes:z,stagedSystems:H,setStagedSystems:W,stagedCertificationStatuses:S,setStagedCertificationStatuses:_,hasFilterChanges:$,handleApplyFilters:U,handleClearFilters:V}=Be(),{campaignId:r}=Te(),b=d(()=>({routeName:"soundcheck-campaign-insights",additionalAttributes:{campaignId:r||"",filtersApplied:e.length+l.length+m.length+p.length,ownersFilter:e?.join(",")||"",lifecyclesFilter:l?.join(",")||"",typesFilter:m?.join(",")||"",systemsFilter:p?.join(",")||""}}),[r,e,l,m,p]),{reportContentLoaded:T}=Ne(b),{reporter:G}=Le(b),t=Ve(),f=d(()=>Ee({lifecycles:l,owners:e,types:m,systems:p}),[l,e,m,p]),[h,Q]=ke("checks"),q=Se((c,oe)=>{Q(oe)},[]),{data:J,isLoading:g}=Fe({ids:[r],first:1}),o=J?.edges?.[0]?.node,a=o?.track,{loading:K,allowed:X}=y({permission:fe,resourceRef:r}),{loading:w,allowed:v}=y({permission:he,resourceRef:r}),Y=Array.from(new Set(a?.levels.flatMap(c=>c.checks).map(c=>c.id)??[])),{data:F,isLoading:u}=ve({trackId:a?.id,checkIds:Y,filter:f},!!a),x=we(),L=re(Re),Z=d(()=>a?.ownerEntityRef?i(le,{color:"inherit",entityRef:a.ownerEntityRef,className:t.ownerLink}):null,[a?.ownerEntityRef,t.ownerLink]),N=se(ce).getOptionalBoolean("soundcheck.notifications.enabled"),{loading:R,allowed:A}=y({permission:ue}),{data:ee,isLoading:B}=xe({trackId:a?.id??"",filter:f},!!o),ie=d(()=>n(ne,{children:[N&&!R&&A&&o&&i(Oe,{campaign:o,buttonClass:t.notificationButton}),!w&&v&&a?.isEditable?i(pe,{className:t.editButton,variant:"contained",color:"primary",onClick:()=>{x(L({campaignId:r}))},children:"Edit Campaign"}):null]}),[N,R,A,o,t.notificationButton,t.editButton,w,v,a?.isEditable,x,L,r]),te=d(()=>a?.description?i(ze,{className:t.headerDescription,content:a.description}):null,[t.headerDescription,a?.description]);Me({title:a?.name,description:te,customSubtitle:Z,sectionRight:ie});const ae=d(()=>ye(a?.filter),[a]),E=G?.getLCPValue();return be(()=>{!g&&!u&&!B&&T({lcp:E})},[g,u,B,T,E]),n("div",{children:[i(je,{entityName:"track",entityId:r,showNotFound:!g&&!o,showCannotView:!K&&!X}),g&&i(Pe,{}),a&&n("div",{className:t.root,children:[i(s,{children:i(Ae,{trackFilter:ae,stagedTypes:M,stagedLifecycles:I,stagedOwners:j,stagedSystems:H,stagedCertificationStatus:S?S[0]:"",onTypesChange:z,onLifecyclesChange:P,onOwnersChange:O,onSystemsChange:W,onCertificationStatusChange:c=>_(c?[c]:[]),onApplyFilters:U,onClearFilters:V,hasFilterChanges:$})}),n(s,{className:t.content,children:[i("div",{className:t.progressContainer,children:n(s,{display:"flex",marginTop:2,children:[n(s,{display:"flex",flexDirection:"column",marginRight:3,minWidth:320,children:[i(D,{className:t.title,children:"Current Status"}),i($e,{campaign:o,filter:f}),i(de,{className:t.divider}),i(Ue,{campaign:o})]}),n(s,{className:t.chartSection,children:[i(D,{className:t.title,children:"Historical Status"}),i(_e,{campaign:o,filter:f})]})]})}),i(s,{className:t.tabs,children:n(ge,{value:h,onChange:q,indicatorColor:"primary",textColor:"primary",children:[i(C,{label:"Checks",value:"checks"}),i(C,{label:"Top Failing Checks",value:"topFailingChecks"}),i(C,{label:"Entities",value:"entities"})]})}),n(s,{className:t.contentArea,children:[h==="checks"&&i("div",{className:t.tableArea,children:i(Ie,{track:a,checkStatuses:F,isLoading:g||u,hideLevel:!0})}),h==="entities"&&i(s,{marginTop:1,children:i(We,{track:a,lifecycles:l,owners:e,types:m,systems:p,certificationStatus:Ce(k)?void 0:De[k[0]]})}),h==="topFailingChecks"&&i("div",{className:t.tableArea,children:i(He,{track:a,checkStatuses:F,certificationStatus:ee?.certificationStatus,hideLevel:!0})})]})]})]})]})};export{Ge as CampaignPageDeprecated};
2
+ //# sourceMappingURL=CampaignPageDeprecated.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as t,jsxs as s}from"react/jsx-runtime";import{useTheme as S,Box as i,Grid as b,Typography as f}from"@material-ui/core";import{makeStyles as B}from"@material-ui/core/styles";import I from"@material-ui/icons/TrendingDown";import k from"@material-ui/icons/TrendingFlat";import R from"@material-ui/icons/TrendingUp";import{DateTime as N}from"luxon";import{useMemo as T}from"react";import"@backstage/catalog-model";import"@backstage/core-plugin-api";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{useCertificationStatus as w}from"../../hooks/aggregations/useCertificationStatus.esm.js";import{useCertificationStatusHistory as L}from"../../hooks/aggregations/useCertificationStatusHistory.esm.js";import"react-router-dom";import{compactNumberFormatter as g}from"../../utils/formatters.esm.js";import{CategoryBar as j}from"../CategoryBar/CategoryBar.esm.js";import{LoadingIndicator as M}from"../LoadingIndicator/LoadingIndicator.esm.js";const C=B(e=>({card:{display:"flex",flexDirection:"column"},content:{padding:0,display:"flex",margin:0,gap:e.spacing(1)},item:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(.5)},legendDash:{width:e.spacing(2),height:e.spacing(1),borderRadius:e.spacing(.375),marginRight:e.spacing(1)},category:{display:"flex",alignItems:"center",flex:1,marginRight:e.spacing(2)}}));function v({label:e,value:l,total:a,color:m,valueFormatter:c}){const p=C();return s(b,{item:!0,xs:12,className:p.item,children:[s(i,{className:p.category,children:[t("span",{className:p.legendDash,style:{backgroundColor:m}}),t(f,{children:e})]}),a&&s(f,{children:[c(l)," of ",c(a)," (",Math.round(l/a*100),"%)"]})]})}function H({campaign:e,filter:l}){const a=S(),m=C(),{data:c,isLoading:p}=w({trackId:e.track.id,filter:l},!0),r=c?.certificationStatus.statusByLevel[0],D=Math.max(Math.ceil(N.now().diff(N.fromISO(e.startDate),"days").days),1),{data:u}=L({trackId:e.track.id,filter:l,numberOfDays:D},!!e),o=c?.certificationStatus.numberOfEntities??0,d=T(()=>{if(o===void 0||u===void 0||r===void 0)return;const x=(u.certificationStatusHistory.history[0]?.statusByLevel[0].passed??0)/o*100;return r.passed/o*100-x},[u,r,o]);let h=k,y="inherit",n;return d&&(n=`${d.toFixed(0)}% since campaign start`,d<=-1?(h=I,n=`-${n}`,y="error"):d>=1&&(h=R,n=`+${n}`,y="primary")),p?t(i,{className:m.card,children:t(M,{})}):t(i,{className:m.card,children:r?t(i,{className:m.content,children:s(i,{width:"100%",children:[t(j,{data:r,valueFormatter:g,categories:["passed","failed","notReported"],categoryFormatter:x=>x.replace(/\b\w/g,F=>F.toUpperCase()),colors:[a.palette.success.main,a.palette.error.main,a.palette.text.disabled]}),t(i,{paddingTop:"12px",children:s(b,{spacing:2,children:[t(v,{label:"Passing",value:r.passed,total:o,color:a.palette.success.main,valueFormatter:g}),t(v,{label:"Failing",value:r.failed,total:o,color:a.palette.error.main,valueFormatter:g}),t(v,{label:"Not Reported",value:r.notReported,total:o,color:a.palette.text.disabled,valueFormatter:g}),!!d&&s(i,{display:"flex",alignItems:"center",paddingTop:"12px",children:[t(h,{color:y}),t(f,{style:{marginLeft:a.spacing(1)},children:n})]})]})})]})}):t(i,{margin:"auto",minHeight:125,display:"flex",flexDirection:"column",justifyContent:"center",children:t(f,{style:{marginBottom:8},variant:"subtitle1",children:"No Data"})})})}export{H as CampaignStatusTile};
1
+ import{jsx as t,jsxs as s}from"react/jsx-runtime";import{useTheme as S,Box as i,Grid as b,Typography as f}from"@material-ui/core";import{makeStyles as B}from"@material-ui/core/styles";import I from"@material-ui/icons/TrendingDown";import k from"@material-ui/icons/TrendingFlat";import R from"@material-ui/icons/TrendingUp";import{DateTime as N}from"luxon";import{useMemo as T}from"react";import"@backstage/catalog-model";import"@backstage/core-plugin-api";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{useCertificationStatus as w}from"../../hooks/aggregations/useCertificationStatus.esm.js";import{useCertificationStatusHistory as L}from"../../hooks/aggregations/useCertificationStatusHistory.esm.js";import"react-router-dom";import{compactNumberFormatter as g}from"../../utils/formatters.esm.js";import{CategoryBar as j}from"../CategoryBar/CategoryBar.esm.js";import{LoadingIndicator as M}from"../LoadingIndicator/LoadingIndicator.esm.js";const C=B(e=>({card:{display:"flex",flexDirection:"column"},content:{padding:0,display:"flex",margin:0,gap:e.spacing(1)},item:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(.5)},legendDash:{width:e.spacing(2),height:e.spacing(1),borderRadius:e.spacing(.375),marginRight:e.spacing(1)},category:{display:"flex",alignItems:"center",flex:1,marginRight:e.spacing(2)}}));function v({label:e,value:l,total:a,color:m,valueFormatter:c}){const p=C();return s(b,{item:!0,xs:12,className:p.item,children:[s(i,{className:p.category,children:[t("span",{className:p.legendDash,style:{backgroundColor:m}}),t(f,{children:e})]}),a&&s(f,{children:[c(l)," of ",c(a)," (",Math.round(l/a*100),"%)"]})]})}function H({campaign:e,filter:l}){const a=S(),m=C(),{data:c,isLoading:p}=w({trackId:e.track.id,filter:l},!0),r=c?.certificationStatus.statusByLevel[0],D=Math.max(Math.ceil(N.now().diff(N.fromISO(e.startDate),"days").days),1),{data:u}=L({trackId:e.track.id,filter:l,numberOfDays:D},!!e),o=c?.certificationStatus.numberOfEntities??0,d=T(()=>{if(o===void 0||u===void 0||r===void 0)return;const x=(u.certificationStatusHistory.history[0]?.statusByLevel[0].passed??0)/o*100;return r.passed/o*100-x},[u,r,o]);let h=k,y="inherit",n;return d&&(n=`${d.toFixed(0)}% since campaign start`,d<=-1?(h=I,n=`-${n}`,y="error"):d>=1&&(h=R,n=`+${n}`,y="primary")),p?t(i,{className:m.card,children:t(M,{})}):t(i,{className:m.card,children:r?t(i,{className:m.content,children:s(i,{width:"100%",children:[t(j,{data:r,valueFormatter:g,categories:["passed","failed","notReported"],categoryFormatter:x=>x.replace(/\b\w/g,F=>F.toUpperCase()),colors:[a.palette.success.main,a.palette.error.main,a.palette.text.disabled]}),t(i,{paddingTop:"12px",children:s(b,{container:!0,spacing:2,children:[t(v,{label:"Passing",value:r.passed,total:o,color:a.palette.success.main,valueFormatter:g}),t(v,{label:"Failing",value:r.failed,total:o,color:a.palette.error.main,valueFormatter:g}),t(v,{label:"Not Reported",value:r.notReported,total:o,color:a.palette.text.disabled,valueFormatter:g}),!!d&&s(i,{display:"flex",alignItems:"center",paddingTop:"12px",children:[t(h,{color:y}),t(f,{style:{marginLeft:a.spacing(1)},children:n})]})]})})]})}):t(i,{margin:"auto",minHeight:125,display:"flex",flexDirection:"column",justifyContent:"center",children:t(f,{style:{marginBottom:8},variant:"subtitle1",children:"No Data"})})})}export{H as CampaignStatusTile};
2
2
  //# sourceMappingURL=CampaignStatusTile.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{jsx as a,jsxs as y}from"react/jsx-runtime";import{useRouteRef as J,useApi as K,featureFlagsApiRef as Q}from"@backstage/core-plugin-api";import{usePermission as U}from"@backstage/plugin-permission-react";import{makeStyles as X,Grid as i,Button as Y}from"@material-ui/core";import{soundcheckCampaignCreatePermission as Z}from"@spotify/backstage-plugin-soundcheck-common";import{useState as t,useMemo as _,useEffect as A}from"react";import{useNavigate as ee}from"react-router-dom";import ae from"react-use/lib/useDebounce";import{useGetCampaignOwners as re}from"../../../hooks/campaigns/useGetCampaignOwners.esm.js";import{useGetCampaigns as ie}from"../../../hooks/campaigns/useGetCampaigns.esm.js";import{useLCPReporting as te}from"../../../hooks/useLCPReporting.esm.js";import{useLoadTimeReporting as ne}from"../../../hooks/useLoadTimeReporting.esm.js";import{campaignCreateRouteRef as oe}from"../../../routes.esm.js";import{FilterDefault as C}from"../../../utils/filters.esm.js";import{EmptyState as se}from"../../EmptyState/EmptyState.esm.js";import"../../EmptyState/EmptyStateBUI.esm.js";import"@backstage/ui";import{Pagination as me}from"../../Pagination/Pagination.esm.js";import{SearchFilters as pe}from"../../SearchFilters/SearchFilters.esm.js";import{EmptyCampaignState as le}from"../CampaignEmptyState.esm.js";import{CampaignsOverviewSkeleton as ce}from"./CampaignsOverviewSkeleton.esm.js";import{CampaignSummaryCard as ge}from"./CampaignSummaryCard.esm.js";import de from"./useArchiveConfirmationModal.esm.js";var B=(e=>(e.title="No campaigns found",e.description="No campaigns matched your search. Consider changing search term and filters.",e))(B||{});const ue=X(e=>({headerButtons:{display:"flex",gap:e.spacing(1),flexWrap:"nowrap",justifyContent:"end",alignItems:"end"},header:{padding:e.spacing(0,0,1)},container:{padding:e.spacing(3),gap:e.spacing(3)},createButton:{lineHeight:"1.25rem",paddingTop:e.spacing(1.5),paddingBottom:e.spacing(1.5)}})),he=({campaignsPerPage:e,currentCursor:F})=>{const[o,P]=t(F),[d,R]=t(""),[s,k]=t(""),[m,L]=t(C.Alpha),[p,O]=t(C.Owner),[l,T]=t(C.Status),v=_(()=>({routeName:"soundcheck-campaigns",additionalAttributes:{campaignsPerPage:e,pageCursor:o||"",sortOrder:m||"",ownerFilter:p||"",statusFilter:l||"",nameSearch:s||""}}),[e,o,m,p,s,l]),{reportContentLoaded:S}=ne(v),{reporter:j}=te(v),c=ue(),{data:D,isLoading:u}=re();ae(()=>{k(d)},500,[d]);const{loading:E,allowed:G}=U({permission:Z}),{data:h,isLoading:n}=ie({ids:void 0,first:e,after:o,orderAlphabetical:m,searchByOwner:p,searchByName:s,searchByStatus:l}),I=ee(),W=J(oe),H=()=>I(W()),f=h?.edges.map(r=>r.node),[N,w]=t([]);A(()=>{P(void 0),w([])},[s]);const b=K(Q),M=!b.getRegisteredFlags().find(r=>r.name==="soundcheck-enable-campaigns")||b.isActive("soundcheck-enable-campaigns"),V=!G||!M,q=r=>{L(r.target.value)},z=r=>{O(r.target.value)},$=r=>{T(r.target.value)},x=j?.getLCPValue();if(A(()=>{!n&&!u&&S({lcp:x})},[n,u,S,x]),!n&&!f)return a(le,{});let g;return n?g=a(ce,{}):f?.length?g=f.map(r=>a(i,{xs:12,sm:12,md:6,lg:4,xl:3,item:!0,role:"listitem","aria-label":"result",children:a(de,{children:a(ge,{campaign:r})})},r.id)):g=a(i,{xs:12,item:!0,role:"listitem","aria-label":"result",children:a(se,{title:"No campaigns found",description:"No campaigns matched your search. Consider changing search term and filters."})}),y(i,{container:!0,direction:"row",className:c.container,children:[y(i,{container:!0,className:c.header,children:[a(pe,{searchPlaceholder:"Search Available Campaigns",isLoading:n||u,searchTerm:d,setSearchTerm:R,filterAlpha:m,handleAlphabeticalFilterChange:q,filterOwner:p,handleOwnerFilterChange:z,filterStatus:l,handleStatusFilterChange:$,owners:D}),a(i,{item:!0,xs:4,className:c.headerButtons,children:!E&&a(Y,{disabled:V,variant:"contained",color:"primary",onClick:H,className:c.createButton,children:"Create Campaign"})})]}),a(i,{container:!0,spacing:4,role:"list","aria-label":"campaigns",children:g}),(h?.pageInfo.hasNextPage||N?.length>0)&&a(i,{item:!0,xs:12,children:a(me,{response:h,listingsPerPage:e,cursor:o,setCursor:P,prevCursors:N,setPrevCursors:w,labelPerPageDropdown:"Campaigns Per Page:",urlRoute:"campaigns?campaignsPerPage="})})]})};export{he as CampaignListPageDeprecated,B as CampaignNoResults};
2
+ //# sourceMappingURL=CampaignListPageDeprecated.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{jsxs as l,Fragment as H,jsx as e}from"react/jsx-runtime";import{useApi as $,useRouteRef as L}from"@backstage/core-plugin-api";import{entityPresentationApiRef as O}from"@backstage/plugin-catalog-react";import{usePermission as V}from"@backstage/plugin-permission-react";import{Box as E,HeaderPage as j,Table as z,TableHeader as U,Column as n,TableBody as F,TablePagination as G}from"@backstage/ui";import{makeStyles as W}from"@material-ui/core";import{RiCalendarLine as Y}from"@remixicon/react";import{soundcheckCampaignCreatePermission as q}from"@spotify/backstage-plugin-soundcheck-common";import{sortBy as J,isEmpty as K}from"lodash";import{DateTime as I}from"luxon";import{useState as u,useMemo as s,useEffect as Q}from"react";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"../../hooks/useSoundcheckAlert.esm.js";import{useGetCampaigns as X}from"../../hooks/campaigns/useGetCampaigns.esm.js";import"../../hooks/useConfirmationModal.esm.js";import"react-router-dom";import{useSearchName as Z}from"../../hooks/useSearchName.esm.js";import{usePagination as _}from"../../hooks/usePagination.esm.js";import{useProfileImages as ee}from"../../hooks/catalog/useProfileImages.esm.js";import{useLCPReporting as re}from"../../hooks/useLCPReporting.esm.js";import{useLoadTimeReporting as ie}from"../../hooks/useLoadTimeReporting.esm.js";import{campaignCreateRouteRef as te,campaignDetailsRouteRef as ae}from"../../routes.esm.js";import"../EmptyState/EmptyState.esm.js";import{EmptyStateBUI as oe}from"../EmptyState/EmptyStateBUI.esm.js";import{EmptyStateNoCampaigns as ne}from"../EmptyState/EmptyStateNoCampaigns.esm.js";import{ListPageCustomActions as me}from"../ListPageCustomActions/ListPageCustomActions.esm.js";import{LoadingTableSkeleton as se}from"../LoadingTableSkeleton/LoadingTableSkeleton.esm.js";import{TableRowWithOwner as pe}from"../TableRowWithOwner/TableRowWithOwner.esm.js";const b=10,ce=W(()=>({container:{padding:"0 var(--bui-space-3)"},emptySpacing:{margin:"var(--bui-space-3) 0"}})),k=r=>{const m=I.fromISO(r),a=I.now();return Math.max(Math.ceil(m.diff(a,"days").days),0)},le=({campaign:r,profileImageMap:m})=>{const a=s(()=>r.archived?0:k(r.targetCompletionDate),[r.archived,r.targetCompletionDate]),d=L(ae),t=s(()=>r.track.levels.reduce((g,p)=>g+(p.checks?.length??0),0),[r.track.levels]);return e(pe,{ownerEntityRef:r.ownerEntityRef,href:d({campaignId:r.id}),profileImageSrc:m[r.ownerEntityRef],actions:["edit","archive","delete"],cells:[{title:r.name},{title:r.archived?"Archived":"Active"},{title:`${a} day${a===1?"":"s"} remaining`,icon:e(Y,{size:16})},{title:`${t} Check${t===1?"":"s"}`}]})},de=()=>{const[r,m]=u(""),[a,d]=u("ascending"),[t,g]=u(""),p=ce(),{data:h,isLoading:c}=X({}),y=s(()=>h?.edges?.map(i=>i.node)??[],[h?.edges]),{profileImageMap:T}=ee(y.map(i=>i.ownerEntityRef)),f=Z({items:y,searchTerm:r}),C=$(O),w=s(()=>{if(!t)return f;const i=J(f,o=>t==="owner"?C.forEntity(o.ownerEntityRef).snapshot.primaryTitle.toLowerCase():t==="status"?o.archived?"archived":"active":t==="days-remaining"?o.archived?-1:k(o.targetCompletionDate):o.name.toLowerCase());return a==="descending"&&i.reverse(),i},[C,t,a,f]),{paginatedItems:S,reset:A,paginationProps:D}=_({pageParam:"campaignsPerPage",defaultPageSize:b,items:w}),{loading:N,allowed:x}=V({permission:q}),M=L(te),R=s(()=>({routeName:"soundcheck-campaigns",additionalAttributes:{}}),[]),{reportContentLoaded:P}=ie(R),{reporter:B}=re(R),v=B?.getLCPValue();return Q(()=>{c||P({lcp:v})},[c,P,v]),l(H,{children:[e(E,{children:e(j,{customActions:e(me,{searchValue:r,setSearchValue:i=>{A(),m(i)},canCreate:!N&&x,createHref:M()}),title:"Campaigns"})}),l(E,{className:p.container,children:[l(z,{onSortChange:({direction:i,column:o})=>{g(String(o)),d(i)},sortDescriptor:{direction:a,column:t},children:[l(U,{children:[e(n,{allowsSorting:!0,isRowHeader:!0,id:"name",children:"Name"}),e(n,{allowsSorting:!0,id:"status",children:"Status"}),e(n,{allowsSorting:!0,id:"days-remaining",children:"Days Remaining"}),e(n,{id:"checks",children:"Checks"}),e(n,{allowsSorting:!0,id:"owner",children:"Campaign Owner"}),e(n,{style:{width:"30px"}})]}),e(F,{children:S.map(i=>e(le,{campaign:i,profileImageMap:T??{}},i.id))})]}),w.length>b&&e(G,{...D}),c&&e(se,{rowCount:10}),!c&&K(S)&&e("div",{className:p.emptySpacing,children:r?e(oe,{title:"No campaigns found",body:"Your current search term did not return any campaigns. Please try a different search term."}):e(ne,{})})]})]})};export{de as CampaignListPageBUI};
2
+ //# sourceMappingURL=CampaignListPageBUI.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as r}from"react/jsx-runtime";import{useSearchParams as t}from"react-router-dom";import"../../contexts/TrackFormContext.esm.js";import"../../contexts/CheckFormContext.esm.js";import{CampaignFormProvider as e}from"../../contexts/CampaignFormContext.esm.js";import"react";import"../../contexts/UserProvider.esm.js";import{useLCPReporting as a}from"../../hooks/useLCPReporting.esm.js";import{RESULTS_PER_PAGE as p}from"../../utils/filters.esm.js";import"../SoundcheckHeader/SoundcheckHeader.esm.js";import"../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useSetHeaderDefault as n}from"../SoundcheckHeader/useHeader.esm.js";import{CampaignListPage as s}from"./CampaignListPage/CampaignListPage.esm.js";import"./CampaignListPage/CampaignTypes.esm.js";const g=()=>{const[o]=t(),i=o.get("campaignsPerPage"),m=i?parseInt(i,10):p;return n(),a({routeName:"soundcheck-campaigns",additionalAttributes:{campaignsPerPage:m.toString()}}),r(e,{children:r("div",{children:r(s,{campaignsPerPage:m})})})};export{g as CampaignsPage};
1
+ import{jsx as a}from"react/jsx-runtime";import{useSearchParams as m}from"react-router-dom";import{useFeatureFlag as o}from"../../hooks/useFeatureFlag.esm.js";import{RESULTS_PER_PAGE as i}from"../../utils/filters.esm.js";import"../SoundcheckHeader/SoundcheckHeader.esm.js";import"../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useSetHeaderDefault as p}from"../SoundcheckHeader/useHeader.esm.js";import{CampaignListPageDeprecated as s}from"./CampaignListPage/CampaignListPageDeprecated.esm.js";import"./CampaignListPage/CampaignTypes.esm.js";import{CampaignListPageBUI as g}from"./CampaignListPageBUI.esm.js";const P=()=>{const[e]=m(),r=e.get("campaignsPerPage"),t=r?parseInt(r,10):i;return p(),o("backstage-ui")?a(g,{}):a(s,{campaignsPerPage:t})};export{P as CampaignsPage};
2
2
  //# sourceMappingURL=CampaignsPage.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{jsxs as a,jsx as t}from"react/jsx-runtime";import{Card as o,CardHeader as n,Text as d,CardBody as i,Box as c,Flex as s}from"@backstage/ui";import"../../CheckStatusBar/CheckStatusBar.esm.js";import{CheckStatusBarBUI as p}from"../../CheckStatusBar/CheckStatusBarBUI.esm.js";import"lodash";import"../../CustomCell/CustomCell.esm.js";import{CurrentStatusCardRow as e}from"./CurrentStatusCardRow.esm.js";const m=({totals:r,children:l})=>a(o,{children:[t(n,{children:t(d,{color:"secondary",children:"Current Status"})}),a(i,{children:[t(c,{mb:"6",children:t(p,{passedPercent:r.passedPercent,failedPercent:r.failedPercent,warningPercent:r.warningPercent})}),a(s,{direction:"column",gap:"1",mb:"3",children:[t(e,{label:"passed",percent:r.passedPercent,total:r.passedTotal,overallTotal:r.total}),t(e,{label:"failed",percent:r.failedPercent,total:r.failedTotal,overallTotal:r.total}),t(e,{label:"warning",percent:r.warningPercent,total:r.warningTotal,overallTotal:r.total})]}),l]})]});export{m as CurrentStatusCard};
2
+ //# sourceMappingURL=CurrentStatusCard.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{jsxs as r,jsx as a}from"react/jsx-runtime";import{Flex as n,Box as i,Text as o}from"@backstage/ui";import{makeStyles as m}from"@material-ui/core";import"../../CheckStatusBar/CheckStatusBar.esm.js";import{CheckStatusBarBUI as p}from"../../CheckStatusBar/CheckStatusBarBUI.esm.js";import"lodash";import"../../CustomCell/CustomCell.esm.js";const h=m(()=>({checkStatusBar:{width:"var(--bui-space-6)"}})),f=({label:l,percent:t,total:c,overallTotal:s})=>{const d=h();let e;return l==="passed"?e={passedPercent:t}:l==="failed"?e={failedPercent:t}:e={warningPercent:t},r(n,{justify:"between",children:[r(n,{align:"center",children:[a(i,{className:d.checkStatusBar,children:a(p,{...e})}),a(i,{children:r(o,{variant:"body-small",children:[t,"% ",l]})})]}),a(i,{children:r(o,{variant:"body-small",children:[c," of ",s]})})]})};export{f as CurrentStatusCardRow};
2
+ //# sourceMappingURL=CurrentStatusCardRow.esm.js.map
@@ -0,0 +1,2 @@
1
+ import{jsxs as n,jsx as r}from"react/jsx-runtime";import{Card as d,CardHeader as i,Text as c,CardBody as a,CardFooter as l,Box as s,TagGroup as h,Tag as t,Icon as p}from"@backstage/ui";const m=({description:e,owner:o})=>n(d,{children:[r(i,{children:r(c,{color:"secondary",children:"Description"})}),e&&r(a,{children:e}),o&&n(l,{children:[r(s,{mb:"3",children:r(c,{color:"secondary",children:"Owner"})}),r(h,{"aria-label":"Owner",children:r(t,{icon:r(p,{name:"user"}),children:o})})]})]});export{m as DescriptionCard};
2
+ //# sourceMappingURL=DescriptionCard.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as i,jsxs as n}from"react/jsx-runtime";import{useRouteRef as b}from"@backstage/core-plugin-api";import{useEntity as P}from"@backstage/plugin-catalog-react";import{makeStyles as v,Tabs as B,IconButton as M,Menu as j,MenuItem as u,Switch as k}from"@material-ui/core";import D from"@material-ui/icons/ArrowDropDown";import L from"@material-ui/icons/Settings.js";import{useState as O,useEffect as Q}from"react";import C from"react-use/lib/useLocalStorage";import{useAllCertifications as U}from"../../hooks/certifications/useAllCertifications.esm.js";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@backstage/catalog-model";import"@spotify/backstage-plugin-soundcheck-common";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import"react-router-dom";import{usePlaylists as X}from"../../hooks/playlists/usePlaylists.esm.js";import{certificationPlaylistRouteRef as Y,certificationTrackRouteRef as q}from"../../routes.esm.js";import{CertificationTab as F}from"./CertificationTab.esm.js";import{PlaylistCertificationTab as G}from"./PlaylistCertificationTab.esm.js";import{CertificationTabsSkeleton as H}from"./skeletons/CertificationTabsSkeleton.esm.js";function J(r=[],a=[],c,l){if(c){const o=r.findIndex(s=>s.id===c);return o<0?!1:o}const e=a.findIndex(o=>o.track.id===l);return e<0?!1:e+r.length}const K=v(r=>({tabsContainer:{display:"flex",alignItems:"center"},tabs:{flex:1},settingsButton:{display:"flex",alignItems:"center",marginRight:r.spacing(1)}})),V=({playlistId:r,trackId:a,onSettingsChange:c})=>{const l=K(),[e,o]=O(null),[s,y]=C("soundcheck.certifications.showNotApplicable",!1),[m,x]=C("soundcheck.certifications.showExempt",!0),[f,I]=C("soundcheck.certifications.showDraftTracksAndCampaigns",!1);Q(()=>{c?.({showNotApplicable:!!s,showExempt:!!m})},[s,m,c]);const S=t=>{o({top:t.clientY,left:t.clientX})},w=()=>{o(null)},{entity:g}=P(),{isLoading:T,data:p}=U(g,!1,f),{isLoading:R,data:d}=X(g),z=b(Y),A=b(q);if(R||T||!a)return i(H,{});const E=J(d,p,r,a);return n("div",{className:l.tabsContainer,children:[n(B,{className:l.tabs,value:E,indicatorColor:"primary","aria-label":"Certifications",variant:"scrollable",children:[d?.length&&d.map(({id:t,name:h})=>i(G,{id:t,name:h,selected:t===a,href:z({playlistId:t})},t)),p&&p.filter(({track:{type:t}})=>t!=="playlist").map(({track:{id:t,name:h,badge:N}})=>i(F,{id:t,name:h,badge:N,selected:t===a,href:A({trackId:t})},t))]}),n(M,{className:l.settingsButton,onClick:S,size:"small",children:[i(L,{fontSize:"small"}),i(D,{fontSize:"small"})]}),n(j,{open:!!e,onClose:w,anchorReference:"anchorPosition",anchorPosition:e?{top:e.top,left:e.left}:void 0,transformOrigin:{vertical:"top",horizontal:"right"},children:[n(u,{onClick:()=>{y(!s)},dense:!0,children:[i(k,{size:"small",checked:s}),"Show Not Applicable Checks"]}),n(u,{onClick:()=>{x(!m)},dense:!0,children:[i(k,{size:"small",checked:m}),"Show Exempt Checks"]}),n(u,{onClick:()=>{I(!f)},dense:!0,children:[i(k,{size:"small",checked:f}),"Show Draft Tracks and Campaigns"]})]})]})};export{V as CertificationTabs};
1
+ import{jsx as i,jsxs as n}from"react/jsx-runtime";import{useRouteRef as b}from"@backstage/core-plugin-api";import{useEntity as P}from"@backstage/plugin-catalog-react";import{makeStyles as v,Tabs as B,IconButton as M,Menu as j,MenuItem as u,Switch as k}from"@material-ui/core";import D from"@material-ui/icons/ArrowDropDown";import L from"@material-ui/icons/Settings.js";import{useState as O,useEffect as Q}from"react";import C from"react-use/lib/useLocalStorage";import{useAllCertifications as U}from"../../hooks/certifications/useAllCertifications.esm.js";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@backstage/catalog-model";import"@spotify/backstage-plugin-soundcheck-common";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import"react-router-dom";import{usePlaylists as X}from"../../hooks/playlists/usePlaylists.esm.js";import{certificationPlaylistRouteRef as Y,certificationTrackRouteRef as $}from"../../routes.esm.js";import{CertificationTab as q}from"./CertificationTab.esm.js";import{PlaylistCertificationTab as F}from"./PlaylistCertificationTab.esm.js";import{CertificationTabsSkeleton as G}from"./skeletons/CertificationTabsSkeleton.esm.js";function H(r=[],a=[],c,l){if(c){const o=r.findIndex(s=>s.id===c);return o<0?!1:o}const e=a.findIndex(o=>o.track.id===l);return e<0?!1:e+r.length}const J=v(r=>({tabsContainer:{display:"flex",alignItems:"center"},tabs:{flex:1},settingsButton:{display:"flex",alignItems:"center",marginRight:r.spacing(1)}})),K=({playlistId:r,trackId:a,onSettingsChange:c})=>{const l=J(),[e,o]=O(null),[s,y]=C("soundcheck.certifications.showNotApplicable",!1),[m,x]=C("soundcheck.certifications.showExempt",!0),[f,I]=C("soundcheck.certifications.showDraftTracksAndCampaigns",!1);Q(()=>{c?.({showNotApplicable:!!s,showExempt:!!m})},[s,m,c]);const S=t=>{o({top:t.clientY,left:t.clientX})},w=()=>{o(null)},{entity:g}=P(),{isLoading:T,data:p}=U(g,!1,f),{isLoading:R,data:d}=X(g),z=b(Y),A=b($);if(R||T||!a)return i(G,{});const E=H(d,p,r,a);return n("div",{className:l.tabsContainer,children:[n(B,{className:l.tabs,value:E,indicatorColor:"primary","aria-label":"Certifications",variant:"scrollable",children:[d?.length&&d.map(({id:t,name:h})=>i(F,{id:t,name:h,selected:t===a,href:z({playlistId:t})},t)),p&&p.filter(({track:{type:t}})=>t!=="playlist").map(({track:{id:t,name:h,badge:N}})=>i(q,{id:t,name:h,badge:N,selected:t===a,href:A({trackId:t})},t))]}),n(M,{className:l.settingsButton,onClick:S,size:"small",children:[i(L,{fontSize:"small"}),i(D,{fontSize:"small"})]}),n(j,{open:!!e,onClose:w,anchorReference:"anchorPosition",anchorPosition:e?{top:e.top,left:e.left}:void 0,transformOrigin:{vertical:"top",horizontal:"right"},children:[n(u,{onClick:()=>{y(!s)},dense:!0,children:[i(k,{size:"small",checked:s}),"Show Not Applicable Checks"]}),n(u,{onClick:()=>{x(!m)},dense:!0,children:[i(k,{size:"small",checked:m}),"Show Exempt Checks"]}),n(u,{onClick:()=>{I(!f)},dense:!0,children:[i(k,{size:"small",checked:f}),"Show Draft Tracks and Campaigns"]})]})]})};export{K as CertificationTabs};
2
2
  //# sourceMappingURL=CertificationTabs.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as r,jsxs as d}from"react/jsx-runtime";import{stringifyEntityRef as k}from"@backstage/catalog-model";import{useEntity as I}from"@backstage/plugin-catalog-react";import{makeStyles as C,Paper as x,Divider as E}from"@material-ui/core";import{useState as N,useCallback as P}from"react";import{useParams as A}from"react-router-dom";import{useAllCertifications as R}from"../../hooks/certifications/useAllCertifications.esm.js";import"@backstage/core-plugin-api";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{usePlaylists as S}from"../../hooks/playlists/usePlaylists.esm.js";import{AlertPanel as n}from"../AlertPanel/AlertPanel.esm.js";import{CertificationSidebar as D}from"../CertificationSidebar/CertificationSidebar.esm.js";import"../CertificationSidebar/CertificationSummary.esm.js";import"@material-ui/lab";import"../CertificationSidebar/Check.esm.js";import"../CertificationSidebar/LevelSummary.esm.js";import{isDarkTheme as T}from"../Charts/chartUtils.esm.js";import{CheckDetails as $}from"../CheckDetails/CheckDetails.esm.js";import"../CheckDryRun/CheckDryRun.esm.js";import"../SoundcheckDialog/SoundcheckDialog.esm.js";import"../CheckDryRun/CheckDryRunDetails.esm.js";import{CheckDryRunProvider as j}from"../CheckDryRun/CheckDryRunContext.esm.js";import"../CheckForm/utils/checkFormUtils.esm.js";import{NoCertifications as F}from"../EmptyState/EmptyState.esm.js";import{LevelUpParty as L}from"../LevelUpParty/LevelUpParty.esm.js";import{RefetchingIndicator as U}from"../RefetchingIndicator/RefetchingIndicator.esm.js";import{CertificationTabs as q}from"./CertificationTabs.esm.js";import{PlaylistComponent as z}from"./Playlist/PlaylistComponent.esm.js";const c=C(i=>({paper:{overflow:"hidden",position:"relative",border:T(i)?`1px solid ${i.palette.divider}`:void 0},view:{display:"grid",gridTemplateColumns:"1fr 2fr"},sidebar:{borderRight:`1px solid ${i.palette.divider}`}})),B=()=>{const{playlistId:i,trackId:t,checkId:s}=A(),p=c(),{entity:o}=I(),{isError:f,isFetched:h,data:y}=R(o),{isError:v,data:u}=S(o),[a,l]=N({showNotApplicable:!1,showExempt:!1}),w=P(({showNotApplicable:m,showExempt:b})=>{l({showNotApplicable:m,showExempt:b})},[l]);if(f||v)return r(n,{severity:"error",title:"Error loading certifications"});const e=i&&u?.find(m=>m.id===i);if(i&&!e)return r(n,{severity:"error",title:"Playlist ${playlistId} not found."});if(h&&!y?.length)return r(F,{});const g=o?k(o):void 0;return r(j,{children:d(x,{className:p.paper,children:[r(U,{}),r(q,{playlistId:i,trackId:t,onSettingsChange:w}),r(E,{}),e&&r(z,{playlist:e,entityRef:g}),!e&&t&&d("div",{"data-testid":"soundcheck-certification-view",className:p.view,children:[r("div",{className:p.sidebar,children:r(D,{trackId:t,checkId:s,showNotApplicable:a.showNotApplicable,showExempt:a.showExempt})}),r($,{programId:t,checkId:s}),r(L,{programId:t})]})]})})};export{B as CertificationsPage,c as useStyles};
1
+ import{jsx as r,jsxs as d}from"react/jsx-runtime";import{stringifyEntityRef as I}from"@backstage/catalog-model";import{useEntity as C}from"@backstage/plugin-catalog-react";import{makeStyles as g,Paper as x,Divider as E}from"@material-ui/core";import{useState as N,useCallback as P}from"react";import{useParams as A}from"react-router-dom";import{useAllCertifications as R}from"../../hooks/certifications/useAllCertifications.esm.js";import"@backstage/core-plugin-api";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{usePlaylists as S}from"../../hooks/playlists/usePlaylists.esm.js";import{AlertPanel as c}from"../AlertPanel/AlertPanel.esm.js";import{CertificationSidebar as D}from"../CertificationSidebar/CertificationSidebar.esm.js";import"../CertificationSidebar/CertificationSummary.esm.js";import"@material-ui/lab";import"../CertificationSidebar/Check.esm.js";import"../CertificationSidebar/LevelSummary.esm.js";import{isDarkTheme as T}from"../Charts/chartUtils.esm.js";import{CheckDetails as $}from"../CheckDetails/CheckDetails.esm.js";import"../CheckDryRun/CheckDryRun.esm.js";import"../SoundcheckDialog/SoundcheckDialog.esm.js";import"../CheckDryRun/CheckDryRunDetails.esm.js";import{CheckDryRunProvider as j}from"../CheckDryRun/CheckDryRunContext.esm.js";import"../CheckForm/utils/checkFormUtils.esm.js";import{NoCertifications as F}from"../EmptyState/EmptyState.esm.js";import"../EmptyState/EmptyStateBUI.esm.js";import"@backstage/plugin-permission-react";import"@backstage/ui";import"../../routes.esm.js";import{LevelUpParty as L}from"../LevelUpParty/LevelUpParty.esm.js";import{RefetchingIndicator as U}from"../RefetchingIndicator/RefetchingIndicator.esm.js";import{CertificationTabs as q}from"./CertificationTabs.esm.js";import{PlaylistComponent as z}from"./Playlist/PlaylistComponent.esm.js";const n=g(i=>({paper:{overflow:"hidden",position:"relative",border:T(i)?`1px solid ${i.palette.divider}`:void 0},view:{display:"grid",gridTemplateColumns:"1fr 2fr"},sidebar:{borderRight:`1px solid ${i.palette.divider}`}})),B=()=>{const{playlistId:i,trackId:t,checkId:s}=A(),p=n(),{entity:o}=C(),{isError:f,isFetched:h,data:y}=R(o),{isError:v,data:u}=S(o),[a,l]=N({showNotApplicable:!1,showExempt:!1}),k=P(({showNotApplicable:m,showExempt:b})=>{l({showNotApplicable:m,showExempt:b})},[l]);if(f||v)return r(c,{severity:"error",title:"Error loading certifications"});const e=i&&u?.find(m=>m.id===i);if(i&&!e)return r(c,{severity:"error",title:"Playlist ${playlistId} not found."});if(h&&!y?.length)return r(F,{});const w=o?I(o):void 0;return r(j,{children:d(x,{className:p.paper,children:[r(U,{}),r(q,{playlistId:i,trackId:t,onSettingsChange:k}),r(E,{}),e&&r(z,{playlist:e,entityRef:w}),!e&&t&&d("div",{"data-testid":"soundcheck-certification-view",className:p.view,children:[r("div",{className:p.sidebar,children:r(D,{trackId:t,checkId:s,showNotApplicable:a.showNotApplicable,showExempt:a.showExempt})}),r($,{trackId:t,checkId:s}),r(L,{trackId:t})]})]})})};export{B as CertificationsPage,n as useStyles};
2
2
  //# sourceMappingURL=CertificationsPage.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as r,jsxs as d}from"react/jsx-runtime";import{makeStyles as s}from"@material-ui/core";import{useParams as m}from"react-router-dom";import{CertificationAccordion as n}from"../../CertificationAccordion/CertificationAccordion.esm.js";import{CheckDetails as c}from"../../CheckDetails/CheckDetails.esm.js";import{PlaylistCertificationProvider as p}from"./PlaylistContext.esm.js";import{PlaylistSummary as g}from"./PlaylistSummary.esm.js";const f=s(i=>({root:{margin:0,display:"grid",gridTemplateColumns:"1fr",backgroundColor:i.palette.background.default},header:{backgroundColor:i.palette.background.paper,borderBottom:`1px solid ${i.palette.divider}`},section:{backgroundColor:i.palette.background.paper,border:`1px solid ${i.palette.divider}`,padding:0,marginTop:i.spacing(1),marginBottom:i.spacing(1),marginLeft:0,marginRight:i.spacing(1)},twoColumns:{display:"grid",gridTemplateColumns:"1fr 2fr"},sidebar:{display:"grid",gridTemplateColumns:"1fr",margin:i.spacing(1)}})),u=({playlist:i,entityRef:a})=>{const e=f(),{trackId:l,checkId:o}=m();return r("div",{className:e.root,children:d(p,{entityRef:a,children:[r("div",{className:e.header,children:r(g,{playlist:i,entityRef:a})}),d("div",{className:e.twoColumns,children:[r("div",{className:e.sidebar,children:i.trackIds.map(t=>r(n,{playlistId:i.id,trackId:t,checkId:o},t))}),r("div",{className:e.section,children:r(c,{programId:l,checkId:o})})]})]})})};export{u as PlaylistComponent};
1
+ import{jsx as a,jsxs as d}from"react/jsx-runtime";import{makeStyles as s}from"@material-ui/core";import{useParams as n}from"react-router-dom";import{CertificationAccordion as c}from"../../CertificationAccordion/CertificationAccordion.esm.js";import{CheckDetails as m}from"../../CheckDetails/CheckDetails.esm.js";import{PlaylistCertificationProvider as p}from"./PlaylistContext.esm.js";import{PlaylistSummary as g}from"./PlaylistSummary.esm.js";const f=s(r=>({root:{margin:0,display:"grid",gridTemplateColumns:"1fr",backgroundColor:r.palette.background.default},header:{backgroundColor:r.palette.background.paper,borderBottom:`1px solid ${r.palette.divider}`},section:{backgroundColor:r.palette.background.paper,border:`1px solid ${r.palette.divider}`,padding:0,marginTop:r.spacing(1),marginBottom:r.spacing(1),marginLeft:0,marginRight:r.spacing(1)},twoColumns:{display:"grid",gridTemplateColumns:"1fr 2fr"},sidebar:{display:"grid",gridTemplateColumns:"1fr",margin:r.spacing(1)}})),k=({playlist:r,entityRef:t})=>{const e=f(),{trackId:l,checkId:i}=n();return a("div",{className:e.root,children:d(p,{entityRef:t,children:[a("div",{className:e.header,children:a(g,{playlist:r,entityRef:t})}),d("div",{className:e.twoColumns,children:[a("div",{className:e.sidebar,children:r.trackIds.map(o=>a(c,{playlistId:r.id,trackId:o,checkId:i},o))}),a("div",{className:e.section,children:a(m,{trackId:l,checkId:i})})]})]})})};export{k as PlaylistComponent};
2
2
  //# sourceMappingURL=PlaylistComponent.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as f,Fragment as l,jsx as r}from"react/jsx-runtime";import{useEffect as s}from"react";import{v4 as u}from"uuid";import"../../contexts/TrackFormContext.esm.js";import{CheckFormProvider as h,useCheckFormContext as g}from"../../contexts/CheckFormContext.esm.js";import"../../contexts/CampaignFormContext.esm.js";import"../../contexts/UserProvider.esm.js";import"@backstage/catalog-model";import"@backstage/core-plugin-api";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{useNavigateBack as k}from"../../hooks/useNavigateBack.esm.js";import{useCheckTemplates as C}from"../../hooks/checks/useCheckTemplates.esm.js";import{useCreateCheck as y}from"../../hooks/checks/useCreateCheck.esm.js";import{useSearchParam as I}from"../../hooks/useSearchParam.esm.js";import{checksPageRouteRef as L}from"../../routes.esm.js";import{CheckForm as F}from"../CheckForm/CheckForm.esm.js";import"../CheckForm/Steps/CheckDetailsStep.esm.js";import"../CheckForm/Steps/CheckRulesStep.esm.js";import{LoadingIndicator as P}from"../LoadingIndicator/LoadingIndicator.esm.js";import{PageWarningMessage as v}from"../PageWarningMessage/PageWarningMessage.esm.js";import"../SoundcheckHeader/SoundcheckHeader.esm.js";import"../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as x}from"../SoundcheckHeader/useHeader.esm.js";const S=({template:t})=>{const{setIsLoading:e,selectedItem:m,setSelectedItem:o}=g(),{mutateAsync:i,isLoading:a}=y();s(()=>{o(t?{...t,id:u()}:null)},[t,o]),s(()=>{e(a)},[e,a]);const[c,n]=k(L),p=async d=>{await i(d,{onSuccess:n})};return x({title:"Create a Check",description:"Identify if your software meets organizational standards by setting up a check.",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/checks"}),t&&!m?null:r(F,{onSave:p,onClose:c})},w=()=>{const[[t]]=I("template"),{isLoading:e,data:m}=C(),o=t&&m?m.find(i=>i.id===t)??null:null;return f(l,{children:[r(v,{entityName:"check template",entityId:t,showNotFound:!!t&&!e&&!o}),e&&r(P,{}),r(h,{children:!e&&(!t||o)&&r(S,{template:o})})]})};export{w as CheckCreatePage};
1
+ import{jsxs as f,Fragment as l,jsx as r}from"react/jsx-runtime";import{useEffect as s}from"react";import{v4 as u}from"uuid";import"../../contexts/TrackFormContext.esm.js";import{CheckFormProvider as h,useCheckFormContext as g}from"../../contexts/CheckFormContext.esm.js";import"../../contexts/CampaignFormContext.esm.js";import"../../contexts/UserProvider.esm.js";import"@backstage/catalog-model";import"@backstage/core-plugin-api";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{useNavigateBack as k}from"../../hooks/useNavigateBack.esm.js";import"react-router-dom";import{useCheckTemplates as C}from"../../hooks/checks/useCheckTemplates.esm.js";import{useCreateCheck as y}from"../../hooks/checks/useCreateCheck.esm.js";import{useSearchParam as I}from"../../hooks/useSearchParam.esm.js";import{checksPageRouteRef as L}from"../../routes.esm.js";import{CheckForm as F}from"../CheckForm/CheckForm.esm.js";import"../CheckForm/Steps/CheckDetailsStep.esm.js";import"../CheckForm/Steps/CheckRulesStep.esm.js";import{LoadingIndicator as P}from"../LoadingIndicator/LoadingIndicator.esm.js";import{PageWarningMessage as v}from"../PageWarningMessage/PageWarningMessage.esm.js";import"../SoundcheckHeader/SoundcheckHeader.esm.js";import"../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as x}from"../SoundcheckHeader/useHeader.esm.js";const S=({template:t})=>{const{setIsLoading:o,selectedItem:m,setSelectedItem:e}=g(),{mutateAsync:i,isLoading:a}=y();s(()=>{e(t?{...t,id:u()}:null)},[t,e]),s(()=>{o(a)},[o,a]);const[c,p]=k(L),n=async d=>{await i(d,{onSuccess:p})};return x({title:"Create a Check",description:"Identify if your software meets organizational standards by setting up a check.",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/checks"}),t&&!m?null:r(F,{onSave:n,onClose:c})},w=()=>{const[[t]]=I("template"),{isLoading:o,data:m}=C(),e=t&&m?m.find(i=>i.id===t)??null:null;return f(l,{children:[r(v,{entityName:"check template",entityId:t,showNotFound:!!t&&!o&&!e}),o&&r(P,{}),r(h,{children:!o&&(!t||e)&&r(S,{template:e})})]})};export{w as CheckCreatePage};
2
2
  //# sourceMappingURL=CheckCreatePage.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as t,jsxs as o,Fragment as M}from"react/jsx-runtime";import{stringifyEntityRef as h}from"@backstage/catalog-model";import{useEntity as O}from"@backstage/plugin-catalog-react";import{makeStyles as F,Box as p,Typography as m,Button as u,Tooltip as $}from"@material-ui/core";import{Alert as C}from"@material-ui/lab";import{useState as v}from"react";import{CheckerType as W,ResultState as l}from"../../graphql/generated/index.esm.js";import"@backstage/core-plugin-api";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@spotify/backstage-plugin-soundcheck-common";import{useCheck as G}from"../../hooks/checks/useCheck.esm.js";import{useCheckDetails as J}from"../../hooks/checks/useCheckDetails.esm.js";import"../../hooks/useSoundcheckAlert.esm.js";import{useGetExemption as q}from"../../hooks/exemptions/useGetExemption.esm.js";import"../../hooks/useConfirmationModal.esm.js";import"react-router-dom";import{useSetManualResult as H}from"../../hooks/checks/useSetManualResult.esm.js";import{AlertPanel as K}from"../AlertPanel/AlertPanel.esm.js";import{CheckResultInputPopup as Q}from"../CertificationSidebar/CheckResultInputPopup.esm.js";import{ExemptionJustificationDialog as U}from"../CertificationSidebar/ExemptionJustificationDialog.esm.js";import{RelativeTime as V}from"../RelativeTime/RelativeTime.esm.js";import{SoundcheckMarkdownContent as X}from"../SoundcheckMarkdownContent/SoundcheckMarkdownContent.esm.js";import"@backstage/core-components";import"react-markdown";import"rehype-raw";import"remark-gfm";import{ResultStateBox as Y}from"./ResultStateBox.esm.js";import{CheckDetailsSkeleton as Z}from"./skeletons/CheckDetailsSkeleton.esm.js";const c=F(e=>({root:{padding:`${e.spacing(3)}px ${e.spacing(5)}px`},title:{fontWeight:"normal",fontSize:e.typography.h5.fontSize},description:{padding:`${e.spacing(3)}px 0`},subtitle:{fontWeight:"normal",fontSize:e.typography.h6.fontSize},topBar:{display:"flex",justifyContent:"space-between",marginBottom:e.spacing(2)},exemptButton:{marginLeft:e.spacing(1)},exemptAlert:{marginBottom:e.spacing(2)}})),R=({setPopupDisplayed:e})=>{const i=c();return t(u,{className:i.exemptButton,size:"small",onClick:()=>e(!0),"aria-label":"Set Check Status Button",children:"Set Check Status"})},E=({isExempt:e,setPopupDisplayed:i})=>{const r=c();return t($,{title:e?"Remove Exemption":"Set Exempt From Check",children:t(u,{className:r.exemptButton,size:"small",color:"inherit",onClick:()=>i(!0),"aria-label":"Exempt From Check",children:e?"Remove Exemption":"Add Exemption"})})},_=({programId:e,checkId:i})=>{const r=c(),{entity:a}=O(),{data:f,isLoading:B,isError:N}=J(a,e,i),[b,x]=v(!1),[D,d]=v(!1),{data:n,isLoading:T}=q(h(a),i??""),{data:y}=G(i),{mutateAsync:w}=H();if(N)return t(p,{padding:2,children:t(K,{severity:"error",title:"Error loading check details"})});if(B||!e||!i)return t(Z,{});if(!f)return null;const k=y?.type===W.Manual,{name:g,description:z,result:s,timestamp:S,details:A}=f,I=async(P,j)=>{if(!a||!i)return;const L=h(a);await w({checkId:i,entityRef:L,justification:j,state:P})};return o("div",{className:r.root,"data-testid":"check-details-view",children:[o("div",{className:r.topBar,children:[t(m,{variant:"h2",className:r.title,children:g}),o(p,{display:"flex",alignItems:"center",children:[S?t(V,{timestamp:S,description:"Last updated"}):null,k&&!n?.exemption&&s!==l.NotReported&&t(R,{setPopupDisplayed:d}),!T&&s!==l.NotApplicable&&t(E,{isExempt:!!n?.exemption,setPopupDisplayed:x})]})]}),t(U,{entityRef:h(a),checkId:i,isOpen:b,setIsOpen:x}),t(Q,{isOpen:D,setIsOpen:d,setCallback:I}),!n?.exemption&&s===l.Exempt&&t(C,{className:r.exemptAlert,severity:"warning",variant:"outlined",children:"This check's exemption for this entity was recently removed. The recent exemption state will clear once the check has been run."}),!!n?.exemption&&t(p,{marginBottom:2,children:t(C,{className:r.exemptAlert,severity:"warning",variant:"outlined",children:"This entity has been exempted from this check."})}),k&&!n?.exemption&&s===l.NotReported?o(p,{children:[t(m,{children:"This check is manual and must have its state set by a user."}),t(p,{marginTop:1,children:t(u,{variant:"contained",color:"primary",onClick:()=>d(!0),"aria-label":"Set Check Status",size:"small",children:"Set Check Status"})})]}):o(M,{children:[t(m,{className:r.subtitle,children:"Most Recent Result:"}),t(Y,{name:g,state:s,details:A,templateRef:y?.templateRef??void 0})]}),o("div",{className:r.description,"data-testid":"soundcheck-check-details-description",children:[t(m,{variant:"h3",className:r.subtitle,children:"Description"}),t(X,{content:z})]})]})};export{_ as CheckDetails,E as ExemptDialogButton,R as SetCheckStatusButton,c as useStyles};
1
+ import{jsx as t,jsxs as o,Fragment as M}from"react/jsx-runtime";import{stringifyEntityRef as h}from"@backstage/catalog-model";import{useEntity as O}from"@backstage/plugin-catalog-react";import{makeStyles as F,Box as p,Typography as m,Button as u,Tooltip as $}from"@material-ui/core";import{Alert as C}from"@material-ui/lab";import{useState as v}from"react";import{CheckerType as W,ResultState as l}from"../../graphql/generated/index.esm.js";import"@backstage/core-plugin-api";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@spotify/backstage-plugin-soundcheck-common";import{useCheck as G}from"../../hooks/checks/useCheck.esm.js";import{useCheckDetails as J}from"../../hooks/checks/useCheckDetails.esm.js";import"../../hooks/useSoundcheckAlert.esm.js";import{useGetExemption as q}from"../../hooks/exemptions/useGetExemption.esm.js";import"../../hooks/useConfirmationModal.esm.js";import"react-router-dom";import{useSetManualResult as H}from"../../hooks/checks/useSetManualResult.esm.js";import{AlertPanel as K}from"../AlertPanel/AlertPanel.esm.js";import{CheckResultInputPopup as Q}from"../CertificationSidebar/CheckResultInputPopup.esm.js";import{ExemptionJustificationDialog as U}from"../CertificationSidebar/ExemptionJustificationDialog.esm.js";import{RelativeTime as V}from"../RelativeTime/RelativeTime.esm.js";import{SoundcheckMarkdownContent as X}from"../SoundcheckMarkdownContent/SoundcheckMarkdownContent.esm.js";import"@backstage/core-components";import"react-markdown";import"rehype-raw";import"remark-gfm";import{ResultStateBox as Y}from"./ResultStateBox.esm.js";import{CheckDetailsSkeleton as Z}from"./skeletons/CheckDetailsSkeleton.esm.js";const c=F(e=>({root:{padding:`${e.spacing(3)}px ${e.spacing(5)}px`},title:{fontWeight:"normal",fontSize:e.typography.h5.fontSize},description:{padding:`${e.spacing(3)}px 0`},subtitle:{fontWeight:"normal",fontSize:e.typography.h6.fontSize},topBar:{display:"flex",justifyContent:"space-between",marginBottom:e.spacing(2)},exemptButton:{marginLeft:e.spacing(1)},exemptAlert:{marginBottom:e.spacing(2)}})),R=({setPopupDisplayed:e})=>{const i=c();return t(u,{className:i.exemptButton,size:"small",onClick:()=>e(!0),"aria-label":"Set Check Status Button",children:"Set Check Status"})},E=({isExempt:e,setPopupDisplayed:i})=>{const r=c();return t($,{title:e?"Remove Exemption":"Set Exempt From Check",children:t(u,{className:r.exemptButton,size:"small",color:"inherit",onClick:()=>i(!0),"aria-label":"Exempt From Check",children:e?"Remove Exemption":"Add Exemption"})})},_=({trackId:e,checkId:i})=>{const r=c(),{entity:a}=O(),{data:f,isLoading:B,isError:N}=J(a,e,i),[b,x]=v(!1),[D,d]=v(!1),{data:n,isLoading:T}=q(h(a),i??""),{data:k}=G(i),{mutateAsync:w}=H();if(N)return t(p,{padding:2,children:t(K,{severity:"error",title:"Error loading check details"})});if(B||!e||!i)return t(Z,{});if(!f)return null;const y=k?.type===W.Manual,{name:g,description:z,result:s,timestamp:S,details:A}=f,I=async(P,j)=>{if(!a||!i)return;const L=h(a);await w({checkId:i,entityRef:L,justification:j,state:P})};return o("div",{className:r.root,"data-testid":"check-details-view",children:[o("div",{className:r.topBar,children:[t(m,{variant:"h2",className:r.title,children:g}),o(p,{display:"flex",alignItems:"center",children:[S?t(V,{timestamp:S,description:"Last updated"}):null,y&&!n?.exemption&&s!==l.NotReported&&t(R,{setPopupDisplayed:d}),!T&&s!==l.NotApplicable&&t(E,{isExempt:!!n?.exemption,setPopupDisplayed:x})]})]}),t(U,{entityRef:h(a),checkId:i,isOpen:b,setIsOpen:x}),t(Q,{isOpen:D,setIsOpen:d,setCallback:I}),!n?.exemption&&s===l.Exempt&&t(C,{className:r.exemptAlert,severity:"warning",variant:"outlined",children:"This check's exemption for this entity was recently removed. The recent exemption state will clear once the check has been run."}),!!n?.exemption&&t(p,{marginBottom:2,children:t(C,{className:r.exemptAlert,severity:"warning",variant:"outlined",children:"This entity has been exempted from this check."})}),y&&!n?.exemption&&s===l.NotReported?o(p,{children:[t(m,{children:"This check is manual and must have its state set by a user."}),t(p,{marginTop:1,children:t(u,{variant:"contained",color:"primary",onClick:()=>d(!0),"aria-label":"Set Check Status",size:"small",children:"Set Check Status"})})]}):o(M,{children:[t(m,{className:r.subtitle,children:"Most Recent Result:"}),t(Y,{name:g,state:s,details:A,templateRef:k?.templateRef??void 0})]}),o("div",{className:r.description,"data-testid":"soundcheck-check-details-description",children:[t(m,{variant:"h3",className:r.subtitle,children:"Description"}),t(X,{content:z})]})]})};export{_ as CheckDetails,E as ExemptDialogButton,R as SetCheckStatusButton,c as useStyles};
2
2
  //# sourceMappingURL=CheckDetails.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as i,jsx as e}from"react/jsx-runtime";import{makeStyles as l}from"@material-ui/core";import{useMemo as m}from"react";import{useGetPathResolvers as n}from"../../../hooks/useGetPathResolvers.esm.js";import{FormControlledAutocomplete as c}from"../../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import"@material-ui/icons/CheckBox";import"@material-ui/icons/CheckBoxOutlineBlank";import"@material-ui/lab";import"react-hook-form";import"../../ListboxVirtualized/ListboxVirtualized.esm.js";import"../../FormControlledAutocomplete/ControlledAutocomplete.esm.js";import{FormFieldLabel as d}from"../../FormFieldLabel/FormFieldLabel.esm.js";const h=l(t=>({wrapper:{marginBottom:t.spacing(2)}})),u=({control:t})=>{const p=h(),{data:r,isLoading:s}=n(),a=m(()=>r?.map(o=>o.id),[r]);return i("div",{className:p.wrapper,children:[e(d,{title:"Path resolver (Optional)",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/checks#path-resolvers"}),e("div",{children:e(c,{control:t,name:"rulesStep.pathResolver",disabled:s,options:a??[],freeSolo:!1,disableClearable:!0,width:250,getOptionLabel:o=>o==="jsonpath"?"jsonpath (default)":o,getOptionValue:o=>o&&o==="jsonpath (default)"?"jsonpath":o??"",placeholder:"path resolver"})})]})};export{u as CheckPathResolverInput};
1
+ import{jsxs as i,jsx as r}from"react/jsx-runtime";import{makeStyles as n}from"@material-ui/core";import{useMemo as m}from"react";import{useGetPathResolvers as c}from"../../../hooks/useGetPathResolvers.esm.js";import{FormControlledAutocomplete as d}from"../../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import"@material-ui/icons/CheckBox";import"@material-ui/icons/CheckBoxOutlineBlank";import"@material-ui/lab";import"react-hook-form";import"../../ListboxVirtualized/ListboxVirtualized.esm.js";import"../../FormControlledAutocomplete/ControlledAutocomplete.esm.js";import{FormFieldLabel as h}from"../../FormFieldLabel/FormFieldLabel.esm.js";const u=n(e=>({wrapper:{marginBottom:e.spacing(2)}})),f=({control:e})=>{const p=u(),{data:l,isLoading:a}=c(),s=m(()=>l?.map(({id:o})=>({label:o,value:o})),[l]);return i("div",{className:p.wrapper,children:[r(h,{title:"Path resolver (Optional)",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/checks#path-resolvers"}),r("div",{children:r(d,{control:e,name:"rulesStep.pathResolver",disabled:a,options:s??[],freeSolo:!1,disableClearable:!0,width:250,getOptionLabel:o=>{let t="";return typeof o=="string"?t=o:t=o.label??"",t==="jsonpath"?"jsonpath (default)":t},getOptionValue:o=>{let t="";return typeof o=="string"?t=o:t=o?.value??"",t==="jsonpath (default)"?"jsonpath":t},placeholder:"path resolver"})})]})};export{f as CheckPathResolverInput};
2
2
  //# sourceMappingURL=CheckPathResolverInput.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as n,jsx as a,Fragment as D}from"react/jsx-runtime";import{Box as r,FormLabel as c,TextField as T,IconButton as A}from"@material-ui/core";import k from"@material-ui/icons/Close";import E from"@material-ui/icons/Delete";import G from"@material-ui/icons/List";import{asArray as M}from"@spotify/backstage-plugin-soundcheck-common";import{useMemo as R,useCallback as b}from"react";import{useFormContext as W,Controller as z}from"react-hook-form";import{useOperators as H}from"../../../../../hooks/operators/useOperators.esm.js";import{FactExplorerDialogButton as F}from"../../../../FactExplorer/FactExplorerDialog.esm.js";import"../../../../FactExplorer/FactExplorerContext.esm.js";import{FormControlledAutocomplete as v}from"../../../../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import{FactValueDisplay as q}from"./FactValueDisplay.esm.js";import{useRuleConditionStyles as J}from"./styles.esm.js";import{useRuleOptions as K}from"./useRuleOptions.esm.js";import{ValueListInputDialogButton as O}from"./ValueListInput.esm.js";const Q=({name:l,handleDelete:w,disabled:d,disableDelete:y})=>{const t=J(),{control:p,setValue:s,watch:m,clearErrors:h}=W(),{data:N,isLoading:g}=H(),S=m("rulesStep.pathResolver")==="jsonpath",f=R(()=>N?.map(e=>({value:e.name,label:e.title})).sort((e,o)=>e.label.localeCompare(o.label))??[],[N]),j=R(()=>f.map(e=>e.value),[f]),{pathOptions:B,factRefOptions:u,isLoading:L}=K(l,p),I=R(()=>u?.map(e=>e.value)??[],[u]),P=b(({factRef:e,path:o})=>{s(`${l}.factRef`,e),s(`${l}.path`,o),h()},[h,l,s]),V=b(({factRef:e,path:o})=>{s(`${l}.value`,{factRef:e,path:o}),h()},[h,l,s]),C=b(e=>{s(`${l}.value`,e.length>0?e:""),h()},[h,l,s]),i=m(`${l}.value`),$=b(()=>{s(`${l}.value`,"")},[l,s]);return n(r,{className:t.container,children:[a(r,{className:t.connector}),n(r,{paddingTop:2,paddingLeft:2,paddingRight:2,paddingBottom:2,width:"100%",className:t.innerContainer,children:[n(r,{className:t.inputsContainer,children:[u&&n(r,{children:[a(c,{className:t.formLabel,children:"Fact"}),a(v,{name:`${l}.factRef`,control:p,placeholder:"Fact",options:I,getOptionLabel:e=>u?.find(o=>e===o.value)?.label??e,getOptionValue:e=>u?.find(o=>e===o.label)?.value??e??"",disabled:d||L,width:428})]}),n(r,{flexGrow:1,children:[a(c,{className:t.formLabel,children:"Path"}),a(v,{name:`${l}.path`,placeholder:"Path",control:p,disabled:d||L,options:S?B:[],fullWidth:!0})]}),n(r,{children:[a(c,{className:t.formLabel,style:{visibility:"hidden"},children:"Explore"}),a(r,{width:150,children:a(F,{factRef:m(`${l}.factRef`),path:m(`${l}.path`),onSave:P,pathResolver:m("rulesStep.pathResolver"),className:t.exploreButton,hideIcon:!0})})]})]}),n(r,{className:t.inputsContainer,children:[f&&n(D,{children:[n(r,{children:[a(c,{className:t.formLabel,children:"Prefix (Optional)"}),a(v,{name:`${l}.operatorPrefix`,control:p,placeholder:"Prefix",options:["all","any","none"],disabled:g||d,width:120})]}),n(r,{children:[a(c,{className:t.formLabel,children:"Operator"}),a(v,{name:`${l}.operator`,control:p,placeholder:"Operator",options:j,disabled:g||d,getOptionLabel:e=>(o=>f?.find(x=>o===x.value)?.label??o??"")(e),getOptionValue:e=>(o=>f?.find(x=>o===x.label)?.value??o??"")(e),width:300})]})]}),n(r,{flexGrow:1,children:[a(c,{className:t.formLabel,children:"Value"}),typeof i=="object"&&!Array.isArray(i)?a(q,{value:i,handleClear:$}):a(z,{name:`${l}.value`,control:p,defaultValue:"",render:({field:e,fieldState:o})=>a(T,{...e,variant:"outlined",placeholder:"Enter a value",FormHelperTextProps:{className:t.helperText},error:o.invalid,helperText:o.error?o.error.message:null,margin:"dense",disabled:d||typeof i=="object",className:t.noMargin,fullWidth:!0,InputProps:{endAdornment:a(A,{onClick:$,size:"small",children:a(k,{})}),startAdornment:Array.isArray(i)?a(O,{values:i,onSave:C,iconButton:a(G,{})}):null}})})]}),n(r,{children:[a(c,{className:t.formLabel,style:{visibility:"hidden"},children:"Alternative Input"}),n(r,{display:"flex",width:150,children:[a(F,{factRef:typeof i=="object"?i?.factRef:void 0,path:typeof i=="object"?i?.path:void 0,onSave:V,pathResolver:m("rulesStep.pathResolver"),className:t.exploreButton,text:"Fact",hideIcon:!0}),a(O,{values:typeof i=="object"&&!Array.isArray(i)?void 0:M(i),onSave:C})]})]})]})]}),a(A,{onClick:w,className:t.deleteButton,"data-testid":`${l}-delete-button`,disabled:d||y,hidden:d||y,style:{visibility:d||y?"hidden":void 0},children:a(E,{className:t.deleteIcon})})]})};export{Q as RuleConditionInput};
1
+ import{jsxs as n,jsx as a,Fragment as G}from"react/jsx-runtime";import{Box as o,FormLabel as p,TextField as H,IconButton as S}from"@material-ui/core";import M from"@material-ui/icons/Close";import W from"@material-ui/icons/Delete";import z from"@material-ui/icons/List";import{asArray as q}from"@spotify/backstage-plugin-soundcheck-common";import{useMemo as u,useCallback as b}from"react";import{useFormContext as J,Controller as K}from"react-hook-form";import{useOperators as Q}from"../../../../../hooks/operators/useOperators.esm.js";import{FactExplorerDialogButton as V}from"../../../../FactExplorer/FactExplorerDialog.esm.js";import"../../../../FactExplorer/FactExplorerContext.esm.js";import{FormControlledAutocomplete as v}from"../../../../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import{FactValueDisplay as U}from"./FactValueDisplay.esm.js";import{useRuleConditionStyles as X}from"./styles.esm.js";import{useRuleOptions as Y}from"./useRuleOptions.esm.js";import{ValueListInputDialogButton as j}from"./ValueListInput.esm.js";const Z=({name:l,handleDelete:w,disabled:d,disableDelete:y})=>{const t=X(),{control:c,setValue:s,watch:m,clearErrors:f}=J(),{data:L,isLoading:O}=Q(),B=m("rulesStep.pathResolver")==="jsonpath",h=u(()=>L?.map(e=>({value:e.name,label:e.title})).sort((e,r)=>e.label.localeCompare(r.label))??[],[L]),I=u(()=>h.map(({value:e})=>({label:e,value:e})),[h]),{pathOptions:$,factRefOptions:g,isLoading:C}=Y(l,c),P=u(()=>g?.map(({value:e})=>({label:e,value:e}))??[],[g]),T=u(()=>$?.map(e=>({label:e,value:e}))??[],[$]),D=["all","any","none"].map(e=>({label:e,value:e})),E=b(({factRef:e,path:r})=>{s(`${l}.factRef`,e),s(`${l}.path`,r),f()},[f,l,s]),k=b(({factRef:e,path:r})=>{s(`${l}.value`,{factRef:e,path:r}),f()},[f,l,s]),F=b(e=>{s(`${l}.value`,e.length>0?e:""),f()},[f,l,s]),i=m(`${l}.value`),A=b(()=>{s(`${l}.value`,"")},[l,s]),x=e=>typeof e=="string"?e:e.label??"",R=e=>typeof e=="string"?e:e?.value??"";return n(o,{className:t.container,children:[a(o,{className:t.connector}),n(o,{paddingTop:2,paddingLeft:2,paddingRight:2,paddingBottom:2,width:"100%",className:t.innerContainer,children:[n(o,{className:t.inputsContainer,children:[g&&n(o,{children:[a(p,{className:t.formLabel,children:"Fact"}),a(v,{name:`${l}.factRef`,control:c,placeholder:"Fact",options:P,getOptionLabel:x,getOptionValue:R,disabled:d||C,width:428})]}),n(o,{flexGrow:1,children:[a(p,{className:t.formLabel,children:"Path"}),a(v,{name:`${l}.path`,placeholder:"Path",control:c,disabled:d||C,options:B?T:[],fullWidth:!0,getOptionLabel:x,getOptionValue:R})]}),n(o,{children:[a(p,{className:t.formLabel,style:{visibility:"hidden"},children:"Explore"}),a(o,{width:150,children:a(V,{factRef:m(`${l}.factRef`),path:m(`${l}.path`),onSave:E,pathResolver:m("rulesStep.pathResolver"),className:t.exploreButton,hideIcon:!0})})]})]}),n(o,{className:t.inputsContainer,children:[h&&n(G,{children:[n(o,{children:[a(p,{className:t.formLabel,children:"Prefix (Optional)"}),a(v,{name:`${l}.operatorPrefix`,control:c,placeholder:"Prefix",options:D,disabled:O||d,width:120,getOptionLabel:x,getOptionValue:R})]}),n(o,{children:[a(p,{className:t.formLabel,children:"Operator"}),a(v,{name:`${l}.operator`,control:c,placeholder:"Operator",options:I,disabled:O||d,getOptionLabel:e=>(r=>h?.find(N=>r===N.value)?.label??r??"")(typeof e=="string"?e:e.label),getOptionValue:e=>(r=>h?.find(N=>r===N.label)?.value??r??"")(typeof e=="string"?e:e?.label??""),width:300})]})]}),n(o,{flexGrow:1,children:[a(p,{className:t.formLabel,children:"Value"}),typeof i=="object"&&!Array.isArray(i)?a(U,{value:i,handleClear:A}):a(K,{name:`${l}.value`,control:c,defaultValue:"",render:({field:e,fieldState:r})=>a(H,{...e,variant:"outlined",placeholder:"Enter a value",FormHelperTextProps:{className:t.helperText},error:r.invalid,helperText:r.error?r.error.message:null,margin:"dense",disabled:d||typeof i=="object",className:t.noMargin,fullWidth:!0,InputProps:{endAdornment:a(S,{onClick:A,size:"small",children:a(M,{})}),startAdornment:Array.isArray(i)?a(j,{values:i,onSave:F,iconButton:a(z,{})}):null}})})]}),n(o,{children:[a(p,{className:t.formLabel,style:{visibility:"hidden"},children:"Alternative Input"}),n(o,{display:"flex",width:150,children:[a(V,{factRef:typeof i=="object"?i?.factRef:void 0,path:typeof i=="object"?i?.path:void 0,onSave:k,pathResolver:m("rulesStep.pathResolver"),className:t.exploreButton,text:"Fact",hideIcon:!0}),a(j,{values:typeof i=="object"&&!Array.isArray(i)?void 0:q(i),onSave:F})]})]})]})]}),a(S,{onClick:w,className:t.deleteButton,"data-testid":`${l}-delete-button`,disabled:d||y,hidden:d||y,style:{visibility:d||y?"hidden":void 0},children:a(W,{className:t.deleteIcon})})]})};export{Z as RuleConditionInput};
2
2
  //# sourceMappingURL=RuleConditionInput.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as y,jsx as i}from"react/jsx-runtime";import{parseEntityRef as h}from"@backstage/catalog-model";import{Typography as b}from"@material-ui/core";import{makeStyles as g}from"@material-ui/core/styles";import{uniqBy as x}from"lodash";import{useFormContext as E}from"react-hook-form";import"../../../../contexts/TrackFormContext.esm.js";import"../../../../contexts/CheckFormContext.esm.js";import"../../../../contexts/CampaignFormContext.esm.js";import"react";import{useLoggedInUser as w}from"../../../../contexts/UserProvider.esm.js";import{useGroupOptions as L}from"../../../../hooks/groups/useGroupOptions.esm.js";import{FormControlledAutocomplete as S}from"../../../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import"@material-ui/icons/CheckBox";import"@material-ui/icons/CheckBoxOutlineBlank";import"@material-ui/lab";import"../../../ListboxVirtualized/ListboxVirtualized.esm.js";import{useLabelOptions as C}from"../../../FormControlledAutocomplete/useLabelOptions.esm.js";import"../../../FormControlledAutocomplete/ControlledAutocomplete.esm.js";import{CHECK_FIELDS as R}from"../../utils/checkFormUtils.esm.js";const T=g(m=>({container:{display:"flex",flexDirection:"column",gap:m.spacing(1)}})),D=({control:m,disabled:a,error:n})=>{const l=T(),{options:p,isLoading:s}=L();let e=x(p.map(r=>({value:r.ref,label:r.name})),"value");const{user:c,userEntityRef:t}=w();t&&(e=[{value:t,label:c?.metadata?.name??t},...e]);const{watch:d}=E(),o=d("detailsStep.ownerEntityRef");o&&t!==o&&!e.some(r=>r.value===o)&&(e=[{value:o,label:h(o).name},...e]);const f=C(e),{owner:{name:u,selectLabel:v}}=R.details;return y("div",{className:l.container,children:[i("div",{children:i(b,{variant:"subtitle2",children:u})}),i("div",{children:i(S,{freeSolo:!1,name:"detailsStep.ownerEntityRef",control:m,placeholder:v,width:250,helperText:n?.message??void 0,disabled:a||s,...f})})]})};export{D as TeamDetailsInput};
1
+ import{jsxs as y,jsx as i}from"react/jsx-runtime";import{parseEntityRef as h}from"@backstage/catalog-model";import{Typography as b}from"@material-ui/core";import{makeStyles as g}from"@material-ui/core/styles";import{uniqBy as x}from"lodash";import{useFormContext as E}from"react-hook-form";import"../../../../contexts/TrackFormContext.esm.js";import"../../../../contexts/CheckFormContext.esm.js";import"../../../../contexts/CampaignFormContext.esm.js";import"react";import{useLoggedInUser as w}from"../../../../contexts/UserProvider.esm.js";import{useGroupOptions as L}from"../../../../hooks/groups/useGroupOptions.esm.js";import{FormControlledAutocomplete as S}from"../../../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import"@material-ui/icons/CheckBox";import"@material-ui/icons/CheckBoxOutlineBlank";import"@material-ui/lab";import"../../../ListboxVirtualized/ListboxVirtualized.esm.js";import{useLabelValueOptions as C}from"../../../FormControlledAutocomplete/useLabelValueOptions.esm.js";import"../../../FormControlledAutocomplete/ControlledAutocomplete.esm.js";import{CHECK_FIELDS as R}from"../../utils/checkFormUtils.esm.js";const T=g(m=>({container:{display:"flex",flexDirection:"column",gap:m.spacing(1)}})),D=({control:m,disabled:n,error:p})=>{const l=T(),{options:s,isLoading:d}=L();let e=x(s.map(t=>({value:t.ref,label:t.name,description:t.description})),"value");const{user:a,userEntityRef:r}=w();r&&(e=[{value:r,label:a?.metadata?.name??r,description:a?.metadata.description},...e]);const{watch:c}=E(),o=c("detailsStep.ownerEntityRef");o&&r!==o&&!e.some(t=>t.value===o)&&(e=[{value:o,label:h(o).name,description:void 0},...e]);const f=C(e),{owner:{name:u,selectLabel:v}}=R.details;return y("div",{className:l.container,children:[i("div",{children:i(b,{variant:"subtitle2",children:u})}),i("div",{children:i(S,{freeSolo:!1,name:"detailsStep.ownerEntityRef",control:m,placeholder:v,width:250,helperText:p?.message??void 0,disabled:n||d,...f})})]})};export{D as TeamDetailsInput};
2
2
  //# sourceMappingURL=TeamDetailsInput.esm.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as d}from"react/jsx-runtime";import{useEffect as i}from"react";import"../../contexts/TrackFormContext.esm.js";import{useCheckFormContext as m}from"../../contexts/CheckFormContext.esm.js";import"../../contexts/CampaignFormContext.esm.js";import"../../contexts/UserProvider.esm.js";import"@backstage/catalog-model";import"@backstage/core-plugin-api";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{useNavigateBack as u}from"../../hooks/useNavigateBack.esm.js";import{useUpdateCheck as f}from"../../hooks/checks/useUpdateCheck.esm.js";import{checksPageRouteRef as h}from"../../routes.esm.js";import{CheckForm as g}from"../CheckForm/CheckForm.esm.js";import"../CheckForm/Steps/CheckDetailsStep.esm.js";import"../CheckForm/Steps/CheckRulesStep.esm.js";import"../SoundcheckHeader/SoundcheckHeader.esm.js";import"../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as l}from"../SoundcheckHeader/useHeader.esm.js";const C=({check:t})=>{const{selectedItem:c,setSelectedItem:o}=m(),{setIsLoading:e}=m(),{mutateAsync:s,isLoading:r}=f();i(()=>{e(r)},[e,r]),i(()=>{o(t)},[t,o]);const[p,a]=u(h),n=async k=>{await s(k,{onSuccess:a})};return l({title:"Edit a Check",description:"Make changes to your check\u2019s facts, rules and other details.",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/checks"}),c&&d(g,{onClose:p,onSave:n})};export{C as CheckEditView};
1
+ import{jsx as d}from"react/jsx-runtime";import{useEffect as i}from"react";import"../../contexts/TrackFormContext.esm.js";import{useCheckFormContext as m}from"../../contexts/CheckFormContext.esm.js";import"../../contexts/CampaignFormContext.esm.js";import"../../contexts/UserProvider.esm.js";import"@backstage/catalog-model";import"@backstage/core-plugin-api";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{useNavigateBack as u}from"../../hooks/useNavigateBack.esm.js";import"react-router-dom";import{useUpdateCheck as f}from"../../hooks/checks/useUpdateCheck.esm.js";import{checksPageRouteRef as h}from"../../routes.esm.js";import{CheckForm as g}from"../CheckForm/CheckForm.esm.js";import"../CheckForm/Steps/CheckDetailsStep.esm.js";import"../CheckForm/Steps/CheckRulesStep.esm.js";import"../SoundcheckHeader/SoundcheckHeader.esm.js";import"../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as l}from"../SoundcheckHeader/useHeader.esm.js";const C=({check:t})=>{const{selectedItem:c,setSelectedItem:o}=m(),{setIsLoading:e}=m(),{mutateAsync:s,isLoading:r}=f();i(()=>{e(r)},[e,r]),i(()=>{o(t)},[t,o]);const[p,a]=u(h),n=async k=>{await s(k,{onSuccess:a})};return l({title:"Edit a Check",description:"Make changes to your check\u2019s facts, rules and other details.",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/checks"}),c&&d(g,{onClose:p,onSave:n})};export{C as CheckEditView};
2
2
  //# sourceMappingURL=CheckEditView.esm.js.map