@spotify/backstage-plugin-soundcheck 0.16.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/dist/alpha/integrations.esm.js +2 -0
- package/dist/alpha/pages.esm.js +1 -1
- package/dist/alpha/plugin.esm.js +1 -1
- package/dist/alpha.d.ts +252 -17
- package/dist/api.esm.js +1 -1
- package/dist/blueprints/IntegrationPageBlueprint.esm.js +2 -0
- package/dist/components/Badges/LevelBadge.esm.js +1 -1
- package/dist/components/CampaignForm/hooks/utils.esm.js +1 -1
- package/dist/components/CampaignInsightsPage/CampaignStatusHistoryTile.esm.js +1 -1
- package/dist/components/CertificationSidebar/ExemptionJustificationDialog.esm.js +1 -1
- package/dist/components/CertificationsPage/CertificationTab.esm.js +1 -1
- package/dist/components/CertificationsPage/CertificationTabs.esm.js +1 -1
- package/dist/components/CheckDetails/CheckResultDetails.esm.js +1 -1
- package/dist/components/CheckDetails/ResultStateBox.esm.js +1 -1
- package/dist/components/CheckDryRun/CheckDryRunDetails.esm.js +1 -1
- package/dist/components/CheckForm/FormFields/RuleInput/Conditions/ConditionList.esm.js +1 -1
- package/dist/components/CheckForm/FormFields/RuleInput/Conditions/FactValueDisplay.esm.js +1 -1
- package/dist/components/CheckForm/FormFields/RuleInput/Conditions/RuleConditionInput.esm.js +1 -1
- package/dist/components/CheckForm/FormFields/RuleInput/Expressions/ExpressionBox.esm.js +1 -1
- package/dist/components/CheckForm/FormFields/RuleInput/RuleInputBox.esm.js +1 -1
- package/dist/components/CheckForm/Steps/CheckApplicabilityStep.esm.js +1 -1
- package/dist/components/CheckForm/utils/checkFormUtils.esm.js +2 -2
- package/dist/components/CheckForm/utils/validation.esm.js +1 -1
- package/dist/components/CheckIcon/CheckIcon.esm.js +1 -1
- package/dist/components/CheckPage/CheckEntitiesTable/CheckEntitiesTable.esm.js +1 -1
- package/dist/components/CheckPage/CheckInsightsPage.esm.js +1 -1
- package/dist/components/CheckPage/ExemptionsTable.esm.js +2 -0
- package/dist/components/CollectorPage/CollectorPage.esm.js +1 -1
- package/dist/components/CollectorPage/Configurators/Common/FactCollectionConfig.esm.js +1 -1
- package/dist/components/CollectorPage/Configurators/HTTP/HttpStatusesInput.esm.js +1 -1
- package/dist/components/CollectorPage/Configurators/PagerDuty/PagerDutyConfigurator.esm.js +1 -1
- package/dist/components/CollectorPage/Configurators/PagerDuty/utils.esm.js +1 -1
- package/dist/components/CollectorsPage/CollectorListPage/CollectorListPage.esm.js +1 -1
- package/dist/components/CollectorsPage/CollectorListPage/CollectorSummaryCard.esm.js +1 -1
- package/dist/components/CollectorsPage/CollectorsPage.esm.js +1 -1
- package/dist/components/EntitiesAutocompletePicker/EntitiesAutocompletePicker.esm.js +1 -1
- package/dist/components/FactExplorer/FactExplorer.esm.js +1 -1
- package/dist/components/FactExplorer/FactExplorerDialog.esm.js +1 -1
- package/dist/components/FactExplorer/useFactOptions.esm.js +1 -1
- package/dist/components/Filter/EntityAutocompletePicker.esm.js +1 -1
- package/dist/components/Filter/FilterComponent.esm.js +1 -1
- package/dist/components/FilterSidebar/StateFilter.esm.js +1 -1
- package/dist/components/FormControlledAutocomplete/FormControlledMultipleAutocomplete.esm.js +1 -1
- package/dist/components/GroupSelector/GroupSelector.esm.js +1 -1
- package/dist/components/LevelsTable/CheckRowContent.esm.js +1 -1
- package/dist/components/OrgInsights/OrgInsightsPage.esm.js +2 -0
- package/dist/components/OrgInsights/OrgInsightsSidebar.esm.js +2 -0
- package/dist/components/OrgInsights/OrgInsightsViewSelector.esm.js +2 -0
- package/dist/components/OrgInsights/TrackCardGrid.esm.js +2 -0
- package/dist/components/OrgInsights/TrackComparison.esm.js +2 -0
- package/dist/components/OrgInsights/TrackStatusTile.esm.js +2 -0
- package/dist/components/OrgInsights/styles.esm.js +2 -0
- package/dist/components/OverviewPage/OverviewPageHeader.esm.js +1 -1
- package/dist/components/OverviewTable/Cell/CheckNameCell.esm.js +1 -1
- package/dist/components/OverviewTable/Cell/TrackCheckStatusCount.esm.js +2 -0
- package/dist/components/OverviewTable/Cell/cellRenderer.esm.js +1 -1
- package/dist/components/OverviewTable/OverviewTableContent.esm.js +1 -1
- package/dist/components/OverviewTable/ResultsTable.esm.js +1 -1
- package/dist/components/OverviewTable/ResultsTableRow.esm.js +1 -1
- package/dist/components/Router.esm.js +1 -1
- package/dist/components/RoutingPage/RoutingPage.esm.js +1 -1
- package/dist/components/RoutingPage/index.esm.js +1 -1
- package/dist/components/SoundcheckHeader/SoundcheckHeader.esm.js +1 -1
- package/dist/components/SummaryCard/SummaryCard.esm.js +1 -1
- package/dist/components/TechHealth/Filters/FacetFilter.esm.js +1 -1
- package/dist/components/TopFailingChecksTable/TopFailingChecksTable.esm.js +1 -1
- package/dist/components/TrackPage/TrackEntitiesTable/columns.esm.js +1 -1
- package/dist/components/TrackPage/TrackEntitiesTable/utils.esm.js +1 -1
- package/dist/components/TrackPage/TrackHistoryChart.esm.js +1 -1
- package/dist/components/TrackPage/TrackPage.esm.js +1 -1
- package/dist/components/TrackPage/TrackStatusBar.esm.js +1 -1
- package/dist/components/TrackPage/TrackStatusTable.esm.js +1 -1
- package/dist/contexts/UserProvider.esm.js +1 -1
- package/dist/graphql/generated/index.esm.js +56 -22
- package/dist/hooks/aggregations/useCheckStatus.esm.js +1 -1
- package/dist/hooks/campaigns/useCreateCampaign.esm.js +1 -1
- package/dist/hooks/campaigns/useUpdateCampaign.esm.js +1 -1
- package/dist/hooks/certifications/useTrackOverviewForOwner.esm.js +1 -1
- package/dist/hooks/checks/useCreateCheck.esm.js +1 -1
- package/dist/hooks/checks/useSetManualResult.esm.js +1 -1
- package/dist/hooks/checks/useUpdateCheck.esm.js +1 -1
- package/dist/hooks/collectors/useUpdateCollectorConfig.esm.js +1 -1
- package/dist/hooks/exemptions/useDeleteExemption.esm.js +1 -1
- package/dist/hooks/exemptions/useExemptCheckIds.esm.js +1 -1
- package/dist/hooks/exemptions/useExemptions.esm.js +2 -0
- package/dist/hooks/exemptions/useGetExemption.esm.js +1 -1
- package/dist/hooks/exemptions/useSetEntityExempt.esm.js +1 -1
- package/dist/hooks/graphqlKeys.esm.js +1 -1
- package/dist/hooks/tracks/useCreateTrack.esm.js +1 -1
- package/dist/hooks/tracks/useUpdateTrack.esm.js +1 -1
- package/dist/index.d.ts +85 -1
- package/dist/index.esm.js +1 -1
- package/dist/utils/validation.esm.js +1 -1
- package/package.json +18 -18
- package/dist/components/CheckForm/FormFields/RuleInput/useRuleInputHandlers.esm.js +0 -2
- package/dist/components/OrgHealth/OrgHealthPage.esm.js +0 -2
- package/dist/components/OverviewTable/Cell/TrackCheckIndicator.esm.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as o,jsx as e,Fragment as l}from"react/jsx-runtime";import{useApi as w,configApiRef as A}from"@backstage/core-plugin-api";import{makeStyles as D,Paper as E,Typography as F,Divider as s,Box as d,Button as T}from"@material-ui/core";import{ToggleButtonGroup as j,ToggleButton as x}from"@material-ui/lab";import{NotesSchema as P}from"@spotify/backstage-plugin-soundcheck-common";import{useState as R}from"react";import{ResultState as i}from"../../graphql/generated/index.esm.js";import{CheckIcon as $}from"../CheckIcon/CheckIcon.esm.js";import{SoundcheckMarkdownContent as I}from"../SoundcheckMarkdownContent/SoundcheckMarkdownContent.esm.js";import"@backstage/core-components";import"react-markdown";import"rehype-raw";import"remark-gfm";import{CheckResultDetails as v}from"./CheckResultDetails.esm.js";import{FixMeDialog as G}from"./FixMeDialog.esm.js";import{JustificationDetails as k}from"./JustificationDetails.esm.js";import{SelectedValueProvider as J}from"./SelectedValueContext.esm.js";const L=D(n=>({markdownContent:{"& :last-child":{marginBottom:0},"& pre":{background:`${n.palette.background.paper} !important`},"& :first-child":{marginTop:0}},root:{padding:n.spacing(2),display:"flex",flexDirection:"column",gap:n.spacing(1.5)},header:{display:"flex",alignItems:"center",justifyContent:"space-between"},iconContainer:{display:"flex",alignItems:"center"},toggleButtonGroup:{marginLeft:"auto"},toggleButton:{padding:n.spacing(.5),fontSize:n.typography.pxToRem(12)},passed:{},failed:{},warning:{},notReported:{},notApplicable:{},exempt:{},error:{},icon:{marginRight:n.spacing(.5)},divider:{margin:n.spacing(.5,0)}}),{name:"CheckResultStateBox"}),M={[i.Passed]:"Check passed",[i.Failed]:"Check did not pass",[i.Warning]:"Check produced warning(s)",[i.NotReported]:"Check not reported",[i.NotApplicable]:"Check not applicable",[i.Exempt]:"Exempt from check",[i.Error]:"Check encountered an error."},O={[i.Passed]:"passed",[i.Failed]:"failed",[i.Warning]:"warning",[i.NotReported]:"notReported",[i.NotApplicable]:"notApplicable",[i.Exempt]:"exempt",[i.Error]:"error"},W=({name:n,state:r,details:t,templateRef:m})=>{const a=L(),[C,c]=R(!1),[p,y]=R("notes"),N=w(A).getOptionalStringArray("soundcheck.flags")?.includes("enable-fix-me"),u=t&&(t.ruleResult||t.applicabilityResult),b=()=>{c(!0)},B=()=>{c(!1)},S=(z,f)=>{f!==null&&y(f)},g=t?.notes?P.safeParse(t.notes):void 0,h=g?.success?g.data.data:void 0;return o(E,{variant:"outlined",className:`${a.root} ${a[O[r]]}`,children:[o("div",{className:a.header,children:[o("div",{className:a.iconContainer,children:[e($,{className:a.icon,result:r}),e(F,{variant:"subtitle1",children:M[r]})]}),u&&o(j,{value:p,exclusive:!0,onChange:S,className:a.toggleButtonGroup,children:[e(x,{value:"notes",className:a.toggleButton,children:"Notes"}),e(x,{value:"details",className:a.toggleButton,children:"Details"})]})]}),p==="notes"&&o(l,{children:[t&&t.exemption&&o(l,{children:[e(s,{className:a.divider}),e(k,{justification:t.exemption,type:"exemption"})]}),t&&t.manualResult&&o(l,{children:[e(s,{className:a.divider}),e(k,{justification:t.manualResult,type:"manual"})]}),h&&o(d,{style:{maxHeight:"35vh",overflowY:"auto"},children:[e(s,{className:a.divider}),e(d,{marginTop:1.5,children:e(I,{className:a.markdownContent,content:h})})]}),N&&r===i.Failed&&m&&o(d,{display:"flex",flexDirection:"column",alignItems:"flex-end",mt:2,width:"100%",children:[e(T,{color:"primary",variant:"contained",onClick:b,children:"Fix"}),e(G,{title:`Fix ${n}`,open:C,setOpen:c,onClose:B,templateRef:m})]})]}),p==="details"&&e(l,{children:u&&o(l,{children:[e(s,{className:a.divider}),o(J,{children:[t.applicabilityResult&&e(v,{ruleResult:t.applicabilityResult,title:"Applicability Rule Evaluation"}),t.ruleResult&&e(v,{ruleResult:t.ruleResult,title:"Check Rule Evaluation"})]})]})})]})};export{W as ResultStateBox};
|
|
2
2
|
//# sourceMappingURL=ResultStateBox.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as t,jsx as e,Fragment as y}from"react/jsx-runtime";import{EntityRefLink as B}from"@backstage/plugin-catalog-react";import{makeStyles as E,Box as p,Typography as r,Divider as b,Grid as s}from"@material-ui/core";import{Alert as T}from"@material-ui/lab";import{parseFactRef as z,getRuleHash as F}from"@spotify/backstage-plugin-soundcheck-common";import{isEmpty as P}from"lodash";import{ResultState as S}from"../../graphql/generated/index.esm.js";import{ResultStateBox as w}from"../CheckDetails/ResultStateBox.esm.js";import{ExpressionTypeReadableMap as D,ExpressionType as $}from"../CheckForm/types/ExpressionType.esm.js";import"../Frequency/types.esm.js";import"../Frequency/util.esm.js";import"../Frequency/FrequencyComponent.esm.js";import"../CheckForm/types/Path.esm.js";import{mapRuleToExpression as k}from"../CheckForm/utils/checkFormUtils.esm.js";import{CheckIcon as I}from"../CheckIcon/CheckIcon.esm.js";import{ExpandableSection as C}from"../ExpandableSection/ExpandableSection.esm.js";import{FormattedPreview as f}from"../FormattedPreview/FormattedPreview.esm.js";const R=E(i=>({dryRunRoot:{padding:i.spacing(2)},dryRunSection:{marginBottom:i.spacing(2)},rulesSection:{padding:i.spacing(2),margin:0,width:"100%"},resultBox:{fontSize:i.typography.body1.fontSize},factBox:{padding:0,border:`1px solid ${i.palette.divider}`,overflow:"auto",fontSize:i.typography.body2.fontSize,maxHeight:500},nested:{margin:i.spacing(3)},expressionType:{padding:i.spacing(1,2)},expressionWrapper:{border:`1px solid ${i.palette.divider}`,marginBottom:i.spacing(2)},resultDisplay:{display:"flex",alignItems:"center"},resultIcon:{marginRight:i.spacing(.25)},ownerLink:{"& span":{"&:hover":{textDecoration:"underline"}},fontSize:i.typography.body1.fontSize},valueBox:{maxHeight:500,overflow:"auto"}})),A=({passed:i})=>{const n=R();return t(r,{variant:"body1",className:n.resultDisplay,children:[e(I,{className:n.resultIcon,result:i?S.Passed:S.Failed})," ",i?"Passed":"Failed"]})},g=({check:i,expression:n,facts:h,ruleResults:u})=>{const o=R();return e(y,{children:t(p,{className:o.expressionWrapper,children:[e(r,{className:o.expressionType,variant:"subtitle1",children:D[n.expressionType??$.AllOf]}),n.conditions?.map((a,c)=>{const l=a.operatorPrefix?`${a.operatorPrefix}:${a.operator}`:a.operator,m=z(a.factRef),d=h?.find(v=>v.factRef===a.factRef),N=F({factRef:m,value:a.value,operator:l,path:a.path}),x=u?.find(v=>v.name===N);return t("div",{children:[e(b,{variant:"middle"}),t(s,{container:!0,className:o.rulesSection,spacing:2,children:[t(s,{item:!0,xs:6,children:[e(r,{variant:"subtitle2",color:"textSecondary",children:"Integration"}),e(r,{variant:"body1",children:m.source})]}),t(s,{item:!0,xs:6,children:[e(r,{variant:"subtitle2",color:"textSecondary",children:"Fact"}),e(r,{variant:"body1",children:m.name})]}),i?.pathResolver&&t(s,{item:!0,xs:6,children:[e(r,{variant:"subtitle2",color:"textSecondary",children:"Path Resolver"}),e(r,{variant:"body1",children:i.pathResolver})]}),t(s,{item:!0,xs:6,children:[e(r,{variant:"subtitle2",color:"textSecondary",children:"Path"}),e(r,{variant:"body1",children:a.path})]}),t(s,{item:!0,xs:6,children:[e(r,{variant:"subtitle2",color:"textSecondary",children:"Operator"}),e(r,{variant:"body1",children:l})]}),x?.result!==void 0&&t(s,{item:!0,xs:6,children:[e(r,{variant:"subtitle2",color:"textSecondary",children:"Result"}),e(A,{passed:x.result})]}),t(s,{item:!0,xs:12,children:[e(r,{variant:"subtitle2",color:"textSecondary",children:"Expected"}),e(r,{component:"div",variant:"body2",className:o.valueBox,children:e(f,{data:a?.value})})]}),t(s,{item:!0,xs:12,children:[e(r,{variant:"subtitle2",color:"textSecondary",children:"Resolved Value"}),e(r,{component:"div",variant:"body2",className:o.valueBox,children:e(f,{data:x?.factResult})})]}),!!d&&e(s,{item:!0,xs:12,children:e(C,{elevation:0,title:"Related Fact",children:e("div",{className:o.factBox,children:d.sensitive&&P(d.data)?e(p,{children:e(T,{severity:"info",children:"The associated fact contains potentially sensitive information and has been redacted."})}):e(f,{data:d.data})})})})]})]},`expression-${c}`)}),!!n?.expressions&&t(y,{children:[e(b,{variant:"middle"}),e(p,{className:o.nested,children:n?.expressions?.map((a,c)=>e(g,{check:i,facts:h,ruleResults:u,expression:a},`nested-expression-${c}`))})]})]})})},H=({entityRef:i,check:n,checkResult:h,details:u,facts:o,ruleResults:a,applicabilityResults:c})=>{const l=R(),m=k(n?.rule),d=k(n?.applicable);return t(p,{className:l.dryRunRoot,children:[e(p,{className:l.dryRunSection,children:i&&t(y,{children:[e(r,{variant:"h5",children:"Entity"}),e(r,{variant:"body1",children:e(B,{className:l.ownerLink,entityRef:i})})]})}),t(p,{className:l.dryRunSection,children:[e(r,{variant:"h5",children:"Check Result"}),e("div",{className:l.resultBox,children:h?e(w,{name:n?.name??"",state:h,details:u}):"No Results"})]}),!!c?.length&&t("div",{children:[e(r,{variant:"h5",children:"Applicability Rule"}),e(g,{check:n,facts:o,ruleResults:c,expression:d})]}),!!a?.length&&t("div",{children:[e(r,{variant:"h5",children:"Check Rule"}),e(g,{check:n,facts:o,ruleResults:a,expression:m})]})]})};export{H as CheckDryRunDetails};
|
|
2
2
|
//# sourceMappingURL=CheckDryRunDetails.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import{Grid as s}from"@material-ui/core";import{makeStyles as l}from"@material-ui/core/styles";import{RuleConditionInput as c}from"./RuleConditionInput.esm.js";import{ValueListContextProvider as p}from"./ValueListContext.esm.js";const f=l(()=>({noPadding:{padding:0}})),u=({name:e,disabled:o,disableDelete:n,conditions:d,remove:r})=>{const a=f();return i(p,{children:d.map((m,t)=>i(s,{item:!0,className:a.noPadding,children:i(c,{name:`${e}.conditions[${t}]`,"data-testid":`${e}-condition-input`,handleDelete:()=>r(t),disabled:o,disableDelete:n})},m.id))})};export{u as ConditionList};
|
|
2
2
|
//# sourceMappingURL=ConditionList.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as l,Fragment as i,jsx as r}from"react/jsx-runtime";import{Box as n,IconButton as c,FormHelperText as
|
|
1
|
+
import{jsxs as l,Fragment as i,jsx as r}from"react/jsx-runtime";import{Box as n,IconButton as c,FormHelperText as h}from"@material-ui/core";import m from"@material-ui/icons/Close";import{useRuleConditionStyles as d}from"./styles.esm.js";const f=({value:e,handleClear:t,error:o})=>{const a=d(),s=e?.factRef&&e?.path?l(i,{children:[r("strong",{children:"Fact:"})," ",e.factRef," ",r("strong",{children:"Path:"})," ",e.path]}):JSON.stringify(e);return l(i,{children:[l(n,{className:a.valueDisplay,children:[r(n,{overflow:"hidden",flexGrow:1,children:s}),r(c,{onClick:t,size:"small",children:r(m,{})})]}),o&&r(h,{error:!0,children:o.message})]})};export{f as FactValueDisplay};
|
|
2
2
|
//# sourceMappingURL=FactValueDisplay.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:x})=>{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:$}=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]),L=b(e=>{s(`${l}.value`,e.length>0?e:""),h()},[h,l,s]),i=m(`${l}.value`),C=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||$,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||$,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(y=>o===y.value)?.label??o??"")(e),getOptionValue:e=>(o=>f?.find(y=>o===y.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:C}):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:C,size:"small",children:a(k,{})}),startAdornment:Array.isArray(i)?a(O,{values:i,onSave:L,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:L})]})]})]})]}),a(A,{onClick:w,className:t.deleteButton,"data-
|
|
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:x})=>{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:$}=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]),L=b(e=>{s(`${l}.value`,e.length>0?e:""),h()},[h,l,s]),i=m(`${l}.value`),C=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||$,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||$,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(y=>o===y.value)?.label??o??"")(e),getOptionValue:e=>(o=>f?.find(y=>o===y.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:C}):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:C,size:"small",children:a(k,{})}),startAdornment:Array.isArray(i)?a(O,{values:i,onSave:L,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:L})]})]})]})]}),a(A,{onClick:w,className:t.deleteButton,"data-testid":`${l}-delete-button`,disabled:d||x,hidden:d||x,style:{visibility:d||x?"hidden":void 0},children:a(E,{className:t.deleteIcon})})]})};export{Q as RuleConditionInput};
|
|
2
2
|
//# sourceMappingURL=RuleConditionInput.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Grid as d}from"@material-ui/core";import{makeStyles as t}from"@material-ui/core/styles";import{RuleInputBox as p}from"../RuleInputBox.esm.js";const a=t(()=>({noPadding:{padding:0}})),l=({exists:o,name:r,depth:n,disabled:s,removeExpression:i})=>{const m=a();return o?e(d,{item:!0,className:m.noPadding,children:e(p,{removeExpression:i,name:`${r}`,depth:n+1,disabled:s})}):null};export{l as ExpressionBox};
|
|
2
2
|
//# sourceMappingURL=ExpressionBox.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as n,jsx as o}from"react/jsx-runtime";import{Box as r,Grid as p,Button as y}from"@material-ui/core";import{makeStyles as B}from"@material-ui/core/styles";import{useFormContext as b,useFieldArray as x}from"react-hook-form";import{ExpressionType as N}from"../../types/ExpressionType.esm.js";import"../../../Frequency/types.esm.js";import"../../../Frequency/util.esm.js";import"../../../Frequency/FrequencyComponent.esm.js";import"../../types/Path.esm.js";import{AddMenuButton as $}from"./AddMenuButton.esm.js";import"@material-ui/icons/Close";import"@material-ui/icons/Delete";import"@material-ui/icons/List";import"@spotify/backstage-plugin-soundcheck-common";import"react";import"@backstage/core-plugin-api";import"@tanstack/react-query";import"../../../../api.esm.js";import"@material-ui/icons/Search";import"../../../SoundcheckDialog/SoundcheckDialog.esm.js";import"../../../FactExplorer/FactExplorer.esm.js";import"../../../FactExplorer/FactExplorerContext.esm.js";import"../../../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import"./Conditions/styles.esm.js";import"@backstage/catalog-model";import"../../../../hooks/graphqlKeys.esm.js";import"@backstage/plugin-catalog-react";import"../../../../hooks/useSoundcheckAlert.esm.js";import"../../../../hooks/useConfirmationModal.esm.js";import"react-router-dom";import"../../utils/checkFormUtils.esm.js";import"./Conditions/ValueListInput.esm.js";import{ConditionList as A}from"./Conditions/ConditionList.esm.js";import{ExpressionBox as E}from"./Expressions/ExpressionBox.esm.js";import{ExpressionTypeToggle as P}from"./Expressions/ExpressionTypeToggle.esm.js";const L=B(e=>({root:{padding:0},inner:{marginLeft:e.spacing(2),paddingBottom:e.spacing(2),borderLeft:`1px solid ${e.palette.border}`,display:"flex",flexDirection:"row",gap:0},connector:{borderBottom:`1px solid ${e.palette.border}`,padding:e.spacing(0),width:"15px",height:"20px"},noPadding:{padding:0},marginBottom:{marginBottom:e.spacing(1)},empty:{border:`1px solid ${e.palette.error.main}`,padding:e.spacing(2),margin:e.spacing(2,0)},gap:{borderLeft:`1px solid ${e.palette.border}`,marginLeft:e.spacing(2)},removeButton:{padding:e.spacing(.5,1.5),color:e.palette.text.primary}})),T=({name:e,depth:m,disabled:t,removeExpression:s})=>{const i=L(),{control:l}=b(),{fields:a,append:f,remove:h}=x({control:l,name:`${e}.expressions`}),{fields:d,append:u,remove:v}=x({control:l,name:`${e}.conditions`});return n(r,{className:m>0?i.inner:i.root,children:[m>0&&o(r,{className:i.connector}),n(p,{container:!0,spacing:0,direction:"column",className:i.noPadding,children:[o(p,{item:!0,className:i.noPadding,children:o(P,{disabled:t,name:`${e}.expressionType`})}),n(p,{item:!0,container:!0,spacing:0,direction:"column",className:i.noPadding,children:[d.length===0&&!a.length&&o(r,{className:i.empty,children:"Add an expression or condition."}),d.length===0&&a.length>0&&o(r,{padding:1,className:i.gap}),o(A,{remove:v,conditions:d,disabled:t,name:e}),a.map((c,g)=>o(E,{exists:!!c,name:`${e}.expressions[${g}]`,depth:m,disabled:t,removeExpression:()=>h(g)},c.id))]}),!t&&o(p,{item:!0,className:i.noPadding,children:n(r,{display:"flex",gridGap:8,children:[o($,{onAddCondition:()=>u({factRef:"",path:"",operator:"",value:""}),onAddExpression:()=>f({expressionType:N.AllOf,expressions:void 0,conditions:[{factRef:"",path:"",operator:"",value:""}]})}),s&&o(y,{className:i.removeButton,variant:"text",onClick:s,children:"Remove"})]})})]})]})};export{T as RuleInputBox};
|
|
2
2
|
//# sourceMappingURL=RuleInputBox.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as i,jsx as e}from"react/jsx-runtime";import{FormControlLabel as y,Switch as b,Typography as m}from"@material-ui/core";import{makeStyles as x}from"@material-ui/core/styles";import{useFormContext as g}from"react-hook-form";import"../../../contexts/TrackFormContext.esm.js";import{useCheckFormContext as k}from"../../../contexts/CheckFormContext.esm.js";import"../../../contexts/CampaignFormContext.esm.js";import"react";import"../../../contexts/UserProvider.esm.js";import{FormFieldLabel as s}from"../../FormFieldLabel/FormFieldLabel.esm.js";import{FormFilterSection as F}from"../../FormFilterSection/FormFilterSection.esm.js";import{FormMarkdownInput as v}from"../../FormMarkdownInput/FormMarkdownInput.esm.js";import"../FormFields/CheckNameInput/CheckNameInput.esm.js";import"../FormFields/PassFailMessageInput/PassFailMessageInput.esm.js";import{CHECK_FIELDS as C}from"../utils/checkFormUtils.esm.js";import"../FormFields/TeamDetailsInput/TeamDetailsInput.esm.js";import"../FormFields/RuleInput/AddMenuButton.esm.js";import{RuleInputBox as S}from"../FormFields/RuleInput/RuleInputBox.esm.js";import"../FormFields/RuleInput/Expressions/ExpressionBox.esm.js";import"../FormFields/RuleInput/Expressions/ExpressionTypeToggle.esm.js";import"@material-ui/icons/Close";import"@material-ui/icons/Delete";import"@material-ui/icons/List";import"@spotify/backstage-plugin-soundcheck-common";import"@backstage/core-plugin-api";import"@tanstack/react-query";import"../../../api.esm.js";import"@material-ui/icons/Search";import"../../SoundcheckDialog/SoundcheckDialog.esm.js";import"../../FactExplorer/FactExplorer.esm.js";import"../../FactExplorer/FactExplorerContext.esm.js";import"../../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import"../FormFields/RuleInput/Conditions/styles.esm.js";import"@backstage/catalog-model";import"../../../hooks/graphqlKeys.esm.js";import"@backstage/plugin-catalog-react";import"../../../hooks/useSoundcheckAlert.esm.js";import"../../../hooks/useConfirmationModal.esm.js";import"react-router-dom";import"../FormFields/RuleInput/Conditions/ValueListInput.esm.js";import"../FormFields/RuleInput/Conditions/ConditionList.esm.js";import"../FormFields/CheckScheduleSection/ScheduleSection.esm.js";import"../FormFields/CheckPathResolverInput.esm.js";import{ExpressionType as N}from"../types/ExpressionType.esm.js";import"../../Frequency/types.esm.js";import"../../Frequency/util.esm.js";import"../../Frequency/FrequencyComponent.esm.js";import"../types/Path.esm.js";const w=x(t=>({container:{display:"flex",flexDirection:"column",gap:t.spacing(2)},innerContainer:{display:"flex",flexDirection:"column"}})),E=()=>{const t=w(),{isLoading:r,isReadOnly:o}=k(),{control:d,watch:
|
|
1
|
+
import{jsxs as i,jsx as e}from"react/jsx-runtime";import{FormControlLabel as y,Switch as b,Typography as m}from"@material-ui/core";import{makeStyles as x}from"@material-ui/core/styles";import{useFormContext as g}from"react-hook-form";import"../../../contexts/TrackFormContext.esm.js";import{useCheckFormContext as k}from"../../../contexts/CheckFormContext.esm.js";import"../../../contexts/CampaignFormContext.esm.js";import"react";import"../../../contexts/UserProvider.esm.js";import{FormFieldLabel as s}from"../../FormFieldLabel/FormFieldLabel.esm.js";import{FormFilterSection as F}from"../../FormFilterSection/FormFilterSection.esm.js";import{FormMarkdownInput as v}from"../../FormMarkdownInput/FormMarkdownInput.esm.js";import"../FormFields/CheckNameInput/CheckNameInput.esm.js";import"../FormFields/PassFailMessageInput/PassFailMessageInput.esm.js";import{CHECK_FIELDS as C}from"../utils/checkFormUtils.esm.js";import"../FormFields/TeamDetailsInput/TeamDetailsInput.esm.js";import"../FormFields/RuleInput/AddMenuButton.esm.js";import{RuleInputBox as S}from"../FormFields/RuleInput/RuleInputBox.esm.js";import"../FormFields/RuleInput/Expressions/ExpressionBox.esm.js";import"../FormFields/RuleInput/Expressions/ExpressionTypeToggle.esm.js";import"@material-ui/icons/Close";import"@material-ui/icons/Delete";import"@material-ui/icons/List";import"@spotify/backstage-plugin-soundcheck-common";import"@backstage/core-plugin-api";import"@tanstack/react-query";import"../../../api.esm.js";import"@material-ui/icons/Search";import"../../SoundcheckDialog/SoundcheckDialog.esm.js";import"../../FactExplorer/FactExplorer.esm.js";import"../../FactExplorer/FactExplorerContext.esm.js";import"../../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import"../FormFields/RuleInput/Conditions/styles.esm.js";import"@backstage/catalog-model";import"../../../hooks/graphqlKeys.esm.js";import"@backstage/plugin-catalog-react";import"../../../hooks/useSoundcheckAlert.esm.js";import"../../../hooks/useConfirmationModal.esm.js";import"react-router-dom";import"../FormFields/RuleInput/Conditions/ValueListInput.esm.js";import"../FormFields/RuleInput/Conditions/ConditionList.esm.js";import"../FormFields/CheckScheduleSection/ScheduleSection.esm.js";import"../FormFields/CheckPathResolverInput.esm.js";import{ExpressionType as N}from"../types/ExpressionType.esm.js";import"../../Frequency/types.esm.js";import"../../Frequency/util.esm.js";import"../../Frequency/FrequencyComponent.esm.js";import"../types/Path.esm.js";const w=x(t=>({container:{display:"flex",flexDirection:"column",gap:t.spacing(2)},innerContainer:{display:"flex",flexDirection:"column"}})),E=()=>{const t=w(),{isLoading:r,isReadOnly:o}=k(),{control:d,watch:c,setValue:a}=g(),l="filtersStep.applicabilityExpressions",n="filtersStep.notApplicableMessage",h=c("detailsStep.type"),p=c(l),f=u=>{u.target.checked?(a(l,{expressionType:N.AllOf,conditions:[{factRef:"",path:"",operator:"",operatorPrefix:"",value:""}]}),a(n,"")):(a(l,void 0),a(n,void 0))};return i("div",{className:t.container,children:[e(F,{name:"filtersStep.filter",keyValueFilterName:"filtersStep.keyValueFilter",disabled:r||o,description:C.filter.description,excludeFilterName:"filtersStep.excludeFilter",excludeKeyValueFilterName:"filtersStep.excludeKeyValueFilter"}),h!=="manual"&&i("div",{className:t.container,children:[i("div",{className:t.innerContainer,children:[e(y,{label:e(s,{title:"Applicability rule (Optional)",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/checks/#applicability-rule"}),disabled:r||o,control:e(b,{checked:!!p?.conditions||!!p?.expressions,onChange:f})}),e(m,{variant:"caption",children:"The check applies to all entities that match the catalog filters above. If you want to add an extra fact-based applicability rule, turn on the toggle and define the fact-based rule. With this rule enabled, the check will only apply to entities that match both the catalog filters and the fact-based rule. The fact-based rule is re-checked every time the check runs."})]}),(!!p?.conditions||!!p?.expressions)&&i("div",{className:t.container,children:[e("div",{className:t.innerContainer,children:e(S,{disabled:r||o,name:l,depth:0})}),i("div",{className:t.innerContainer,children:[e(s,{title:"Not applicable message (Optional)"}),e(m,{variant:"caption",children:"Add a message explaining why the check doesn't apply if an entity fails the fact-based rule."}),e(v,{name:n,control:d,placeholder:"Enter not applicable message...",disabled:r||o})]})]})]})]})};export{E as CheckApplicabilityStep};
|
|
2
2
|
//# sourceMappingURL=CheckApplicabilityStep.esm.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{FrequencySchema as A}from"@spotify/backstage-plugin-soundcheck-common";import{isObject as C}from"lodash";import{v4 as R}from"uuid";import{mapInputFilterToFormFilters as x,mapCatalogFilterToFormKeyValueFilters as g,mapFiltersToCatalogFilter as m}from"../../Filter/utils.esm.js";import"../../Filter/FilterComponent.esm.js";import{emptyFilters as v,emptyKeyValueFilters as b}from"../../Filter/types.esm.js";import{TimeUnit as F}from"../../Frequency/types.esm.js";import{isTimeUnit as M}from"../../Frequency/util.esm.js";import"../../Frequency/FrequencyComponent.esm.js";import{ExpressionType as l}from"../types/ExpressionType.esm.js";import{defaultSchedule as O}from"../types/Schedule.esm.js";import"../types/Path.esm.js";import{CHECK_NAME_MAX_LENGTH as P}from"./validation.esm.js";const
|
|
2
|
-
For example, selecting an include filter of 'Kind' as 'Component' and an exclude filter of 'Type' as 'Service' will select all entities with kind Component where type is NOT Service.`},schedule:{description:"Checks are automatically triggered whenever a dependent fact is updated. When collectors are scheduled, there is generally no need to schedule checks.",checkboxLabel:"Schedule check"}};export{K as CHECK_FIELDS,q as DEFAULT_FORM_VALUES,c as generateJsonPaths,V as mapCheckerToFormValues,p as mapExpressionToRule,
|
|
1
|
+
import{FrequencySchema as A}from"@spotify/backstage-plugin-soundcheck-common";import{isObject as C}from"lodash";import{v4 as R}from"uuid";import{mapInputFilterToFormFilters as x,mapCatalogFilterToFormKeyValueFilters as g,mapFiltersToCatalogFilter as m}from"../../Filter/utils.esm.js";import"../../Filter/FilterComponent.esm.js";import{emptyFilters as v,emptyKeyValueFilters as b}from"../../Filter/types.esm.js";import{TimeUnit as F}from"../../Frequency/types.esm.js";import{isTimeUnit as M}from"../../Frequency/util.esm.js";import"../../Frequency/FrequencyComponent.esm.js";import{ExpressionType as l}from"../types/ExpressionType.esm.js";import{defaultSchedule as O}from"../types/Schedule.esm.js";import"../types/Path.esm.js";import{CHECK_NAME_MAX_LENGTH as P}from"./validation.esm.js";const E=e=>{if(C(e)&&"frequency"in e){const r=A.safeParse(e.frequency);if(r.success){const t=r.data;if("cron"in t)return{enabled:!0,frequency:{type:"cron",unit:F.Hours,value:1,cron:t.cron}};const i=Object.keys(t);if(i.length){const s=i[0];if(M(s))return{enabled:!0,frequency:{type:"HumanDuration",unit:s,value:t[s]??1,cron:""}}}}}return{enabled:!1,frequency:{type:"HumanDuration",unit:F.Hours,value:1,cron:""}}},w=(e,r)=>{const{enabled:t,frequency:i}=e;if(t){const{cron:s,type:o,unit:a,value:u}=i;return o==="HumanDuration"?{frequency:{[a]:u},filter:m(r)}:{frequency:{cron:s}}}},y=e=>{if(Array.isArray(e))return e.map(r=>y(r));if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1;const r=Number(e);if(!isNaN(r))return r}return e},p=e=>{if(!e)return{};if(e.expressionType){const r={[e.expressionType]:e.conditions?.map(t=>({factRef:t.factRef,path:t.path,operator:t.operatorPrefix?`${t.operatorPrefix}:${t.operator}`:t.operator,value:y(t.value)}))};return e.expressions&&e.expressions.forEach(t=>{r[e.expressionType]?.push(p(t))}),r}if(e.expressions)return e.expressions.map(p);if(e.conditions&&e.conditions.length===1){const r=e.conditions[0];return{factRef:r.factRef,path:r.path,operator:r.operatorPrefix?`${r.operatorPrefix}:${r.operator}`:r.operator,value:y(r.value)}}return{}},k=e=>{if(e?.match(/.:./)){const r=e.split(":");if(["all","any","none"].includes(r[0]))return{operator:r[1],operatorPrefix:r[0]}}return{}},f=(e,r=!0)=>{if(!e)return{conditions:[]};const t=Object.keys(e);let i=t.includes("all")||r&&!t.includes("any")?l.AllOf:l.AnyOf;if(t.includes("not")&&(i=l.Not),t.includes(i)||r){const a=e[i]||[e],u=[],d=[];return a.forEach(n=>{const h=Object.keys(n);if(h.includes("all")||h.includes("any")||h.includes("not"))d.push(f(n,!1));else{const{operator:T,operatorPrefix:S}=k(n.operator);u.push({factRef:n.factRef,path:n.path,operator:T??n.operator,value:n.value,operatorPrefix:S})}}),{expressions:d.length>0?d:void 0,conditions:u,expressionType:i}}const{operator:s,operatorPrefix:o}=k(e.operator);return{expressionType:l.AllOf,conditions:[{factRef:e.factRef,path:e.path,operator:s??e.operator,value:e.value,operatorPrefix:o}]}},V=e=>({detailsStep:{name:e.name??"",description:e.description??"",ownerEntityRef:e.ownerEntityRef??"",type:e.type??"default"},rulesStep:{pathResolver:e.pathResolver??"jsonpath",expressions:f(e.rule),passedMessage:e.passedMessage??void 0,failedMessage:e.failedMessage??void 0,warning:e.warning??!1},filtersStep:{filter:x(e.filter),keyValueFilter:g(e.filter),excludeFilter:x(e.exclude),excludeKeyValueFilter:g(e.exclude),applicabilityExpressions:e.applicable?f(e.applicable):void 0,notApplicableMessage:e.notApplicableMessage??void 0},scheduleStep:{schedule:E(e.schedule)}}),N=(e,r)=>{const{detailsStep:t,rulesStep:i,filtersStep:s,scheduleStep:o}=e;return{id:r?r.id:R(),ownerEntityRef:t.ownerEntityRef??void 0,name:t.name,description:t.description,pathResolver:i.pathResolver,passedMessage:i.passedMessage??void 0,failedMessage:i.failedMessage??void 0,rule:t.type==="manual"?void 0:p(i.expressions),warning:i.warning??!1,filter:s.filter||s.keyValueFilter?m(s.filter,s.keyValueFilter):void 0,exclude:s.excludeFilter||s.excludeKeyValueFilter?m(s.excludeFilter,s.excludeKeyValueFilter):void 0,applicable:t.type!=="manual"&&(s.applicabilityExpressions?.conditions?.length||s.applicabilityExpressions?.expressions?.length)?p(s.applicabilityExpressions):void 0,notApplicableMessage:s.notApplicableMessage&&t.type!=="manual"&&s.applicabilityExpressions?.conditions?.length?s.notApplicableMessage:void 0,schedule:w(o.schedule,s.filter),type:t.type}},c=(e,r="$")=>{const t=[];if(e.type==="object"&&e.properties){const i=e.properties;for(const s in i)if(i.hasOwnProperty(s)){const o=`${r}.${s}`;t.push(o);const a=i[s];t.push(...c(a,o))}}if(e.type==="array"&&e.items){const i=`${r}[*]`;t.push(i);const s=Array.isArray(e.items)?e.items:[e.items];for(const o of s)t.push(...c(o,i))}if(e.oneOf){const i=Array.isArray(e.oneOf)?e.oneOf:[e.oneOf];for(const s of i)t.push(...c(s,r))}if(e.allOf){const i=Array.isArray(e.allOf)?e.allOf:[e.allOf];for(const s of i)t.push(...c(s,r))}return[...new Set(t)]},q={detailsStep:{name:"",description:"",ownerEntityRef:"",type:"default"},rulesStep:{pathResolver:"jsonpath",expressions:{expressionType:l.AllOf,expressions:void 0,conditions:[{factRef:"",path:"",operator:"",operatorPrefix:"",value:"",conditions:[]}]},warning:!1},filtersStep:{filter:v(),keyValueFilter:b(),excludeFilter:v(),excludeKeyValueFilter:b()},scheduleStep:{schedule:O()}},K={details:{name:{name:"Check name",helperText:`Max ${P} characters`,placeholder:"Name your check (e.g., 'Code Coverage\u2019)"},description:{name:"Check description",placeholder:"Describe your check clearly so others understand its purpose. e.g., 'Ensure code coverage meets the minimum threshold.'"},owner:{name:"Check owner",selectLabel:"Assign an owner"},type:{name:"Check Type",selectLabel:"Choose the type of check."}},rulesStep:{rules:{name:"Check rules",description:"Define the rules the check will verify."},messages:{name:"Pass/Fail messages (Optional)",description:"Add the messages for check success and failure.",passMessagePlaceholder:"Enter pass message...",failMessagePlaceholder:"Enter fail message...",passedTabName:"Passed Message",failedTabName:"Failed Message"},warnings:{name:"Enable warnings",description:"Enable to classify failures as warnings, so they don\u2019t impact certification.",label:"Warning"}},filter:{description:`Use the filters below to narrow the scope of the Check. Only Entities that match the selected include and exclude filters will be applicable to the Check. Exclude filters must be used with with an include filter.
|
|
2
|
+
For example, selecting an include filter of 'Kind' as 'Component' and an exclude filter of 'Type' as 'Service' will select all entities with kind Component where type is NOT Service.`},schedule:{description:"Checks are automatically triggered whenever a dependent fact is updated. When collectors are scheduled, there is generally no need to schedule checks.",checkboxLabel:"Schedule check"}};export{K as CHECK_FIELDS,q as DEFAULT_FORM_VALUES,c as generateJsonPaths,V as mapCheckerToFormValues,p as mapExpressionToRule,E as mapInputScheduleToSchedule,f as mapRuleToExpression,w as mapScheduleToInputSchedule,N as mapToCheckerInput};
|
|
3
3
|
//# sourceMappingURL=checkFormUtils.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{CheckMessagingSchema as
|
|
1
|
+
import{CheckMessagingSchema as f,DefaultCheckDetailsSchema as u,ManualCheckDetailsSchema as d,parseFactRef as h}from"@spotify/backstage-plugin-soundcheck-common";import{isEmpty as a}from"lodash";import{z as e}from"zod";import{baseFiltersSchema as b,refineFilters as g,ensureNoConflictingFilters as y,CONFLICTING_FILTER_ERROR_MESSAGE as S,FrequencySchema as R}from"../../../utils/validation.esm.js";import{ExpressionType as r}from"../types/ExpressionType.esm.js";import"../../Frequency/types.esm.js";import"../../Frequency/util.esm.js";import"../../Frequency/FrequencyComponent.esm.js";import"../types/Path.esm.js";const n=t=>{try{return h(t),!0}catch{return"Invalid fact reference. [source]:[scope]/[name]."}},O=100,o=async t=>{if(!await n(t))throw new Error("Fact reference validation failed");return t},s=e.union([e.string().min(1,"Required"),e.number(),e.boolean()]),c=e.lazy(()=>e.strictObject({factRef:e.string().refine(o,{message:"Valid format: [source]:[scope]/[name]"}),path:e.string().min(1,"Required"),operator:e.string().min(1,"Required"),operatorPrefix:e.string().optional().nullable(),value:s.or(e.array(s).min(1,"Required")).or(e.strictObject({factRef:e.string().refine(o,{message:"Valid format: [source]:[scope]/[name]"}),path:e.string().min(1,"Required")})),conditions:e.array(c).optional()})),i=e.lazy(()=>e.strictObject({expressionType:e.enum([r.AllOf,r.AnyOf,r.Not]).optional(),expressions:e.array(i).optional(),conditions:e.array(c).optional()}).refine(({expressions:t,conditions:m})=>!a(t)||!a(m),"Must contain either a condition or an expression.")),F=e.strictObject({expressions:i,pathResolver:e.string().optional()}).merge(f),l=e.lazy(()=>e.strictObject({applicabilityExpressions:i.optional(),notApplicableMessage:e.string().optional()}).merge(b).refine(g,"Cannot have an exclude filter without an include filter.").refine(y,S)),C=e.strictObject({enabled:e.boolean(),frequency:R}),p=e.strictObject({schedule:C.optional()}),E=e.strictObject({detailsStep:u,rulesStep:F,filtersStep:l,scheduleStep:p}),x=e.strictObject({detailsStep:d,rulesStep:e.any(),filtersStep:l,scheduleStep:p});export{O as CHECK_NAME_MAX_LENGTH,E as defaultCheckFormSchema,x as manualCheckFormSchema,n as validateFactRef};
|
|
2
2
|
//# sourceMappingURL=validation.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{withStyles as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{withStyles as p,Tooltip as n}from"@material-ui/core";import s from"@material-ui/icons/Check";import d from"@material-ui/icons/Close";import f from"@material-ui/icons/HelpOutline";import x from"@material-ui/icons/NotInterested";import c from"@material-ui/icons/RemoveCircleOutline";import h from"@material-ui/icons/ReportProblemOutlined";import{ResultState as a}from"../../graphql/generated/index.esm.js";import{resultToText as r}from"../../text.esm.js";const u=p(o=>({root:{color:o.palette.success.main}}))(s),b=p(o=>({root:{color:o.palette.error.main}}))(d),N=p(o=>({root:{color:o.palette.warning.main}}))(h),T=p(o=>({root:{color:o.palette.text.primary}}))(f),g=p(o=>({root:{color:o.palette.text.disabled}}))(c),I=p(o=>({root:{color:o.palette.text.disabled}}))(x),R=p(o=>({root:{color:o.palette.error.main}}))(c),i=({icon:o,tooltip:m})=>t(n,{title:m,children:o}),w=({result:o,className:m,tooltip:l=!0})=>{const e={className:m,"aria-label":r(o),"aria-hidden":!1};return o===a.Passed?t(i,{icon:t(u,{...e}),tooltip:l?r(o):""}):o===a.NotReported?t(i,{icon:t(T,{...e}),tooltip:l?r(o):""}):o===a.Failed?t(i,{icon:t(b,{...e}),tooltip:l?r(o):""}):o===a.Warning?t(i,{icon:t(N,{...e}),tooltip:l?r(o):""}):o===a.NotApplicable?t(i,{icon:t(g,{...e}),tooltip:l?r(o):""}):o===a.Exempt?t(i,{icon:t(I,{...e}),tooltip:l?r(o):""}):o===a.Error?t(i,{icon:t(R,{...e}),tooltip:l?r(o):""}):null};export{w as CheckIcon,i as IconWithTooltip};
|
|
2
2
|
//# sourceMappingURL=CheckIcon.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as p}from"react/jsx-runtime";import{stringifyEntityRef as x}from"@backstage/catalog-model";import{Table as R}from"@backstage/core-components";import{makeStyles as v}from"@material-ui/core";import z from"lodash";import{useState as L,useEffect as B,useCallback as d}from"react";import{CheckEntityField as r,Direction as f}from"../../../graphql/generated/index.esm.js";import{useEntitiesByRefs as T}from"../../../hooks/catalog/useEntitiesByRefs.esm.js";import{useCheckEntities as
|
|
1
|
+
import{jsx as p}from"react/jsx-runtime";import{stringifyEntityRef as x}from"@backstage/catalog-model";import{Table as R}from"@backstage/core-components";import{makeStyles as v}from"@material-ui/core";import z from"lodash";import{useState as L,useEffect as B,useCallback as d}from"react";import{CheckEntityField as r,Direction as f}from"../../../graphql/generated/index.esm.js";import{useEntitiesByRefs as T}from"../../../hooks/catalog/useEntitiesByRefs.esm.js";import{useCheckEntities as N}from"../../../hooks/entities/useCheckEntities.esm.js";import{toResultState as m}from"../utils.esm.js";import{columnFactories as n}from"./columns.esm.js";import{toCheckEntityRow as D}from"./utils.esm.js";const O=10,P=["kind","metadata.name","metadata.namespace","spec.profile.displayName","metadata.title","relations","spec.lifecycle","spec.type"],F=[n.createStateColumn(),n.createNameColumn(),n.createSystemColumn(),n.createOwnerColumn(),n.createSpecTypeColumn(),n.createSpecLifecycleColumn()],A=[r.State,r.Name,r.System,r.Owner,r.Type,r.Lifecycle],j=v({tableContainer:{display:"flex",flexDirection:"column",width:"100%",overflowX:"auto","& table":{boxSizing:"border-box","& th:first-child, & td:first-child":{paddingLeft:"6px"},"& th:last-child, & td:last-child":{paddingRight:"6px !important"}}}}),Q=({checkId:g,trackId:u,filter:s,states:c})=>{const h=j(),[e,l]=L({orderBy:void 0,filter:s,states:c?.map(m).filter(t=>t!==void 0),pageInfo:{page:0,pageSize:O,direction:"forward",cursor:null}});B(()=>{l(t=>({...t,pageInfo:{...t.pageInfo,page:0,cursor:null},filter:s,states:c?.map(m).filter(i=>i!==void 0)}))},[s,c]);const{data:a,isLoading:y}=N({checkId:g,trackId:u,orderBy:e.orderBy,filter:e.filter,states:e.states?.length?e.states:void 0,[e.pageInfo.direction==="forward"?"first":"last"]:e.pageInfo.pageSize,[e.pageInfo.direction==="forward"?"after":"before"]:e.pageInfo.cursor}),C=d((t,i)=>{let o;t===-1?o=void 0:o={field:A[t],direction:i==="asc"?f.Asc:f.Desc},l({...e,orderBy:o,pageInfo:{...e.pageInfo,page:0,cursor:null}})},[e]),I=d((t,i)=>{const o=t>e.pageInfo.page?"forward":"backward",E=o==="forward"?a?.checkEntities.pageInfo.endCursor??null:a?.checkEntities.pageInfo.startCursor??null;l({...e,pageInfo:{page:t,pageSize:i,direction:o,cursor:E}})},[a,e]),k=a?.checkEntities.edges.map(t=>t.node.entityRef)??[],{data:S,isLoading:w}=T({entityRefs:k,fields:P}),b=z.compact(a?.checkEntities.edges.map(t=>{const i=S?.items.find(o=>!!o&&x(o)===t.node.entityRef);return i?D({checkDetails:t.node,entity:i}):void 0}))??[];return p("div",{className:h.tableContainer,children:p(R,{title:"Entities",style:{width:"100%",border:"none",margin:0},columns:F,data:b,options:{paging:!0,showFirstLastPageButtons:!1,paginationPosition:"bottom",emptyRowsWhenPaging:!0,pageSizeOptions:[10,25,50],pageSize:e.pageInfo.pageSize,search:!1,showTitle:!0,padding:"dense"},onOrderChange:C,onPageChange:I,page:e.pageInfo.page,totalCount:a?.checkEntities.totalCount??0,isLoading:y||w,components:{Toolbar:()=>null}})})};export{Q as CheckEntitiesTable};
|
|
2
2
|
//# sourceMappingURL=CheckEntitiesTable.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t,jsxs as f}from"react/jsx-runtime";import{useRouteRef as ie}from"@backstage/core-plugin-api";import{EntityRefLink as se}from"@backstage/plugin-catalog-react";import{usePermission as j}from"@backstage/plugin-permission-react";import{makeStyles as oe,useTheme as re,Button as ne,Typography as z,Tabs as ae,Tab as $,Box as M}from"@material-ui/core";import{soundcheckCheckReadPermission as le,soundcheckCheckUpdatePermission as ce,toEntityFilterQuery as A,combineEntityFilterQueries as de}from"@spotify/backstage-plugin-soundcheck-common";import v from"lodash/isEqual";import{useMemo as h,useState as x,useEffect as me,useCallback as Q}from"react";import{useSearchParams as pe,useParams as he,useNavigate as fe}from"react-router-dom";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import{useCheck as ue}from"../../hooks/checks/useCheck.esm.js";import"../../hooks/useSoundcheckAlert.esm.js";import{useTrack as ge}from"../../hooks/tracks/useTrack.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{useCheckStatus as ye}from"../../hooks/aggregations/useCheckStatus.esm.js";import{checkEditRouteRef as ke}from"../../routes.esm.js";import{CheckStatusBar as Ce}from"../CheckStatusBar/CheckStatusBar.esm.js";import{FilterSidebar as Se}from"../FilterSidebar/FilterSidebar.esm.js";import{StateFilter as xe}from"../FilterSidebar/StateFilter.esm.js";import{LoadingIndicator as we}from"../LoadingIndicator/LoadingIndicator.esm.js";import{PageWarningMessage as U}from"../PageWarningMessage/PageWarningMessage.esm.js";import"../SoundcheckHeader/SoundcheckHeader.esm.js";import"../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as ve}from"../SoundcheckHeader/useHeader.esm.js";import{SoundcheckMarkdownContent as Ee}from"../SoundcheckMarkdownContent/SoundcheckMarkdownContent.esm.js";import"@backstage/core-components";import"react-markdown";import"rehype-raw";import"remark-gfm";import{CheckEntitiesTable as be}from"./CheckEntitiesTable/CheckEntitiesTable.esm.js";import{CheckStatusHistoryChart as Ne}from"./CheckStatusHistoryChart.esm.js";import{CheckStatusTable as Ie}from"./CheckStatusTable.esm.js";import{ExemptionsTable as Re}from"./ExemptionsTable.esm.js";const Te=e=>{const{lifecycles:s,owners:c,types:l,systems:r}=e,n=s?.length?{"spec.lifecycle":s}:void 0,d=c?.length?{"relations.ownedBy":c}:void 0,m=l?.length?{"spec.type":l}:void 0,p=r?.length?{"relations.partOf":r}:void 0;if(n||d||m||p)return{...n,...d,...m,...p}};function Be(e,s){for(const c of e.levels)for(const l of c.checks)if(l.id===s)return l;return null}const Le=oe(e=>({root:{height:"100%"},pageContent:{display:"flex",minHeight:`calc(100vh - ${e.spacing(15)}px)`,borderTop:`1px solid ${e.palette.divider}`,height:"100%"},mainContentArea:{flex:1,display:"flex",flexDirection:"column",minWidth:0},editButton:{marginLeft:"auto"},statusContainer:{borderBottom:`1px solid ${e.palette.divider}`,padding:e.spacing(3,0,2,3)},statusCards:{display:"flex",gap:e.spacing(2)},currentStatusSection:{width:"325px",minWidth:"325px",flex:0,display:"flex",flexDirection:"column"},historicalStatusSection:{flex:1,flexShrink:1,flexGrow:1,flexBasis:"auto",minWidth:"150px",display:"flex",flexDirection:"column"},statusTitle:{fontWeight:"bold",fontSize:"1.1rem",lineHeight:`${e.typography.h5.fontSize}px`,cursor:"default",marginBottom:e.spacing(2)},headerDescription:{fontSize:e.typography.body2.fontSize,margin:e.spacing(.5,0,0),"& p":{margin:0},"& a":{color:"inherit",textDecoration:"underline"}},entitiesContainer:{padding:e.spacing(2,3,3,3)},ownerLink:{"& span":{color:"inherit","&:hover":{textDecoration:"underline"}}}})),Fe=()=>{const e=Le(),[s,c]=pe(),{trackId:l,checkId:r}=he(),n=h(()=>s.getAll("states"),[s]),d=h(()=>s.getAll("owners"),[s]),m=h(()=>s.getAll("lifecycles"),[s]),p=h(()=>s.getAll("types"),[s]),u=h(()=>s.getAll("systems"),[s]),[g,E]=x(m),[y,b]=x(d),[k,N]=x(p),[C,I]=x(u),[S,R]=x(n);me(()=>{b(d),E(m),N(p),I(u),R(n)},[d,m,p,u,n]);const G=h(()=>{const i={owners:!v(y,d),lifecycles:!v(g,m),types:!v(k,p),systems:!v(C,u),states:!v(S,n)};return Object.values(i).some(Boolean)},[y,d,g,m,k,p,C,u,S,n]),V=Q(()=>{const i=new URLSearchParams(s);i.delete("lifecycles"),i.delete("owners"),i.delete("types"),i.delete("systems"),i.delete("states"),g.length>0&&g.forEach(a=>i.append("lifecycles",a)),y.length>0&&y.forEach(a=>i.append("owners",a)),k.length>0&&k.forEach(a=>i.append("types",a)),C.length>0&&C.forEach(a=>i.append("systems",a)),S.length>0&&S.forEach(a=>i.append("states",a)),c(i)},[s,g,y,k,C,S,c]),J=Q(()=>{E([]),b([]),N([]),I([]),R([]);const i=new URLSearchParams(s);i.delete("lifecycles"),i.delete("owners"),i.delete("types"),i.delete("systems"),i.delete("states"),c(i)},[s,c]),T=Te({lifecycles:m,owners:d,types:p,systems:u}),{data:w,isLoading:K}=ge(l),{data:o,isLoading:B}=ue(r),{loading:X,allowed:Y}=j({permission:le,resourceRef:r}),{loading:D,allowed:P}=j({permission:ce,resourceRef:r}),H=fe(),O=ie(ke),Z=re();let L;if(r)if(w){const i=A(w.filter),a=A(Be(w,r)?.filter);L=de(i,a)}else o&&(L=A(o.filter));const{data:W}=ye({checkId:r,trackId:l,filter:T,states:n?.length?n:void 0},!!r),_=h(()=>o?.ownerEntityRef?t(se,{color:"inherit",entityRef:o.ownerEntityRef,className:e.ownerLink}):null,[o?.ownerEntityRef,e.ownerLink]),q=h(()=>!D&&P&&o?.isEditable?t(ne,{className:e.editButton,variant:"contained",color:"primary",onClick:()=>{H(O({checkId:o.id}))},children:"Edit Check"}):null,[P,o?.id,o?.isEditable,e.editButton,O,D,H]),ee=h(()=>o?.description?t(Ee,{className:e.headerDescription,content:o.description}):null,[e.headerDescription,o?.description]);ve({title:o?.name??r??"Soundcheck",description:ee,customSubtitle:_,sectionRight:q});const[F,te]=x(0);return f("div",{children:[t(U,{entityName:"track",entityId:l,showNotFound:!!l&&!K&&!w}),t(U,{entityName:"check",entityId:r,showNotFound:!B&&!o,showCannotView:!!o&&!X&&!Y}),B&&t(we,{}),!B&&!!o&&t("div",{className:e.root,children:f("div",{className:e.pageContent,children:[t(Se,{trackFilter:L,stagedTypes:k,stagedLifecycles:g,stagedOwners:y,stagedSystems:C,onTypesChange:N,onLifecyclesChange:E,onOwnersChange:b,onSystemsChange:I,onApplyFilters:V,onClearFilters:J,hasFilterChanges:G,children:t(xe,{states:n,stagedStates:S,onStagedStatesChange:R})}),f("div",{className:e.mainContentArea,children:[t("div",{className:e.statusContainer,children:f("div",{className:e.statusCards,children:[f("div",{className:e.currentStatusSection,children:[t(z,{className:e.statusTitle,children:"Current Status"}),t("div",{style:{width:"100%",height:30,display:"flex",alignItems:"flex-start",marginBottom:Z.spacing(2)},children:t(Ce,{status:W})}),t("div",{children:t(Ie,{checkStatus:W})})]}),f("div",{className:e.historicalStatusSection,children:[t(z,{className:e.statusTitle,children:"Historical Status"}),t("div",{style:{height:"100%"},children:t(Ne,{checkId:r,trackId:l,filter:T,states:n})})]})]})}),f("div",{className:e.entitiesContainer,children:[f(ae,{value:F,onChange:(i,a)=>te(a),indicatorColor:"primary",textColor:"primary","aria-label":"Entities and Exemptions Tabs",children:[t($,{label:"Entities"}),t($,{label:"Exemptions"})]}),t(M,{hidden:F!==0,children:t(be,{checkId:r,trackId:w?.id,filter:T,states:n})}),t(M,{hidden:F!==1,children:t(Re,{checkId:r})})]})]})]})})]})};export{Fe as CheckInsightsPage};
|
|
2
2
|
//# sourceMappingURL=CheckInsightsPage.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{EmptyState as S}from"@backstage/core-components";import{EntityRefLink as w}from"@backstage/plugin-catalog-react";import{makeStyles as j,CircularProgress as W,Typography as B,Table as E,TableHead as I,TableRow as b,TableCell as o,TableBody as R,Tooltip as D,TablePagination as L}from"@material-ui/core";import{useState as d}from"react";import{useExemptions as O}from"../../hooks/exemptions/useExemptions.esm.js";const _=10,F=j(i=>({justificationCell:{maxWidth:600,minWidth:200,flex:2,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",whiteSpace:"pre-line",wordBreak:"break-word"},emptyStateWrapper:{padding:i.spacing(2)}}));function H(i){if(!i)return"";const a=!isNaN(i)&&!isNaN(parseFloat(i));let r;return a&&String(i).length>=10?r=new Date(Number(i)):r=new Date(i),isNaN(r.getTime())?String(i):r.toLocaleDateString()}const $=({checkId:i})=>{const a=F(),[r,h]=d(0),[f,x]=d(_),[g,c]=d("forward"),[y,p]=d(void 0),{data:m,isLoading:P,error:v}=O(i,{first:g==="forward"?f:void 0,after:g==="forward"?y:void 0}),k=m?.totalCount??0,u=m?.edges??[],n=m?.pageInfo,N=(s,t)=>{t>r?(c("forward"),p(n?.endCursor??void 0)):t<r&&(c("backward"),p(n?.startCursor??void 0)),h(t)},C=s=>{x(parseInt(s.target.value,10)),h(0),p(void 0),c("forward")};return P?e(W,{}):v?e(B,{color:"error",children:"Failed to load exemptions."}):u.length?l("div",{children:[l(E,{children:[e(I,{children:l(b,{children:[e(o,{children:"Entity"}),e(o,{className:a.justificationCell,children:"Justification"}),e(o,{children:"User"}),e(o,{children:"Date"})]})}),e(R,{children:u.map(s=>{const t=s.node,T=H(t.timestamp);return l(b,{children:[e(o,{children:e(w,{entityRef:t.entity_ref})}),e(o,{className:a.justificationCell,children:e(D,{title:t.justification,placement:"top-start",arrow:!0,children:e("span",{children:t.justification})})}),e(o,{children:e(w,{entityRef:t.user_ref})}),e(o,{children:T})]},`${t.entity_ref}-${t.check_id}`)})})]}),e(L,{component:"div",count:k,page:r,onPageChange:N,rowsPerPage:f,onRowsPerPageChange:C,rowsPerPageOptions:[10,25,50],nextIconButtonProps:{disabled:!n?.hasNextPage},backIconButtonProps:{disabled:!n?.hasPreviousPage||r===0}})]}):e("div",{className:a.emptyStateWrapper,children:e(S,{title:"No exemptions found",description:"There are no exemptions for this check.",missing:"data"})})};export{$ as ExemptionsTable};
|
|
2
|
+
//# sourceMappingURL=ExemptionsTable.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as c,jsx as r}from"react/jsx-runtime";import{Content as p}from"@backstage/core-components";import{usePermission as f}from"@backstage/plugin-permission-react";import{soundcheckCollectorUpdatePermission as g}from"@spotify/backstage-plugin-soundcheck-common";import{useParams as u}from"react-router-dom";import{useGetCollectors as C}from"../../hooks/collectors/useGetCollectors.esm.js";import{LoadingIndicator as I}from"../LoadingIndicator/LoadingIndicator.esm.js";import{PageWarningMessage as P}from"../PageWarningMessage/PageWarningMessage.esm.js";import{Configurator as h}from"./Configurators/Configurator.esm.js";const w=({collectorId:n})=>{const s=u(),e=n??s.integrationId,{data:m,isLoading:a}=C([e??""]),{loading:d,allowed:l}=f({permission:g}),o=m?.[0],t=a||d,i=l&&o?.isEditable;return c(p,{children:[t&&r(I,{}),r(P,{entityName:"Integration",entityId:e,showNotFound:!t&&!o,showCannotEdit:!t&&!i}),o&&i&&r(h,{selectedCollector:o})]})};export{w as CollectorPage};
|
|
2
2
|
//# sourceMappingURL=CollectorPage.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as c,jsx as l,Fragment as K}from"react/jsx-runtime";import{makeStyles as w,FormControlLabel as G,Checkbox as
|
|
1
|
+
import{jsxs as c,jsx as l,Fragment as K}from"react/jsx-runtime";import{makeStyles as w,FormControlLabel as G,Checkbox as P,Box as q,Typography as F,Divider as L,Tabs as O,Tab as h,Grid as f,Button as x}from"@material-ui/core";import W from"@material-ui/icons/Add";import E from"@material-ui/icons/Remove";import{useState as H}from"react";import{useFormContext as J,useFieldArray as M,useWatch as Q,Controller as y}from"react-hook-form";import{validateCacheConfig as U}from"../../../../utils/collectors.esm.js";import"lodash";import"../../../Frequency/types.esm.js";import"../../../Frequency/util.esm.js";import"../../../Frequency/FrequencyComponent.esm.js";import{CacheConfigComponent as X}from"../../../CacheConfig/CacheConfigComponent.esm.js";import"@backstage/catalog-model";import"@spotify/backstage-plugin-soundcheck-common";import{FilterComponent as Y}from"../../../Filter/FilterComponent.esm.js";import{CollectorSchedulingOptions as Z}from"./CollectorSchedulingOptions.esm.js";const _=w(e=>({root:{padding:e.spacing(1.5,6)},tabsContainer:{marginRight:16},tab:{height:"64px",textAlign:"left"},contentContainer:{width:"100%",padding:e.spacing(1)},divider:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},checkBox:{marginRight:e.spacing(1)},buttonsContainer:{marginTop:e.spacing(1),marginBottom:e.spacing(2)}})),g="FactDetails",u="Schedule",N="Filters",k="Caching",ee=({name:e,label:C,description:S,disabled:s,FactDetailsComponent:d,multipleCollectors:i})=>{const{control:m,formState:D}=J(),$=D.errors?.[e],{fields:B,insert:V,remove:A}=M({control:m,name:i?.enable?`${e}.collectors`:e}),p=i?.enable?B:[{id:e}],v=d?g:u,[t,b]=H(Array(p.length).fill(v)),T=(r,a,n)=>{b([...t.slice(0,n),a,...t.slice(n+1)])},R=r=>{V(r+1,i?.defaultConfig),b([...t.slice(0,r+1),v,...t.slice(r+1)])},j=r=>{A(r),b([...t.slice(0,r),...t.slice(r+1)])},z=Q({control:m,name:`${e}.enabled`}),o=_();return c("div",{className:o.root,children:[l(y,{name:`${e}.enabled`,control:m,render:({field:r})=>l(G,{control:l(P,{...r,checked:r.value,"data-testid":`${e}-switch`,disabled:s,className:o.checkBox}),label:c(q,{display:"flex",flexDirection:"column",children:[l(F,{variant:"body1",component:"span",children:l("b",{children:`${C}`})}),l(F,{variant:"caption",color:"textSecondary",component:"p",children:`${S}`})]})})}),z&&l("div",{children:p.map((r,a)=>c("div",{children:[a!==0&&l(L,{className:o.divider}),c(O,{orientation:"horizontal",variant:"scrollable",value:t[a],onChange:(n,I)=>T(n,I,a),className:o.tabsContainer,children:[d&&l(h,{label:"Fact Details",value:g,className:o.tab}),l(h,{label:"Schedule",value:u,className:o.tab}),l(h,{label:"Filters",value:N,className:o.tab}),l(h,{label:"Caching",value:k,className:o.tab})]}),c("div",{className:o.contentContainer,children:[t[a]===g&&d&&l(d,{name:i?.enable?`${e}.collectors.${a}.factDetails`:`${e}.factDetails`,disabled:s}),t[a]===u&&l(K,{children:l(Z,{name:i?.enable?`${e}.collectors.${a}`:e})}),t[a]===N&&l(Y,{disabled:s,filterName:i?.enable?`${e}.collectors.${a}.filters.filter`:`${e}.filters.filter`,errorPath:i?.enable?`${e}.collectors.${a}.filters`:`${e}.filters`,keyValueFilterName:i?.enable?`${e}.collectors.${a}.filters.keyValueFilter`:`${e}.filters.keyValueFilter`,excludeFilterName:i?.enable?`${e}.collectors.${a}.filters.excludeFilter`:`${e}.filters.excludeFilter`,excludeKeyValueFilterName:i?.enable?`${e}.collectors.${a}.filters.excludeKeyValueFilter`:`${e}.filters.excludeKeyValueFilter`}),t[a]===k&&l(y,{name:i?.enable?`${e}.collectors.${a}.cacheConfig`:`${e}.cacheConfig`,control:m,rules:{validate:U},render:({field:n})=>l(X,{disabled:s,value:n.value,onChange:n.onChange,errors:i?.enable?$?.collectors?.[a]?.cacheConfig:$?.cacheConfig})})]}),i?.enable&&c(f,{container:!0,spacing:1,className:o.buttonsContainer,children:[p.length>1&&l(f,{item:!0,children:l(x,{startIcon:l(E,{}),onClick:()=>j(a),disabled:s,variant:"outlined",size:"small",color:"secondary",children:"Remove"})}),l(f,{item:!0,children:c(x,{startIcon:l(W,{}),onClick:()=>R(a),disabled:s,variant:"outlined",size:"small",color:"primary",children:["Add ",C]})})]})]},r.id))})]})};export{ee as FactCollectionConfig};
|
|
2
2
|
//# sourceMappingURL=FactCollectionConfig.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as b,jsx as o}from"react/jsx-runtime";import{makeStyles as x,Box as c,Chip as g,TextField as T,FormControlLabel as C,Checkbox as S}from"@material-ui/core";import
|
|
1
|
+
import{jsxs as b,jsx as o}from"react/jsx-runtime";import{makeStyles as x,Box as c,Chip as g,TextField as T,FormControlLabel as C,Checkbox as S}from"@material-ui/core";import v from"@material-ui/icons/CheckBox";import N from"@material-ui/icons/CheckBoxOutlineBlank";import{Autocomplete as k}from"@material-ui/lab";import{useState as I,useEffect as L}from"react";import{ListboxVirtualized as z}from"../../../ListboxVirtualized/ListboxVirtualized.esm.js";import{HTTP_STATUSES as p}from"./utils.esm.js";const H=x(a=>({statusInput:{marginTop:0},statusChips:{marginBottom:a.spacing(1)},helperText:{marginLeft:0}})),j=({value:a,onChange:i,disabled:r,errors:m,helperText:d})=>{const n=H(),[s,u]=I(a??[]);L(()=>{i&&i(s.map(e=>Number(e)))},[s,i]);const f=(e,t)=>{u(s?.filter(l=>l!==t))},h=(e,t)=>{const l=t.length?t[t.length-1]:void 0;l&&isNaN(Number(l))||u(t)};return b(c,{children:[o(c,{children:s.map(e=>o(g,{label:e,size:"small",className:n.statusChips,onDelete:t=>f(t,e),clickable:!1,disabled:r},e))}),o(k,{disableCloseOnSelect:!0,fullWidth:!0,multiple:!0,freeSolo:!0,popupIcon:null,renderTags:()=>null,disabled:r,options:p.map(e=>e.value),getOptionLabel:e=>p.find(t=>t.value===e)?.label??"",value:s,onChange:(e,t)=>h(e,t),ListboxComponent:z,ListboxProps:{itemHeight:40},renderInput:e=>o(T,{...e,variant:"outlined",margin:"dense",className:n.statusInput,placeholder:"Example: 500",disabled:r,error:!!m,helperText:m?.message??d,FormHelperTextProps:{className:n.helperText}}),renderOption:(e,{selected:t})=>o(C,{onClick:l=>l.preventDefault(),control:o(S,{icon:o(N,{fontSize:"small"}),checkedIcon:o(v,{fontSize:"small"}),checked:t,disabled:r}),label:p.find(l=>l.value===e)?.label??""})})]})};export{j as HttpStatusesInput};
|
|
2
2
|
//# sourceMappingURL=HttpStatusesInput.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as m,Fragment as y,jsx as o}from"react/jsx-runtime";import{zodResolver as b}from"@hookform/resolvers/zod";import{makeStyles as D,Paper as S,Divider as c}from"@material-ui/core";import{useForm as h,FormProvider as P}from"react-hook-form";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"react";import"../../../../hooks/useSoundcheckAlert.esm.js";import{useConfirmationModal as T}from"../../../../hooks/useConfirmationModal.esm.js";import{useNavigateBack as L}from"../../../../hooks/useNavigateBack.esm.js";import{useUpdateCollectorConfig as E}from"../../../../hooks/collectors/useUpdateCollectorConfig.esm.js";import{integrationsPageRouteRef as w}from"../../../../routes.esm.js";import{FooterButtons as F}from"../../../FooterButtons/FooterButtons.esm.js";import"../../../SoundcheckHeader/SoundcheckHeader.esm.js";import"../../../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as R}from"../../../SoundcheckHeader/useHeader.esm.js";import{FactCollectionConfig as r}from"../Common/FactCollectionConfig.esm.js";import{collectorHeaderContent as N,confirmationModalContent as I}from"../Common/utils.esm.js";import{IncidentsFactDetailsComponent as O}from"./IncidentsFactDetailsComponent.esm.js";import{mapConfigToPagerDutyCollectorConfig as _,defaultPagerDutyConfig as k,SERVICE_COLLECTOR_TYPE as x,STANDARDS_COLLECTOR_TYPE as B,INCIDENTS_COLLECTOR_TYPE as A,incidentsCollectorConfig as M,mapPagerDutyCollectorConfigToConfig as Y}from"./utils.esm.js";import{pagerDutyCollectorFormSchema as j}from"./validation.esm.js";const H=D(e=>({spacer:{height:e.spacing(8),width:"100%"},section:{marginBottom:e.spacing(2)}})),V=({disabled:e,selectedCollector:t})=>{const a=h({defaultValues:t?_(t.config):k(),mode:"onChange",resolver:b(j)}),{formState:{errors:i},handleSubmit:n}=a,s=H(),d=!!i.service||!!i.standards||!!i.incidents,{mutateAsync:p}=E(),[C,f]=L(w),{showModal:g}=T(),l=async u=>{if(!await g(I(t)))return;const v=Y(u);await p({collectorId:t.id,config:v})&&f()};return R(N(t)),m(y,{children:[o(S,{className:s.section,children:o(P,{...a,children:m("form",{onSubmit:n(l),children:[o(r,{name:x.toLowerCase(),label:"Service",description:"Collects details about PagerDuty service linked to an entity.",disabled:e}),o(c,{}),o(r,{name:B.toLowerCase(),label:"Standards",description:"Collects details about standards applied to a PagerDuty service linked to an entity.",disabled:e}),o(c,{}),o(r,{name:A.toLowerCase(),label:"Incidents",description:"Collects details about incidents associated with a PagerDuty service linked to an entity.",disabled:e,FactDetailsComponent:O,multipleCollectors:{enable:!0,defaultConfig:M()}})]})})}),o("div",{className:s.section,children:o(F,{onCancel:C,saveButtonText:"Save",isLoading:!1,onSave:n(l),disableSave:d})})]})};export{V as PagerDutyConfigurator};
|
|
1
|
+
import{jsxs as m,Fragment as y,jsx as o}from"react/jsx-runtime";import{zodResolver as b}from"@hookform/resolvers/zod";import{makeStyles as D,Paper as S,Divider as c}from"@material-ui/core";import{useForm as h,FormProvider as P}from"react-hook-form";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"react";import"../../../../hooks/useSoundcheckAlert.esm.js";import{useConfirmationModal as T}from"../../../../hooks/useConfirmationModal.esm.js";import{useNavigateBack as L}from"../../../../hooks/useNavigateBack.esm.js";import{useUpdateCollectorConfig as E}from"../../../../hooks/collectors/useUpdateCollectorConfig.esm.js";import{integrationsPageRouteRef as w}from"../../../../routes.esm.js";import{FooterButtons as F}from"../../../FooterButtons/FooterButtons.esm.js";import"../../../SoundcheckHeader/SoundcheckHeader.esm.js";import"../../../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as R}from"../../../SoundcheckHeader/useHeader.esm.js";import{FactCollectionConfig as r}from"../Common/FactCollectionConfig.esm.js";import{collectorHeaderContent as N,confirmationModalContent as I}from"../Common/utils.esm.js";import{IncidentsFactDetailsComponent as O}from"./IncidentsFactDetailsComponent.esm.js";import{mapConfigToPagerDutyCollectorConfig as _,defaultPagerDutyConfig as k,SERVICE_COLLECTOR_TYPE as x,STANDARDS_COLLECTOR_TYPE as B,INCIDENTS_COLLECTOR_TYPE as A,incidentsCollectorConfig as M,mapPagerDutyCollectorConfigToConfig as Y}from"./utils.esm.js";import{pagerDutyCollectorFormSchema as j}from"./validation.esm.js";const H=D(e=>({spacer:{height:e.spacing(8),width:"100%"},section:{marginBottom:e.spacing(2)}})),V=({disabled:e,selectedCollector:t})=>{const a=h({defaultValues:t?_(t.config):k(),mode:"onChange",resolver:b(j)}),{formState:{errors:i},handleSubmit:n}=a,s=H(),d=!!i.service||!!i.standards||!!i.incidents,{mutateAsync:p}=E(),[C,f]=L(w),{showModal:g}=T(),l=async u=>{if(!await g(I(t)))return;const v=Y(u);await p({collectorId:t.id,config:v})&&f()};return R(N(t)),m(y,{children:[o(S,{className:s.section,children:o(P,{...a,children:m("form",{onSubmit:n(l),children:[o(r,{name:x.toLowerCase(),label:"Service",description:"Collects details about PagerDuty service linked to an entity.",disabled:e}),o(c,{}),o(r,{name:B.toLowerCase(),label:"Standards",description:"Collects details about standards applied to a PagerDuty service linked to an entity.",disabled:e}),o(c,{}),o(r,{name:A.toLowerCase(),label:"Incidents",description:"Collects details about incidents associated with a PagerDuty service linked to an entity.",disabled:e,FactDetailsComponent:O,multipleCollectors:{enable:!0,defaultConfig:M(t.config)}})]})})}),o("div",{className:s.section,children:o(F,{onCancel:C,saveButtonText:"Save",isLoading:!1,onSave:n(l),disableSave:d})})]})};export{V as PagerDutyConfigurator};
|
|
2
2
|
//# sourceMappingURL=PagerDutyConfigurator.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{asArray as E}from"@spotify/backstage-plugin-soundcheck-common";import{defaultBaseCollectorOption as D,defaultCollectorOption as p}from"../Common/CollectorOption.esm.js";import{mapBackendConfigToFormIntegrationConfig as r,mapFormIntegrationConfigToBackendConfig as d}from"../Common/utils.esm.js";const f="Service",g="Standards",l="Incidents",C={triggered:!0,acknowledged:!0,resolved:!0},y={factDetails:{factName:{name:"Fact Name",helperText:"Fact name must be unique",placeholder:"Fact Name"},statuses:{name:"Statuses",description:"Return only incidents with the given statuses",helperText:"Select at least one status"}}},m=(a,
|
|
1
|
+
import{asArray as E}from"@spotify/backstage-plugin-soundcheck-common";import{defaultBaseCollectorOption as D,defaultCollectorOption as p}from"../Common/CollectorOption.esm.js";import{mapBackendConfigToFormIntegrationConfig as r,mapFormIntegrationConfigToBackendConfig as d}from"../Common/utils.esm.js";const f="Service",g="Standards",l="Incidents",C={triggered:!0,acknowledged:!0,resolved:!0},y={factDetails:{factName:{name:"Fact Name",helperText:"Fact name must be unique",placeholder:"Fact Name"},statuses:{name:"Statuses",description:"Return only incidents with the given statuses",helperText:"Select at least one status"}}},m=(t,a,n)=>({...D(t),factDetails:{factName:a??"",statuses:{triggered:n?.triggered??!1,acknowledged:n?.acknowledged??!1,resolved:n?.resolved??!1}}}),T=t=>({service:p(t),standards:p(t),incidents:{enabled:!1,collectors:[m(t,l.toLowerCase(),C)]}});function O(t){const{service:a,standards:n,incidents:s}=t;if(a.enabled||n.enabled||s.enabled){const c={},o=[];return c.collects=o,a.enabled&&o.push(d({factType:f,configOption:a})),n.enabled&&o.push(d({factType:g,configOption:n})),s.enabled&&s.collectors.forEach(i=>{o.push(d({factType:l,configOption:i,additionalParams:{factName:i.factDetails.factName,statuses:Object.entries(i.factDetails.statuses).filter(([e,u])=>u).map(([e,u])=>e)}}))}),c}return{collects:[]}}function h(t){const a=T(t);if(t){const n=t.collects;if(n){const s=E(n),c=s.find(e=>e.type===f);c&&(a.service={...r({parentConfig:t,factTypeConfig:c}),enabled:!0});const o=s.find(e=>e.type===g);o&&(a.standards={...r({parentConfig:t,factTypeConfig:o}),enabled:!0});const i=s.filter(e=>e.type===l);i.length&&(a.incidents={enabled:!0,collectors:i.map(e=>({...r({parentConfig:t,factTypeConfig:e}),factDetails:{factName:e.factName??l,statuses:{triggered:e.statuses?.length?e.statuses.includes("triggered"):!0,acknowledged:e.statuses?.length?e.statuses.includes("acknowledged"):!0,resolved:e.statuses?.length?e.statuses.includes("resolved"):!0}}}))})}}return a}export{C as DEFAULT_INCIDENT_STATUSES,l as INCIDENTS_COLLECTOR_TYPE,y as PAGERDUTY_COLLECTOR_FIELDS,f as SERVICE_COLLECTOR_TYPE,g as STANDARDS_COLLECTOR_TYPE,T as defaultPagerDutyConfig,m as incidentsCollectorConfig,h as mapConfigToPagerDutyCollectorConfig,O as mapPagerDutyCollectorConfigToConfig};
|
|
2
2
|
//# sourceMappingURL=utils.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{Grid as r}from"@material-ui/core";import{useGetCollectors as c}from"../../../hooks/collectors/useGetCollectors.esm.js";import{CollectorListSkeleton as s}from"./CollectorListSkeleton.esm.js";import{CollectorSummaryCard as m}from"./CollectorSummaryCard.esm.js";const a=["github","gitlab","scm","pagerduty","datadog","kubernetes","jira","sonarqube","newrelic","bigquery","catalog","azure","http","data-registry"],u=({integrations:l})=>{const{data:d,isLoading:n}=c(),o=l?.map(e=>e.integrationId)??a;return t(r,{container:!0,direction:"row",children:t(r,{container:!0,spacing:4,role:"list","aria-label":"checks",children:n?t(s,{}):d?.filter(e=>e.isConfigurable)?.sort((e,i)=>!o.includes(e.id)&&o.includes(i.id)?1:o.includes(e.id)&&!o.includes(i.id)?-1:(e.name??e.id).localeCompare(i.name??i.id))?.map(e=>t(r,{xs:12,sm:12,md:6,lg:4,xl:3,item:!0,role:"listitem","aria-label":`collector card ${e.id}`,children:t(m,{collector:e,hasNoCodeUI:o.includes(e.id),routePath:l?.find(i=>i.integrationId===e.id)?.routePath})},e.id))})})};export{u as CollectorListPage,a as ConfigurableCollectorIds};
|
|
2
2
|
//# sourceMappingURL=CollectorListPage.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as i,jsx as e}from"react/jsx-runtime";import{useRouteRef as I}from"@backstage/core-plugin-api";import{usePermission as T}from"@backstage/plugin-permission-react";import{makeStyles as S,CardContent as u,CardHeader as U,Typography as d,Tooltip as D,Divider as H,CardActions as A,Button as B}from"@material-ui/core";import{soundcheckCollectorUpdatePermission as L}from"@spotify/backstage-plugin-soundcheck-common";import{useNavigate as P}from"react-router-dom";import{integrationDetailsRouteRef as R}from"../../../routes.esm.js";import{SoundcheckMarkdownContent as $}from"../../SoundcheckMarkdownContent/SoundcheckMarkdownContent.esm.js";import"@backstage/core-components";import"react";import"react-markdown";import"rehype-raw";import"remark-gfm";import{useSummaryCardStyles as j,Card as M}from"../../SummaryCard/SummaryCard.esm.js";import{hasLogo as Y,CollectorLogo as w}from"./CollectorLogo.esm.js";const z=S(t=>({cardContent:{flex:1,paddingTop:t.spacing(1)},logoHeader:{paddingBottom:0,flex:0},headerContent:{display:"flex",alignItems:"center",height:t.spacing(5),marginBottom:t.spacing(1.5)},headerTypography:{marginBottom:0},usageText:{marginTop:t.spacing(.5)},checkUsageHover:{textDecoration:"underline",textDecorationStyle:"dotted","&:hover":{cursor:"default"}}})),E=({collector:t,hasNoCodeUI:l,routePath:f})=>{const{description:y,id:a,isConfigurable:m,isEditable:p,name:C}=t,{loading:g,allowed:h}=T({permission:L}),v=P(),b=I(R),n=j(),o=z(),k=l&&m&&p&&!g&&h,x=()=>{v(f??b({integrationId:a}))};let r;g||!h?r="You don't have permissions to configure this integration.":m?p?l?t.hasUIConfig&&(r="Configured via UI."):r="Integration can only be configured through YAML.":r="Integration is already configured via YAML and cannot be configured through the UI.":r="Integration is not configurable.";const s=t?.dependentChecks?.length??0,c=C??a;return i(M,{"data-testid":a,className:n.card,children:[Y(a)?e(u,{className:o.logoHeader,children:e(w,{collectorId:a})}):e(U,{title:c,titleTypographyProps:{className:`${n.summaryName} ${o.headerTypography}`},classes:{content:o.headerContent}}),i(u,{className:o.cardContent,children:[e(d,{variant:"body1",component:"div",children:e($,{className:n.summaryDescription,content:y??""})}),e(d,{color:"textSecondary",variant:"body2",children:r}),s>0&&i(d,{className:o.usageText,color:"textSecondary",variant:"body2",children:[e(D,{title:t.dependentChecks?.map(N=>N.name).join(", ")??"",children:i("span",{className:o.checkUsageHover,children:[s," check",s>1?"s":""]})})," ","use facts from this integration."]})]}),k&&i("div",{children:[e(H,{}),e(A,{className:n.actionArea,children:e(B,{"aria-label":`${c}-edit`,"data-testid":`${c}-button`,size:"medium",role:"link",onClick:x,className:n.button,variant:"outlined",children:"Configure"})})]})]})};export{E as CollectorSummaryCard};
|
|
2
2
|
//# sourceMappingURL=CollectorSummaryCard.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{makeStyles as e}from"@material-ui/core";import"../SoundcheckHeader/SoundcheckHeader.esm.js";import"../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useSetHeaderDefault as i}from"../SoundcheckHeader/useHeader.esm.js";import{CollectorListPage as n}from"./CollectorListPage/CollectorListPage.esm.js";const a=e(o=>({container:{padding:o.spacing(3)}})),s=({integrations:o})=>{const r=a();return i(),t("div",{className:r.container,children:t(n,{integrations:o})})};export{s as CollectorsPage};
|
|
2
2
|
//# sourceMappingURL=CollectorsPage.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as T}from"react/jsx-runtime";import{makeStyles as F,FormControlLabel as O,Checkbox as z,Typography as A,Box as
|
|
1
|
+
import{jsx as e,jsxs as T}from"react/jsx-runtime";import{makeStyles as F,FormControlLabel as O,Checkbox as z,Typography as A,Box as j,TextField as w}from"@material-ui/core";import I from"@material-ui/icons/CheckBox";import B from"@material-ui/icons/CheckBoxOutlineBlank";import E from"@material-ui/icons/ExpandMore";import{Autocomplete as G}from"@material-ui/lab";import{useState as N,useMemo as m,useCallback as p}from"react";import{useGetEntityRefs as D}from"../../hooks/catalog/useGetEntityRefs.esm.js";import{FormFieldLabel as H}from"../FormFieldLabel/FormFieldLabel.esm.js";import{ListboxVirtualized as M}from"../ListboxVirtualized/ListboxVirtualized.esm.js";const P=F({container:{padding:0},formControl:{flexGrow:1},label:{lineHeight:"1em"}}),Q=({label:d,values:o,onChange:n,disabled:f,filter:g,renderOption:b,renderTags:h})=>{const i=P(),[C,a]=N(!1),{data:t,isLoading:u,error:k}=D(g),s=m(()=>o?.map(l=>l.toLocaleLowerCase("en-US"))??[],[o]),x=p((l,r)=>{n(r),t&&t.every(c=>r.includes(c))&&a(!1)},[t,n]),y=p(()=>{n(o?.length?o:void 0)},[o,n]),L=p((l,r)=>b?.(l,r)??e(O,{onClick:c=>c.preventDefault(),control:e(z,{icon:e(B,{fontSize:"small"}),checkedIcon:e(I,{fontSize:"small"}),checked:r.selected}),label:l,classes:{label:i.label}}),[b,i.label]),S=m(()=>f||u||!o?.length&&!t?.length,[f,u,o?.length,t?.length]),v=m(()=>Array.from(new Set([...t??[],...s])),[t,s]);return k?e(A,{color:"error",children:"Failed to load entities"}):T(j,{pb:1,pt:1,className:i.container,children:[e(H,{title:d,docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/filters"}),e(G,{open:C,onOpen:()=>a(!0),onClose:()=>a(!1),className:i.formControl,multiple:!0,limitTags:4,disableCloseOnSelect:!0,"aria-label":d,options:v,value:s,onChange:x,onBlur:y,disabled:S,ListboxComponent:M,renderOption:L,renderTags:h,size:"small",popupIcon:e(E,{"data-testid":"selected-facets-expand"}),renderInput:l=>e(w,{...l,variant:"outlined"})})]})};export{Q as EntitiesAutocompletePicker};
|
|
2
2
|
//# sourceMappingURL=EntitiesAutocompletePicker.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o,Fragment as R}from"react/jsx-runtime";import{makeStyles as
|
|
1
|
+
import{jsx as e,jsxs as o,Fragment as R}from"react/jsx-runtime";import{makeStyles as _,Box as i,Typography as n,Button as j}from"@material-ui/core";import{Alert as q}from"@material-ui/lab";import{parseFactRef as X}from"@spotify/backstage-plugin-soundcheck-common";import Y from"lodash";import{useMemo as u,useState as b,useEffect as Z,useCallback as ee}from"react";import{useGetEntityRefs as te}from"../../hooks/catalog/useGetEntityRefs.esm.js";import{useGetCollectors as ae}from"../../hooks/collectors/useGetCollectors.esm.js";import{useGetFactSchema as oe}from"../../hooks/collectors/useGetFactSchema.esm.js";import{useGetFact as ie}from"../../hooks/useGetFact.esm.js";import{useGetPathResolvers as ne}from"../../hooks/useGetPathResolvers.esm.js";import{generateJsonPaths as re}from"../CheckForm/utils/checkFormUtils.esm.js";import{hasLogo as le,CollectorLogo as ce}from"../CollectorsPage/CollectorListPage/CollectorLogo.esm.js";import{ExpandableSection as B}from"../ExpandableSection/ExpandableSection.esm.js";import{mapFiltersToCatalogFilter as se}from"../Filter/utils.esm.js";import"../Filter/FilterComponent.esm.js";import{emptyFilters as de}from"../Filter/types.esm.js";import{FormattedPreview as C}from"../FormattedPreview/FormattedPreview.esm.js";import"../FormControlledAutocomplete/FormControlledAutocomplete.esm.js";import"@material-ui/icons/CheckBox";import"@material-ui/icons/CheckBoxOutlineBlank";import"react-hook-form";import"../ListboxVirtualized/ListboxVirtualized.esm.js";import{useLabelOptions as pe}from"../FormControlledAutocomplete/useLabelOptions.esm.js";import{ControlledAutocomplete as v}from"../FormControlledAutocomplete/ControlledAutocomplete.esm.js";import{LoadingIndicator as me}from"../LoadingIndicator/LoadingIndicator.esm.js";import{useFactOptions as he}from"./useFactOptions.esm.js";const fe=800,ue=_(t=>({content:{padding:t.spacing(2,3),width:fe},section:{margin:t.spacing(2,0)},expandedSection:{borderTop:`1px solid ${t.palette.divider}`,padding:t.spacing(0,2)},loading:{margin:t.spacing(2)},preview:{maxHeight:500,overflow:"auto",border:`1px solid ${t.palette.divider}`},pathSection:{display:"flex",alignItems:"center",margin:t.spacing(1,0)},testPathButton:{margin:t.spacing(1,1,.5,0)},collectorName:{fontSize:24}})),T=t=>{const g=!t||Object.values(t).every(d=>!d?.length)?{...de(),selectedKinds:["Component","System"]}:t;return se(g)},ve=({factRef:t,updateFactRef:g,path:d,updatePath:I,entityRef:m,updateEntityRef:k,pathResolver:s,filters:G,onSave:P})=>{const a=ue(),p=u(()=>{if(t)return X(t)},[t]),[S,L]=b(p?.source??null);Z(()=>{p?.source&&L(p.source)},[p?.source]);const[y,V]=b("jsonpath"),[F,w]=b(),[N,W]=b(),{data:E}=ne(),M=u(()=>E?.map(c=>c.id)??[],[E]),{data:h}=oe(p?.source,p?.name,!0),$=u(()=>h?re(h.schema):[],[h]),{data:x,isLoading:A}=ae(),D=x?.map(c=>c.id)?.sort()??[],{data:J,isLoading:z}=te(T(G),500),l=u(()=>x?.find(c=>c.id===S),[x,S]),{factOptions:H}=he({selectedCollector:l}),{options:K,getOptionLabel:O}=pe(H),{data:r,isLoading:f}=ie({factRef:t||"",entityRef:N||"",path:F,pathResolver:s??y??void 0},!!t&&!!N),Q=ee(()=>{w(d),W(m)},[m,d]),U=u(()=>!!l?.config?.cache,[l]);return e(i,{className:a.content,"data-testid":"fact-explorer",children:o(i,{children:[o(i,{children:[e(n,{variant:"subtitle1",children:"Select an Integration"}),e(v,{options:D,onChange:c=>{L(c),g("")},value:S,placeholder:"Integration",disabled:A,fullWidth:!0})]}),!!l&&e(R,{children:o(i,{className:a.section,children:[le(l.id)?e(ce,{noMargin:!0,collectorId:l.id}):o(n,{variant:"h5",className:a.collectorName,component:"div",children:[l.name??l.id," "]}),!!l.description&&e(n,{variant:"body2",children:l.description}),e(v,{options:K,onChange:g,value:t??null,placeholder:"Select Fact",getOptionLabel:O,noOptionsText:"No Facts",fullWidth:!0})]})}),!!t&&o(R,{children:[!!h?.schema&&e(i,{className:a.section,children:e(B,{elevation:1,title:"JSON Schema",children:e("div",{className:a.preview,children:e(C,{data:h.schema})})})}),o(i,{className:a.section,children:[e(n,{variant:"subtitle1",children:"Path Resolver"}),!s&&e(n,{variant:"caption",children:"Defaults to jsonpath"}),s?e(n,{variant:"body1",children:s}):e(v,{options:M,onChange:V,value:s??y,placeholder:"Path Resolver (Optional)",getOptionLabel:O,fullWidth:!0,disabled:!!s})]}),o(i,{className:a.section,children:[e(n,{variant:"subtitle1",children:"Path"}),e(v,{options:(s??y)==="jsonpath"?$:[],onChange:c=>{F&&w(void 0),I(c)},value:d??null,placeholder:"Path",fullWidth:!0,freeSolo:!0}),e("div",{className:a.pathSection,children:!!P&&e(j,{className:a.testPathButton,variant:"contained",onClick:()=>P({factRef:t,path:d??"",pathResolver:y??s??""}),disabled:!d,color:"primary",children:"Save"})})]})]}),!!t&&e(B,{elevation:0,title:"Sample Fact and Test Path",children:o(i,{className:a.expandedSection,children:[o(i,{marginBottom:1,children:[e(n,{variant:"subtitle1",children:"Select an Entity"}),o(n,{variant:"caption",children:["Fact will be sampled from this entity.",e("br",{}),"If you don't see the entity in the drop-down list, you can type its reference in the format ","<kind>:<namespace>/<name>","."]}),e(v,{options:J??[],onChange:k,value:m??null,placeholder:"Entity Selection",isLoading:z,freeSolo:!0,fullWidth:!0})]}),e(i,{children:e(j,{className:a.testPathButton,variant:"contained",onClick:Q,disabled:!m,color:"primary",children:"Sample Fact"})}),o(R,{children:[!!F&&!f&&o(i,{className:a.section,children:[e(n,{variant:"subtitle1",children:"Resolved Value"}),r?.resolvedValue!==null&&r?.resolvedValue!==void 0?e(i,{className:a.preview,children:e(C,{data:r?.resolvedValue})}):e(n,{color:"textSecondary",variant:"body2",children:"Could not resolve path"})]}),!!N&&o(i,{className:a.section,children:[e(n,{variant:"subtitle1",children:"Fact Data"}),U&&e(n,{variant:"caption",children:"Uses cache when available."}),!!f&&e("div",{className:a.loading,children:e(me,{})}),!f&&!!r?.fact&&e(i,{className:a.preview,children:r?.fact?.sensitive&&Y.isEmpty(r?.fact?.data)?e(i,{children:e(q,{severity:"info",children:"The associated fact contains potentially sensitive information and has been redacted."})}):e(C,{data:r?.fact?.data})}),!f&&!!r?.collectionError&&o(n,{color:"textSecondary",variant:"body2",children:["Failed to collect:"," ",r?.collectionError?.errorMessage]}),!f&&!r?.fact&&!r?.collectionError&&o(n,{color:"textSecondary",variant:"body2",children:["Fact ",t," unavailable for entity ",m]})]})]})]})})]})})};export{ve as FactExplorer,T as toEntityFilterQuery};
|
|
2
2
|
//# sourceMappingURL=FactExplorer.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as a}from"react/jsx-runtime";import{Button as R}from"@material-ui/core";import x from"@material-ui/icons/Search";import{useContext as u}from"react";import{SoundcheckDialog as v}from"../SoundcheckDialog/SoundcheckDialog.esm.js";import{FactExplorer as
|
|
1
|
+
import{jsx as a}from"react/jsx-runtime";import{Button as R}from"@material-ui/core";import x from"@material-ui/icons/Search";import{useContext as u}from"react";import{SoundcheckDialog as v}from"../SoundcheckDialog/SoundcheckDialog.esm.js";import{FactExplorer as F}from"./FactExplorer.esm.js";import{FactExplorerContext as d}from"./FactExplorerContext.esm.js";const E=()=>{const{open:t,updateOpen:o,onSave:r,factRef:p,updateFactRef:n,path:c,updatePath:l,entityRef:e,updateEntityRef:f,pathResolver:i,filters:s}=u(d);return a(v,{open:t,handleClose:()=>o(!1),title:"Fact Explorer",fullScreen:!1,children:a(F,{onSave:r,factRef:p,updateFactRef:n,path:c,updatePath:l,entityRef:e,updateEntityRef:f,pathResolver:i,filters:s})})},S=({onSave:t,factRef:o,path:r,pathResolver:p,className:n,text:c="Explore Facts",hideIcon:l})=>{const{updateOpen:e,updateOnSave:f,updateFactRef:i,updatePath:s,updatePathResolver:h}=u(d);return a(R,{onClick:()=>{e(!0),i(o??""),s(r??""),h(p??""),f(()=>m=>{t&&t(m),e(!1)})},className:n,variant:"text",startIcon:l?void 0:a(x,{}),children:c})};export{E as FactExplorerDialog,S as FactExplorerDialogButton};
|
|
2
2
|
//# sourceMappingURL=FactExplorerDialog.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{parseFactRef as p,stringifyFactRef as c}from"@spotify/backstage-plugin-soundcheck-common";import{useMemo as n}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"../../hooks/useSoundcheckAlert.esm.js";import{useGetAllTracks as l}from"../../hooks/tracks/useGetAllTracks.esm.js";import"../../hooks/useConfirmationModal.esm.js";import"react-router-dom";const s=({selectedCollector:
|
|
1
|
+
import{parseFactRef as p,stringifyFactRef as c}from"@spotify/backstage-plugin-soundcheck-common";import{useMemo as n}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"../../hooks/useSoundcheckAlert.esm.js";import{useGetAllTracks as l}from"../../hooks/tracks/useGetAllTracks.esm.js";import"../../hooks/useConfirmationModal.esm.js";import"react-router-dom";const s=({selectedCollector:e})=>{const{data:r}=l({});return{factOptions:n(()=>e?.factNames?.map(o=>{const t=p(o,{defaultSource:e.id,defaultScope:"default"});let m=t.name;if(e?.id==="soundcheck"){const a=r?.edges.find(i=>i.node.id===t.name)?.node;m=a?`${a.type==="campaign"?"Campaign: ":"Track: "}${a.name}`:t.name}return{label:m,value:c(t)}})?.sort((o,t)=>o.label.localeCompare(t.label))??[],[e?.factNames,e?.id,r])}};export{s as useFactOptions};
|
|
2
2
|
//# sourceMappingURL=useFactOptions.esm.js.map
|