@spotify/backstage-plugin-soundcheck 0.15.0 → 0.16.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 +48 -0
- package/dist/alpha.d.ts +3 -3
- package/dist/api.esm.js +1 -1
- package/dist/components/CampaignForm/CampaignForm.esm.js +1 -1
- package/dist/components/CampaignForm/hooks/useCampaignForm.esm.js +1 -1
- package/dist/components/CampaignForm/hooks/utils.esm.js +1 -1
- package/dist/components/CampaignForm/utils/campaignFormUtils.esm.js +2 -1
- package/dist/components/CampaignForm/utils/validation.esm.js +1 -1
- package/dist/components/CertificationAccordion/CertificationAccordion.esm.js +1 -1
- package/dist/components/CertificationSidebar/CertificationSidebar.esm.js +1 -1
- package/dist/components/CertificationSidebar/Check.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/CertificationsPage/Playlist/PlaylistProgress.esm.js +1 -1
- package/dist/components/CheckCard/CheckCard.esm.js +1 -1
- package/dist/components/CheckDetails/CheckDetails.esm.js +1 -1
- package/dist/components/CheckDetails/CheckResultDetails.esm.js +2 -0
- package/dist/components/CheckDetails/CollapseRow.esm.js +1 -1
- package/dist/components/CheckDetails/ExemptionDetails.esm.js +2 -0
- package/dist/components/CheckDetails/FactTable.esm.js +2 -0
- package/dist/components/CheckDetails/ResolvedValueTable.esm.js +2 -0
- package/dist/components/CheckDetails/ResultStateBox.esm.js +1 -1
- package/dist/components/CheckDetails/SelectedValueContext.esm.js +2 -0
- package/dist/components/CheckDetails/findUniqueFacts.esm.js +2 -0
- package/dist/components/CheckDryRun/CheckDryRun.esm.js +1 -1
- package/dist/components/CheckDryRun/CheckDryRunContext.esm.js +1 -1
- package/dist/components/CheckDryRun/CheckDryRunDetails.esm.js +1 -1
- package/dist/components/CheckDryRun/CheckDryRunDialog.esm.js +1 -1
- package/dist/components/CheckForm/CheckForm.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/Conditions/ValueListInput.esm.js +1 -1
- package/dist/components/CheckForm/Steps/CheckReviewStep.esm.js +1 -1
- package/dist/components/CheckForm/utils/checkFormUtils.esm.js +2 -1
- package/dist/components/CheckForm/utils/validation.esm.js +1 -1
- package/dist/components/CheckIcon/CheckIcon.esm.js +1 -1
- package/dist/components/CheckPage/CheckStatusHistoryChart.esm.js +1 -1
- package/dist/components/CheckPage/FilterBar/FilterBar.esm.js +1 -1
- package/dist/components/CheckPage/utils.esm.js +1 -1
- package/dist/components/CollectorPage/Configurators/AzureDevOps/AzureDevOpsConfigurator.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/AzureDevOps/NumberOfDaysComponent.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/AzureDevOps/NumberOfWorkItemsComponent.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/AzureDevOps/utils.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/AzureDevOps/validation.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/BigQuery/QueryFactDetailsComponent.esm.js +1 -1
- package/dist/components/CollectorPage/Configurators/Catalog/CatalogConfigurator.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/Catalog/utils.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/Common/CollectorOption.esm.js +1 -1
- package/dist/components/CollectorPage/Configurators/Common/FactCollectionConfig.esm.js +1 -1
- package/dist/components/CollectorPage/Configurators/Common/utils.esm.js +1 -1
- package/dist/components/CollectorPage/Configurators/Configurator.esm.js +1 -1
- package/dist/components/CollectorPage/Configurators/HTTP/HttpConfigurator.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/HTTP/HttpRequestComponent.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/HTTP/HttpResponseComponent.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/HTTP/HttpRetriesComponent.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/HTTP/HttpStatusesInput.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/HTTP/RequestFactDetailsComponent.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/HTTP/utils.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/HTTP/validation.esm.js +2 -0
- package/dist/components/CollectorPage/Configurators/SCM/JsonFactDetailsComponent.esm.js +1 -1
- package/dist/components/CollectorPage/Configurators/SCM/RegexFactDetailsComponent.esm.js +1 -1
- package/dist/components/CollectorsPage/CollectorListPage/CollectorLogo.esm.js +1 -1
- package/dist/components/CollectorsPage/CollectorListPage/CollectorSummaryCard.esm.js +1 -1
- package/dist/components/EntityChip/EntityChip.esm.js +2 -0
- package/dist/components/EntitySoundcheckCard/Card.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/Filter/FilterKeyValueInput.esm.js +2 -0
- package/dist/components/Filter/FilterPreviewTable/FilterPreviewTable.esm.js +1 -1
- package/dist/components/Filter/KeyValueInputDialog.esm.js +2 -0
- package/dist/components/Filter/types.esm.js +1 -1
- package/dist/components/Filter/utils.esm.js +1 -1
- package/dist/components/FormFilterSection/FormFilterSection.esm.js +1 -1
- package/dist/components/Frequency/FrequencyComponent.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/RuleResult/BranchResultComponent.esm.js +2 -0
- package/dist/components/RuleResult/ConditionResultComponent.esm.js +2 -0
- package/dist/components/RuleResult/RuleResultComponent.esm.js +2 -0
- package/dist/components/SearchBar/SearchBar.esm.js +1 -1
- package/dist/components/SoundcheckHeader/Breadcrumbs.esm.js +1 -1
- package/dist/components/SoundcheckHeader/SoundcheckHeader.esm.js +1 -1
- package/dist/components/SummaryCard/SummaryCardActionsMenu.esm.js +1 -1
- package/dist/components/TechHealth/Filters/FacetFilter.esm.js +1 -1
- package/dist/components/TrackEditPage/TrackEditView.esm.js +1 -1
- package/dist/components/TrackForm/TrackForm.esm.js +1 -1
- package/dist/components/TrackForm/utils/trackFormUtils.esm.js +2 -1
- package/dist/components/TrackForm/utils/useTrackForm.esm.js +1 -1
- package/dist/components/TrackForm/utils/validation.esm.js +1 -1
- package/dist/components/TrackPage/TrackEntitiesTable/utils.esm.js +1 -1
- package/dist/graphql/generated/index.esm.js +127 -126
- package/dist/hooks/certifications/useTrackOverviewForOwner.esm.js +2 -0
- package/dist/hooks/checks/useDeleteCheck.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/useDeleteTrack.esm.js +1 -1
- package/dist/hooks/tracks/useGetAllTracks.esm.js +1 -1
- package/dist/hooks/tracks/useGetChecksMap.esm.js +1 -1
- package/dist/hooks/tracks/useUpdateTrack.esm.js +1 -1
- package/dist/images/azure-devops-rgb.svg +13 -0
- package/dist/images/azure-devops-white.svg +13 -0
- package/dist/images/http-rgb.svg +11 -0
- package/dist/images/http-white.svg +11 -0
- package/dist/text.esm.js +1 -1
- package/dist/utils/validation.esm.js +1 -1
- package/package.json +27 -21
- package/dist/hooks/certifications/useProgramOverviewForOwner.esm.js +0 -2
- /package/dist/components/CollectorPage/Configurators/{BigQuery → Common}/css/prism-dark-sql.css.esm.js +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{stringifyEntityRef as
|
|
1
|
+
import{stringifyEntityRef as y}from"@backstage/catalog-model";import{EntityListProvider as u}from"@backstage/plugin-catalog-react";import{makeStyles as f,Typography as E}from"@material-ui/core";import{isEqual as g}from"lodash";import t from"react";import{useFormContext as x}from"react-hook-form";import"../../../contexts/TrackFormContext.esm.js";import{useCheckFormContext as v}from"../../../contexts/CheckFormContext.esm.js";import"../../../contexts/CampaignFormContext.esm.js";import"../../../contexts/UserProvider.esm.js";import{CheckDryRun as S}from"../../CheckDryRun/CheckDryRun.esm.js";import"../../SoundcheckDialog/SoundcheckDialog.esm.js";import"../../CheckDryRun/CheckDryRunDetails.esm.js";import{CheckDryRunProvider as k}from"../../CheckDryRun/CheckDryRunContext.esm.js";import{mapToCheckerInput as F}from"../utils/checkFormUtils.esm.js";import{ExpandableSection as h}from"../../ExpandableSection/ExpandableSection.esm.js";import{FilterPreviewTable as T}from"../../Filter/FilterPreviewTable/FilterPreviewTable.esm.js";import{emptyFilters as o,emptyKeyValueFilters as m}from"../../Filter/types.esm.js";import{FormattedPreview as b}from"../../FormattedPreview/FormattedPreview.esm.js";const w=f(e=>({container:{display:"flex",flexDirection:"column",gap:e.spacing(2)},preview:{color:e.palette.text.primary,fontSize:e.typography.body1.fontSize,borderTop:`1px solid ${e.palette.divider}`,overflow:"auto",padding:e.spacing(1,2),maxHeight:420,"& pre":{marginTop:0,background:`${e.palette.background.paper} !important`}},previewSection:{marginBottom:e.spacing(2)}})),C=()=>{const e=w(),{getValues:r}=x(),{selectedItem:a}=v(),i=F(r(),a),l=r("filtersStep.filter"),p=r("filtersStep.keyValueFilter"),n=r("filtersStep.excludeFilter"),c=r("filtersStep.excludeKeyValueFilter"),s=g(l,o());return t.createElement(k,null,t.createElement(E,{variant:"body2"},"Take a moment to review your check and perform dry runs to ensure everything is working as expected before you save."),t.createElement("div",{className:e.container},t.createElement(h,{className:e.previewSection,title:"YAML"},t.createElement("div",{className:e.preview},t.createElement(b,{data:{...i,id:a?i.id:"<ID WILL BE GENERATED WHEN CHECK IS SAVED>"},dataType:"yaml"}))),t.createElement(u,{pagination:{limit:10}},t.createElement(T,{title:`Test Against ${s?"Select Filters to Dry Run Against Applicable Entities":"Applicable Entities"}`,filter:l??o(),keyValueFilter:p??m(),excludeFilter:n??o(),excludeKeyValueFilter:c??m(),hideTags:!0,additionalColumns:[{title:"Dry Run",cellStyle:{padding:"0px 16px 0px 20px"},id:"dry-run",render:d=>t.createElement(t.Fragment,null,t.createElement(S,{check:i,entityRef:y(d)}))}]}))))};export{C as CheckReviewStep};
|
|
2
2
|
//# sourceMappingURL=CheckReviewStep.esm.js.map
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{FrequencySchema as
|
|
1
|
+
import{FrequencySchema as R}from"@spotify/backstage-plugin-soundcheck-common";import{isObject as O}from"lodash";import{v4 as C}from"uuid";import{mapInputFilterToFormFilters as x,mapCatalogFilterToFormKeyValueFilters as g,mapFiltersToCatalogFilter as h}from"../../Filter/utils.esm.js";import"../../Filter/FilterComponent.esm.js";import{emptyFilters as v,emptyKeyValueFilters as F}from"../../Filter/types.esm.js";import{TimeUnit as w}from"../../Frequency/types.esm.js";import{isTimeUnit as A}from"../../Frequency/util.esm.js";import"../../Frequency/FrequencyComponent.esm.js";import{ExpressionType as l}from"../types/ExpressionType.esm.js";import{defaultSchedule as P}from"../types/Schedule.esm.js";import"../types/Path.esm.js";import{CHECK_NAME_MAX_LENGTH as M}from"./validation.esm.js";const S=e=>{if(O(e)&&"frequency"in e){const r=R.safeParse(e.frequency);if(r.success){const t=r.data;if("cron"in t)return{enabled:!0,frequency:{type:"cron",unit:w.Hours,value:1,cron:t.cron}};const i=Object.keys(t);if(i.length){const s=i[0];if(A(s))return{enabled:!0,frequency:{type:"HumanDuration",unit:s,value:t[s]??1,cron:""}}}}}return{enabled:!1,frequency:{type:"HumanDuration",unit:w.Hours,value:1,cron:""}}},T=(e,r)=>{const{enabled:t,frequency:i}=e;if(t){const{cron:s,type:n,unit:a,value:p}=i;return n==="HumanDuration"?{frequency:{[a]:p},filter:h(r)}:{frequency:{cron:s}}}},m=e=>{if(Array.isArray(e))return e.map(r=>m(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},u=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:m(t.value)}))};return e.expressions&&e.expressions.forEach(t=>{r[e.expressionType]?.push(u(t))}),r}if(e.expressions)return e.expressions.map(u);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:m(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{}},y=(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],p=[],f=[];return a.forEach(o=>{const d=Object.keys(o);if(d.includes("all")||d.includes("any")||d.includes("not"))f.push(y(o,!1));else{const{operator:E,operatorPrefix:b}=k(o.operator);p.push({factRef:o.factRef,path:o.path,operator:E??o.operator,value:o.value,operatorPrefix:b})}}),{expressions:f.length>0?f:void 0,conditions:p,expressionType:i}}const{operator:s,operatorPrefix:n}=k(e.operator);return{expressionType:l.AllOf,conditions:[{factRef:e.factRef,path:e.path,operator:s??e.operator,value:e.value,operatorPrefix:n}]}},V=e=>({detailsStep:{name:e.name??"",description:e.description??"",ownerEntityRef:e.ownerEntityRef??""},rulesStep:{pathResolver:e.pathResolver??"jsonpath",expressions:y(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)},scheduleStep:{schedule:S(e.schedule)}}),N=(e,r)=>{const{detailsStep:t,rulesStep:i,filtersStep:s,scheduleStep:n}=e;return{id:r?r.id:C(),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:u(i.expressions),warning:i.warning??!1,filter:s.filter||s.keyValueFilter?h(s.filter,s.keyValueFilter):void 0,exclude:s.excludeFilter||s.excludeKeyValueFilter?h(s.excludeFilter,s.excludeKeyValueFilter):void 0,schedule:T(n.schedule,s.filter),type:r?r.type:void 0}},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 n=`${r}.${s}`;t.push(n);const a=i[s];t.push(...c(a,n))}}if(e.type==="array"&&e.items){const i=`${r}[*]`;t.push(i);const s=Array.isArray(e.items)?e.items:[e.items];for(const n of s)t.push(...c(n,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:""},rulesStep:{pathResolver:"jsonpath",expressions:{expressionType:l.AllOf,expressions:void 0,conditions:[{factRef:"",path:"",operator:"",operatorPrefix:"",value:"",conditions:[]}]},warning:!1},filtersStep:{filter:v(),keyValueFilter:F(),excludeFilter:v(),excludeKeyValueFilter:F()},scheduleStep:{schedule:P()}},K={details:{name:{name:"Check name",helperText:`Max ${M} 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"}},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,u as mapExpressionToRule,S as mapInputScheduleToSchedule,y as mapRuleToExpression,T as mapScheduleToInputSchedule,N as mapToCheckerInput};
|
|
2
3
|
//# sourceMappingURL=checkFormUtils.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{CheckMessagingSchema as c,CheckDetailsSchema as p,parseFactRef as
|
|
1
|
+
import{CheckMessagingSchema as c,CheckDetailsSchema as p,parseFactRef as m}from"@spotify/backstage-plugin-soundcheck-common";import{z as e}from"zod";import{FrequencySchema as l,formFiltersSchema as f}from"../../../utils/validation.esm.js";import{ExpressionType as t}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 i=r=>{try{return m(r),!0}catch{return"Invalid fact reference. [source]:[scope]/[name]."}},u=100,o=async r=>{if(!await i(r))throw new Error("Fact reference validation failed");return r},a=e.union([e.string().min(1,"Required"),e.number(),e.boolean()]),n=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:a.or(e.array(a).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(n).optional()})),s=e.lazy(()=>e.strictObject({expressionType:e.enum([t.AllOf,t.AnyOf,t.Not]).optional(),expressions:e.array(s).optional(),conditions:e.array(n).optional()})),d=e.strictObject({expressions:s,pathResolver:e.string().optional()}).merge(c),h=e.strictObject({enabled:e.boolean(),frequency:l}),g=e.strictObject({schedule:h.optional()}),y=e.strictObject({detailsStep:p,rulesStep:d,filtersStep:f,scheduleStep:g});export{u as CHECK_NAME_MAX_LENGTH,y as checkFormSchema,i as validateFactRef};
|
|
2
2
|
//# sourceMappingURL=validation.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{withStyles as r}from"@material-ui/core";import i from"@material-ui/icons/Check";import c from"@material-ui/icons/Close";import
|
|
1
|
+
import{withStyles as r}from"@material-ui/core";import i from"@material-ui/icons/Check";import c from"@material-ui/icons/Close";import p from"@material-ui/icons/HelpOutline";import n from"@material-ui/icons/NotInterested";import l from"@material-ui/icons/RemoveCircleOutline";import s from"@material-ui/icons/ReportProblemOutlined";import o from"react";import{ResultState as a}from"../../graphql/generated/index.esm.js";import{resultToText as d}from"../../text.esm.js";const f=r(e=>({root:{color:e.palette.success.main}}))(i),E=r(e=>({root:{color:e.palette.error.main}}))(c),u=r(e=>({root:{color:e.palette.warning.main}}))(s),x=r(e=>({root:{color:e.palette.text.primary}}))(p),b=r(e=>({root:{color:e.palette.text.disabled}}))(l),N=r(e=>({root:{color:e.palette.text.disabled}}))(n),g=r(e=>({root:{color:e.palette.error.main}}))(l),h=({result:e,className:m})=>{const t={className:m,"aria-label":d(e),"aria-hidden":!1};return e===a.Passed?o.createElement(f,{...t}):e===a.NotReported?o.createElement(x,{...t}):e===a.Failed?o.createElement(E,{...t}):e===a.Warning?o.createElement(u,{...t}):e===a.NotApplicable?o.createElement(b,{...t}):e===a.Exempt?o.createElement(N,{...t}):e===a.Error?o.createElement(g,{...t}):null};export{h as CheckIcon};
|
|
2
2
|
//# sourceMappingURL=CheckIcon.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useTheme as E}from"@material-ui/core";import g from"@material-ui/lab/Skeleton";import{DateTime as x}from"luxon";import t from"react";import{LineChart as I,CartesianGrid as A,XAxis as C,YAxis as m,Label as s,Line as r}from"recharts";import{useCheckStatusHistory as
|
|
1
|
+
import{useTheme as E}from"@material-ui/core";import g from"@material-ui/lab/Skeleton";import{DateTime as x}from"luxon";import t from"react";import{LineChart as I,CartesianGrid as A,XAxis as C,YAxis as m,Label as s,Line as r}from"recharts";import{useCheckStatusHistory as K}from"../../hooks/aggregations/useCheckStatusHistory.esm.js";import{ChartWrapper as W}from"../Charts/ChartWrapper/ChartWrapper.esm.js";import"../Charts/LineChart/LineChart.esm.js";import"../Charts/ChartTypes.esm.js";import"../Charts/chartUtils.esm.js";import"../TechHealthSummary/SummaryAggregationsProvider.esm.js";import"@backstage/catalog-model";import"../Charts/BarChart/BarChart.esm.js";const v=({checkId:n,trackId:d,checkStatus:a,filter:c,states:l})=>{const e=E(),{data:i,isLoading:p}=K({checkId:n,trackId:d,filter:c,states:l,numberOfDays:30},!!n&&!!a);if(!a||p)return t.createElement(g,{variant:"rect",width:"100%",height:"100%"});const y=i?.history.every(({notReported:o})=>o>=0);return t.createElement(W,{height:"90%"},t.createElement(I,{data:i?.history??[],margin:{top:0,right:0,left:0,bottom:0}},t.createElement(A,{stroke:e.palette.divider,verticalPoints:[]}),t.createElement(C,{dataKey:"date",tickFormatter:o=>x.fromISO(o).toFormat("MMM d"),allowDuplicatedCategory:!1,height:40,tick:({x:o,y:h,fill:k,payload:f,tickFormatter:u})=>t.createElement("g",{transform:`translate(${o},${h})`},t.createElement("text",{x:0,y:0,dy:16,textAnchor:"end",fill:k,transform:"rotate(-20)",fontSize:12},u(f.value)))}),t.createElement(m,{yAxisId:"percentage",orientation:"right",domain:[0,100]},t.createElement(s,{value:"Percentage",position:"center",angle:90})),t.createElement(m,{yAxisId:"count",domain:[0,a?.numberOfEntities??0]},t.createElement(s,{value:"Count",position:"center",angle:270,offset:2})),t.createElement(r,{type:"monotone",dataKey:"passed",stroke:e.palette.success.main,yAxisId:"count",strokeWidth:2,dot:!1}),t.createElement(r,{type:"monotone",dataKey:"failed",stroke:e.palette.error.main,yAxisId:"count",strokeWidth:2,dot:!1}),t.createElement(r,{type:"monotone",dataKey:"warning",stroke:e.palette.warning.main,yAxisId:"count",strokeWidth:2,dot:!1}),t.createElement(r,{type:"monotone",dataKey:"notApplicable",stroke:e.palette.text.disabled,yAxisId:"count",strokeWidth:2,dot:!1}),t.createElement(r,{type:"monotone",dataKey:"error",stroke:e.palette.error.light,yAxisId:"count",strokeWidth:2,dot:!1}),t.createElement(r,{type:"monotone",dataKey:"exempt",stroke:e.palette.warning.light,yAxisId:"count",strokeWidth:2,dot:!1}),y&&t.createElement(r,{type:"monotone",dataKey:"notReported",stroke:e.palette.info.main,yAxisId:"count",strokeWidth:2,dot:!1})))};export{v as CheckStatusHistoryChart};
|
|
2
2
|
//# sourceMappingURL=CheckStatusHistoryChart.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{parseEntityRef as
|
|
1
|
+
import{parseEntityRef as x}from"@backstage/catalog-model";import{EntityDisplayName as T}from"@backstage/plugin-catalog-react";import{makeStyles as D,Checkbox as p,Box as P,Typography as B}from"@material-ui/core";import G from"@material-ui/icons/Category";import j from"@material-ui/icons/Class";import W from"@material-ui/icons/Group";import _ from"@material-ui/icons/Loop";import z from"@material-ui/icons/PlaylistAddCheckRounded";import e,{useMemo as f}from"react";import{useGetEntityFacets as o}from"../../../hooks/catalog/useGetEntityFacets.esm.js";import{useGroupOptions as H}from"../../../hooks/groups/useGroupOptions.esm.js";import{CheckIcon as J}from"../../CheckIcon/CheckIcon.esm.js";import l from"../../MultiSelectFilter/MultiSelectFilter.esm.js";function M(t){return t.toLowerCase().split("_").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}const d=(t,{selected:r})=>e.createElement(e.Fragment,null,e.createElement(p,{value:t,checked:r,color:"primary"}),e.createElement(T,{entityRef:t,hideIcon:!0})),Q=(t,{selected:r})=>e.createElement(e.Fragment,null,e.createElement(p,{value:t,checked:r,color:"primary"}),e.createElement(J,{result:t}),e.createElement(P,{mr:1}),e.createElement(B,null,M(t))),U=D(t=>({root:{display:"flex",flexDirection:"row",alignItems:"center",gap:t.spacing(2)}})),$=({filter:t,states:r,setStates:y,owners:E,setOwners:u,lifecycles:g,setLifecycles:L,types:h,setTypes:b,systems:F,setSystems:w})=>{const O=U(),{options:s,isLoading:k}=H(),A=f(()=>s.map(n=>n.ref),[s]),{data:i,isLoading:C}=o("spec.lifecycle",t),{data:a,isLoading:I}=o("spec.type",t),{data:m,isLoading:S}=o("relations.partOf",t),c=f(()=>m?.filter(n=>{try{return x(n).kind.toLowerCase()==="system"}catch{return!1}}),[m]),N=(i||[]).length<=1,R=(a||[]).length<=1,v=(c||[]).length<=1;return e.createElement("div",{className:O.root},e.createElement(l,{name:"state",label:"State",icon:e.createElement(z,null),options:["PASSED","FAILED","WARNING","NOT_APPLICABLE"],filters:r,setFilters:y,customRenderOption:Q}),e.createElement("div",null,e.createElement(l,{name:"system",label:"System",icon:e.createElement(G,null),filters:F,setFilters:w,options:c??[],disabled:S||v,customRenderOption:d}),e.createElement(l,{name:"owner",label:"Owner",icon:e.createElement(W,null),filters:E,setFilters:u,options:A??[],disabled:k,customRenderOption:d}),e.createElement(l,{name:"type",label:"Type",icon:e.createElement(j,null),filters:h,setFilters:b,options:a??[],disabled:I||R}),e.createElement(l,{name:"lifecycle",label:"Lifecycle",icon:e.createElement(_,null),filters:g,setFilters:L,options:i??[],disabled:C||N})))};export{$ as FilterBar};
|
|
2
2
|
//# sourceMappingURL=FilterBar.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ResultState as e}from"../../graphql/generated/index.esm.js";const t=r=>{switch(r){case"PASSED":return e.Passed;case"FAILED":return e.Failed;case"WARNING":return e.Warning;case"NOT_APPLICABLE":return e.NotApplicable;case"NOT_REPORTED":return e.NotReported;case"ERROR":return e.Error;default:return}};export{t as toResultState};
|
|
1
|
+
import{ResultState as e}from"../../graphql/generated/index.esm.js";const t=r=>{switch(r){case"PASSED":return e.Passed;case"FAILED":return e.Failed;case"WARNING":return e.Warning;case"NOT_APPLICABLE":return e.NotApplicable;case"NOT_REPORTED":return e.NotReported;case"EXEMPT":return e.Exempt;case"ERROR":return e.Error;default:return}};export{t as toResultState};
|
|
2
2
|
//# sourceMappingURL=utils.esm.js.map
|
package/dist/components/CollectorPage/Configurators/AzureDevOps/AzureDevOpsConfigurator.esm.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{zodResolver as E}from"@hookform/resolvers/zod";import{makeStyles as S,Paper as P,Divider as l}from"@material-ui/core";import e,{useCallback as k}from"react";import{useForm as B,FormProvider as A}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"../../../../hooks/useSoundcheckAlert.esm.js";import{useConfirmationModal as F}from"../../../../hooks/useConfirmationModal.esm.js";import{useNavigateBack as R}from"../../../../hooks/useNavigateBack.esm.js";import{useUpdateCollectorConfig as I}from"../../../../hooks/collectors/useUpdateCollectorConfig.esm.js";import{integrationsPageRouteRef as N}from"../../../../routes.esm.js";import{FooterButtons as W}from"../../../FooterButtons/FooterButtons.esm.js";import"../../../SoundcheckHeader/SoundcheckHeader.esm.js";import"../../../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as q}from"../../../SoundcheckHeader/useHeader.esm.js";import{FactCollectionConfig as r}from"../Common/FactCollectionConfig.esm.js";import{defaultCollectorOption as s}from"../Common/CollectorOption.esm.js";import{collectorHeaderContent as z,confirmationModalContent as w}from"../Common/utils.esm.js";import{NumberOfDaysComponent as p}from"./NumberOfDaysComponent.esm.js";import{NumberOfWorkItemsComponent as M}from"./NumberOfWorkItemsComponent.esm.js";import{mapConfigToAzureDevOpsCollectorConfig as T,defaultAzureDevOpsConfig as x,numberOfDaysCollectorConfig as b,numberOfWorkItemsCollectorConfig as H,mapAzureDevOpsCollectorConfigToConfig as L}from"./utils.esm.js";import{azureDevOpsCollectorFormSchema as V}from"./validation.esm.js";const j=S(o=>({spacer:{height:o.spacing(8),width:"100%"},section:{marginBottom:o.spacing(2)}})),U=({disabled:o,selectedCollector:n})=>{const d=k(async(t,...a)=>{const i={enabled:!1,collectors:[]},D={repositoryDetails:t.repositoryDetails.enabled?t.repositoryDetails:s(),branchPolicies:t.branchPolicies.enabled?t.branchPolicies:s(),branchStatus:t.branchStatus.enabled?t.branchStatus:s(),numberOfBranches:t.numberOfBranches.enabled?t.numberOfBranches:i,numberOfActivePullRequests:t.numberOfActivePullRequests.enabled?t.numberOfActivePullRequests:i,numberOfWorkItems:t.numberOfWorkItems.enabled?t.numberOfWorkItems:i};return E(V)(D,...a)},[]),m=B({defaultValues:n?T(n.config):x(),mode:"onChange",resolver:d}),{formState:{isValid:C},handleSubmit:c}=m,u=j(),h=!C,{mutateAsync:g}=I(),[O,y]=R(N),{showModal:v}=F(),f=async t=>{if(!await v(w(n)))return;const a=L(t);await g({collectorId:n.id,config:a})&&y()};return q(z(n)),e.createElement(e.Fragment,null,e.createElement(P,{className:u.section},e.createElement(A,{...m},e.createElement("form",{onSubmit:c(f)},e.createElement(r,{name:"repositoryDetails",label:"Repository Details",description:"Collects details about an entity's repository.",disabled:o}),e.createElement(l,null),e.createElement(r,{name:"branchPolicies",label:"Branch Policies",description:"Collects branch policies information from an entity's repository.",disabled:o}),e.createElement(l,null),e.createElement(r,{name:"branchStatus",label:"Branch Status",description:"Collects the latest branch status information from an entity's repository.",disabled:o}),e.createElement(l,null),e.createElement(r,{name:"numberOfBranches",label:"Number Of Branches",description:"Collects the number of branches from an entity's repository.",disabled:o,FactDetailsComponent:p,multipleCollectors:{enable:!0,defaultConfig:b()}}),e.createElement(l,null),e.createElement(r,{name:"numberOfActivePullRequests",label:"Number Of Active Pull Requests",description:"Collects the number of active pull requests from an entity's repository.",disabled:o,FactDetailsComponent:p,multipleCollectors:{enable:!0,defaultConfig:b()}}),e.createElement(l,null),e.createElement(r,{name:"numberOfWorkItems",label:"Number Of Work Items",description:"Collects the number of work items from an entity's project.",disabled:o,FactDetailsComponent:M,multipleCollectors:{enable:!0,defaultConfig:H()}})))),e.createElement("div",{className:u.section},e.createElement(W,{onCancel:O,saveButtonText:"Save",isLoading:!1,onSave:c(f),disableSave:h})))};export{U as AzureDevOpsConfigurator};
|
|
2
|
+
//# sourceMappingURL=AzureDevOpsConfigurator.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{makeStyles as u,Grid as l,Typography as i,TextField as c}from"@material-ui/core";import e from"react";import{useFormContext as h,Controller as p}from"react-hook-form";const g=u(t=>({root:{paddingTop:t.spacing(1)},textInput:{marginTop:0,width:"450px"},helperText:{marginLeft:0}})),f=({name:t,disabled:s})=>{const r=g(),{control:m}=h();return e.createElement(l,{container:!0,className:r.root,spacing:0,direction:"column"},e.createElement(p,{name:`${t}.factName`,control:m,render:({field:n,fieldState:{error:o}})=>e.createElement(l,{item:!0},e.createElement(i,{variant:"subtitle2"},"Fact Name"),e.createElement(c,{...n,type:"text",variant:"outlined",margin:"dense",placeholder:"Fact Name",className:r.textInput,disabled:s,error:!!o,helperText:o?.message??"Fact name must be unique",FormHelperTextProps:{className:r.helperText}}))}),e.createElement(p,{name:`${t}.numberOfDays`,control:m,render:({field:n,fieldState:{error:o}})=>e.createElement(l,{item:!0},e.createElement(i,{variant:"subtitle2"},t.startsWith("numberOfBranches")?"Last Commit More Than X Days Ago (Optional)":"Created More Than X Days Ago (Optional)"),e.createElement(c,{...n,onChange:a=>{if(a.target.value){const d=parseInt(a.target.value,10)??null;n.onChange({...a,target:{...a.target,value:d}})}else n.onChange({...a,target:{...a.target,value:null}})},type:"number",variant:"outlined",margin:"dense",placeholder:"Number Of Days",className:r.textInput,disabled:s,error:!!o,helperText:o?.message??(t.startsWith("numberOfBranches")?"If not provided collects a total number of branches in the entity's repository":"If not provided collects a total number of active pull requests that target the default branch in the entity's repository"),FormHelperTextProps:{className:r.helperText}}))}))};export{f as NumberOfDaysComponent};
|
|
2
|
+
//# sourceMappingURL=NumberOfDaysComponent.esm.js.map
|
package/dist/components/CollectorPage/Configurators/AzureDevOps/NumberOfWorkItemsComponent.esm.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{makeStyles as h,Box as b,Grid as o,Typography as s,TextField as u,FormHelperText as y,IconButton as g}from"@material-ui/core";import I from"@material-ui/icons/Add";import T from"@material-ui/icons/Remove";import N from"classnames";import{highlight as v,languages as C}from"prismjs";import"prismjs/components/prism-sql";import e from"react";import{useFormContext as q,useFieldArray as F,Controller as c}from"react-hook-form";import k from"react-simple-code-editor";import{FormFieldLabel as S}from"../../../FormFieldLabel/FormFieldLabel.esm.js";import*as L from"../Common/css/prism-dark-sql.css.esm.js";import{numberOfWorkItemsDataConfig as $}from"./utils.esm.js";const w=h(t=>({...L,root:{paddingTop:t.spacing(1)},factNameInput:{marginTop:0,width:"450px"},labelInput:{marginTop:0,width:"255px"},labelInputArea:{height:"40px"},queryInput:{marginTop:0,width:"420px",minHeight:"40px",maxHeight:"300px",overflowY:"scroll",outline:`1px solid ${t.palette.action.disabled}`,borderRadius:"4px",display:"grid","&:hover":{outlineColor:t.palette.textContrast}},queryInputError:{outlineColor:t.palette.error.main,"&:hover":{outlineColor:t.palette.error.main}},queryTextarea:{outline:"none"},helperText:{marginLeft:0},caption:{margin:t.spacing(2,0)}})),H=({name:t,disabled:n})=>{const r=w(),{control:m}=q(),{fields:d,insert:x,remove:E}=F({control:m,name:`${t}.data`});return e.createElement(b,{className:r.root},e.createElement(c,{name:`${t}.factName`,control:m,render:({field:p,fieldState:{error:a}})=>e.createElement(o,{item:!0},e.createElement(s,{variant:"subtitle2"},"Fact Name"),e.createElement(u,{...p,type:"text",variant:"outlined",margin:"dense",placeholder:"Fact Name",className:r.factNameInput,disabled:n,error:!!a,helperText:a?.message??"Fact name must be unique",FormHelperTextProps:{className:r.helperText}}))}),e.createElement("div",{className:r.caption},e.createElement(s,{variant:"subtitle1"},"Queries"),e.createElement(s,{variant:"caption"},"List the WIQL syntax queries to filter work items by")),e.createElement(o,{container:!0,spacing:0,direction:"column"},d.map((p,a)=>e.createElement(o,{item:!0,container:!0,spacing:2,key:p.id},e.createElement(o,{item:!0},e.createElement(s,{variant:"subtitle2"},"Label"),e.createElement(c,{name:`${t}.data.${a}.name`,control:m,render:({field:i,fieldState:{error:l}})=>e.createElement(u,{...i,type:"text",variant:"outlined",margin:"dense",placeholder:"Label",className:r.labelInput,disabled:n,error:!!l,helperText:l?.message??" ",InputProps:{className:r.labelInputArea},FormHelperTextProps:{className:r.helperText}})})),e.createElement(o,{item:!0},e.createElement(S,{title:"WIQL Query",docLink:"https://learn.microsoft.com/en-us/azure/devops/boards/queries/wiql-syntax?view=azure-devops"}),e.createElement(c,{name:`${t}.data.${a}.query`,control:m,render:({field:i,fieldState:{error:l}})=>e.createElement(e.Fragment,null,e.createElement("div",{className:N(r.queryInput,l?r.queryInputError:void 0)},e.createElement(k,{...i,highlight:f=>v(f,C.sql,"sql"),onValueChange:i.onChange,padding:10,disabled:n,placeholder:"Example: SELECT [System.Id] FROM WorkItem",textareaClassName:r.queryTextarea})),e.createElement(y,{className:r.helperText,error:!!l},l?.message??" "))})),e.createElement(o,{item:!0,alignContent:"center"},e.createElement(g,{onClick:()=>E(a),disabled:n||d.length===1},e.createElement(T,{fontSize:"small"})),e.createElement(g,{onClick:()=>x(a+1,$()),disabled:n},e.createElement(I,{fontSize:"small"})))))))};export{H as NumberOfWorkItemsComponent};
|
|
2
|
+
//# sourceMappingURL=NumberOfWorkItemsComponent.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{asArray as A}from"@spotify/backstage-plugin-soundcheck-common";import{defaultBaseCollectorOption as h,defaultCollectorOption as C}from"../Common/CollectorOption.esm.js";import{mapBackendConfigToFormIntegrationConfig as i,mapFormIntegrationConfigToBackendConfig as m}from"../Common/utils.esm.js";const d="repository_details",_="branch_policies",T="branch_status",u="number_of_branches",O="number_of_active_pull_requests",b="number_of_work_items",g="count",y="SELECT [System.Id] FROM WorkItem",E=(a,t)=>({...h(),factDetails:{factName:a??"",numberOfDays:t}}),D=(a,t)=>({name:a??"",query:t??""}),R=(a,t,f)=>({...h(),factDetails:{factName:a??"",data:[D(t,f)]}}),N=()=>({repositoryDetails:C(),branchPolicies:C(),branchStatus:C(),numberOfBranches:{enabled:!1,collectors:[E(u)]},numberOfActivePullRequests:{enabled:!1,collectors:[E(O)]},numberOfWorkItems:{enabled:!1,collectors:[R(b,g,y)]}});function L(a){const{repositoryDetails:t,branchPolicies:f,branchStatus:o,numberOfBranches:r,numberOfActivePullRequests:l,numberOfWorkItems:s}=a;if(t.enabled||f.enabled||o.enabled||r.enabled||l.enabled||s.enabled){const p={},c=[];return p.collects=c,t.enabled&&c.push(m({factType:d,configOption:t})),f.enabled&&c.push(m({factType:_,configOption:f})),o.enabled&&c.push(m({factType:T,configOption:o})),r.enabled&&r.collectors.forEach(n=>{c.push(m({factType:u,configOption:n,additionalParams:{factName:n.factDetails.factName,lastCommitMoreThanXDaysAgo:n.factDetails.numberOfDays?n.factDetails.numberOfDays:void 0}}))}),l.enabled&&l.collectors.forEach(n=>{c.push(m({factType:O,configOption:n,additionalParams:{factName:n.factDetails.factName,createdMoreThanXDaysAgo:n.factDetails.numberOfDays?n.factDetails.numberOfDays:void 0}}))}),s.enabled&&s.collectors.forEach(n=>{c.push(m({factType:b,configOption:n,additionalParams:{factName:n.factDetails.factName,data:n.factDetails.data}}))}),p}return{collects:[]}}function P(a){const t=N();if(a){const f=a.collects;if(f){const o=A(f),r=o.find(e=>e.type===d);r&&(t.repositoryDetails={...i({parentConfig:a,factTypeConfig:r}),enabled:!0});const l=o.find(e=>e.type===_);l&&(t.branchPolicies={...i({parentConfig:a,factTypeConfig:l}),enabled:!0});const s=o.find(e=>e.type===T);s&&(t.branchStatus={...i({parentConfig:a,factTypeConfig:s}),enabled:!0});const p=o.filter(e=>e.type===u);p.length&&(t.numberOfBranches={enabled:!0,collectors:p.map(e=>({...i({parentConfig:a,factTypeConfig:e}),factDetails:{factName:e.factName??u,numberOfDays:e.lastCommitMoreThanXDaysAgo}}))});const c=o.filter(e=>e.type===O);c.length&&(t.numberOfActivePullRequests={enabled:!0,collectors:c.map(e=>({...i({parentConfig:a,factTypeConfig:e}),factDetails:{factName:e.factName??O,numberOfDays:e.createdMoreThanXDaysAgo}}))});const n=o.filter(e=>e.type===b);n.length&&(t.numberOfWorkItems={enabled:!0,collectors:n.map(e=>({...i({parentConfig:a,factTypeConfig:e}),factDetails:{factName:e.factName??b,data:e.data?.length?e.data:[D(g,y)]}}))})}}return t}export{_ as BRANCH_POLICIES_COLLECTOR_TYPE,T as BRANCH_STATUS_COLLECTOR_TYPE,g as DEFAULT_NUMBER_OF_WORK_ITEMS_NAME,y as DEFAULT_NUMBER_OF_WORK_ITEMS_QUERY,O as NUMBER_OF_ACTIVE_PULL_REQUESTS_COLLECTOR_TYPE,u as NUMBER_OF_BRANCHES_COLLECTOR_TYPE,b as NUMBER_OF_WORK_ITEMS_COLLECTOR_TYPE,d as REPOSITORY_DETAILS_COLLECTOR_TYPE,N as defaultAzureDevOpsConfig,L as mapAzureDevOpsCollectorConfigToConfig,P as mapConfigToAzureDevOpsCollectorConfig,E as numberOfDaysCollectorConfig,R as numberOfWorkItemsCollectorConfig,D as numberOfWorkItemsDataConfig};
|
|
2
|
+
//# sourceMappingURL=utils.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{validNameRegex as O}from"@spotify/backstage-plugin-soundcheck-common";import{z as e}from"zod";import{FIELD_IS_REQUIRED_MSG as m}from"../../../../utils/validation.esm.js";import{CollectorOptionSchema as l,BaseCollectorSchema as _}from"../Common/CollectorOption.esm.js";import{REPOSITORY_DETAILS_COLLECTOR_TYPE as I,BRANCH_POLICIES_COLLECTOR_TYPE as C,BRANCH_STATUS_COLLECTOR_TYPE as h}from"./utils.esm.js";const o="Fact name is not unique",n="The field contains forbidden characters",i="Max 100 characters",b=e.object({factName:e.string().min(1,m).max(100,i).regex(O,n)}),d=b.merge(e.object({numberOfDays:e.number().min(0).optional().nullable()})).strict(),p=b.merge(e.object({data:e.array(e.strictObject({name:e.string().min(1,m).max(100,i).regex(O,n),query:e.string().min(1,m)})).min(1)})).strict(),f=c=>e.strictObject({enabled:e.boolean().optional(),collectors:e.array(_.extend({factDetails:c}))}),E=e.strictObject({repositoryDetails:l,branchPolicies:l,branchStatus:l,numberOfBranches:f(d),numberOfActivePullRequests:f(d),numberOfWorkItems:f(p)}).superRefine((c,r)=>{const u=[I,C,h,...c.numberOfBranches.collectors.map(t=>t.factDetails.factName),...c.numberOfActivePullRequests.collectors.map(t=>t.factDetails.factName),...c.numberOfWorkItems.collectors.map(t=>t.factDetails.factName)],s=u.filter((t,a)=>u.indexOf(t)!==a);s.length&&(c.numberOfBranches.collectors.forEach((t,a)=>{s.includes(t.factDetails.factName)&&r.addIssue({code:e.ZodIssueCode.custom,message:o,path:["numberOfBranches","collectors",a,"factDetails","factName"]})}),c.numberOfActivePullRequests.collectors.forEach((t,a)=>{s.includes(t.factDetails.factName)&&r.addIssue({code:e.ZodIssueCode.custom,message:o,path:["numberOfActivePullRequests","collectors",a,"factDetails","factName"]})}),c.numberOfWorkItems.collectors.forEach((t,a)=>{s.includes(t.factDetails.factName)&&r.addIssue({code:e.ZodIssueCode.custom,message:o,path:["numberOfWorkItems","collectors",a,"factDetails","factName"]})}))});export{o as FACT_NAME_IS_NOT_UNIQUE_MSG,n as INVALID_CHARACTERS_MSG,i as MAX_100_CHARACTERS_MSG,E as azureDevOpsCollectorFormSchema};
|
|
2
|
+
//# sourceMappingURL=validation.esm.js.map
|
package/dist/components/CollectorPage/Configurators/BigQuery/QueryFactDetailsComponent.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{makeStyles as f,Box as x,Grid as n,Typography as m,TextField as d,FormHelperText as T,Tooltip as b,IconButton as E}from"@material-ui/core";import N from"@material-ui/icons/Add";import C from"@material-ui/icons/Remove";import v from"classnames";import{highlight as
|
|
1
|
+
import{makeStyles as f,Box as x,Grid as n,Typography as m,TextField as d,FormHelperText as T,Tooltip as b,IconButton as E}from"@material-ui/core";import N from"@material-ui/icons/Add";import C from"@material-ui/icons/Remove";import v from"classnames";import{highlight as S,languages as F}from"prismjs";import"prismjs/components/prism-sql";import e from"react";import{useFormContext as I,useFieldArray as q,Controller as p}from"react-hook-form";import $ from"react-simple-code-editor";import{FormControlledSelect as h}from"../../../FormControlledSelect/FormControlledSelect.esm.js";import{FormFieldLabel as D}from"../../../FormFieldLabel/FormFieldLabel.esm.js";import*as L from"../Common/css/prism-dark-sql.css.esm.js";import{DATA_TYPES as _,FOREIGN_KEY_OPTIONS as k,DEFAULT_SCHEMA_ITEM as H}from"./utils.esm.js";const P=f(r=>({...L,root:{paddingTop:r.spacing(1)},textInput:{marginTop:0,width:"580px"},queryCaption:{width:"580px",display:"block"},queryInput:{marginTop:0,width:"580px",minHeight:"100px",maxHeight:"300px",overflowY:"scroll",outline:`1px solid ${r.palette.action.disabled}`,borderRadius:"6px",display:"grid","&:hover":{outlineColor:r.palette.textContrast}},queryInputError:{outlineColor:r.palette.error.main,"&:hover":{outlineColor:r.palette.error.main}},queryTextarea:{outline:"none"},caption:{margin:r.spacing(2,0)},nameInput:{marginTop:0,display:"inline"},selectInput:{marginTop:0,width:"150px"},helperText:{marginLeft:0}})),w=({name:r,disabled:o})=>{const a=P(),{control:l}=I(),{fields:u,insert:g,remove:y}=q({control:l,name:`${r}.schema`});return e.createElement(x,null,e.createElement(n,{container:!0,spacing:1,direction:"column",className:a.root},e.createElement(n,{item:!0},e.createElement(m,{variant:"subtitle2"},"Fact Name"),e.createElement(p,{name:`${r}.factName`,control:l,render:({field:i,fieldState:{error:t}})=>e.createElement(d,{...i,type:"text",variant:"outlined",margin:"dense",placeholder:"Fact Name",className:a.textInput,disabled:o,error:!!t,helperText:t?.message??"Fact name must be unique",FormHelperTextProps:{className:a.helperText}})})),e.createElement(n,{item:!0},e.createElement(m,{variant:"subtitle2"},"GCP Project ID (Optional)"),e.createElement(p,{name:`${r}.projectId`,control:l,render:({field:i,fieldState:{error:t}})=>e.createElement(d,{...i,type:"text",variant:"outlined",margin:"dense",placeholder:"Project ID",className:a.textInput,disabled:o,error:!!t,helperText:t?.message??"Google Cloud project ID",FormHelperTextProps:{className:a.helperText}})})),e.createElement(n,{item:!0},e.createElement(D,{title:"SQL Query (GoogleSQL)",docLink:"https://cloud.google.com/bigquery/docs/introduction-sql"}),e.createElement(m,{variant:"caption",className:a.queryCaption},"The query can be parameterized, supported named parameters are @entity_refs and @entity_names (the values will be resolved automatically)"),e.createElement(p,{name:`${r}.query`,control:l,render:({field:i,fieldState:{error:t}})=>e.createElement(e.Fragment,null,e.createElement("div",{className:v(a.queryInput,t?a.queryInputError:void 0)},e.createElement($,{...i,highlight:c=>S(c,F.sql,"sql"),onValueChange:i.onChange,padding:10,disabled:o,placeholder:"Example: SELECT * FROM [bigquery-data:catalog.entities] WHERE entity_ref IN UNNEST(@entity_refs)",textareaClassName:a.queryTextarea})),e.createElement(T,{className:a.helperText,error:!!t},t?.message??"Consider updating the collector's batch size to schedule the query for multiple entities at once"))}))),e.createElement("div",{className:a.caption},e.createElement(m,{variant:"subtitle1"},"Output Schema"),e.createElement(m,{variant:"caption"},"List the columns returned by the query")),e.createElement(n,{container:!0,spacing:0,direction:"column"},u.map((i,t)=>e.createElement(n,{item:!0,container:!0,alignItems:"center",spacing:2,key:i.id},e.createElement(n,{item:!0},e.createElement(m,{variant:"subtitle2"},"Column Name"),e.createElement(p,{name:`${r}.schema.${t}.name`,control:l,render:({field:c,fieldState:{error:s}})=>e.createElement(d,{...c,type:"text",variant:"outlined",margin:"dense",placeholder:"Column Name",className:a.nameInput,disabled:o,error:!!s,helperText:s?.message??" ",FormHelperTextProps:{className:a.helperText}})})),e.createElement(n,{item:!0},e.createElement(m,{variant:"subtitle2"},"Data Type"),e.createElement(p,{name:`${r}.schema.${t}.type`,control:l,render:({field:c,fieldState:{error:s}})=>e.createElement(h,{...c,control:l,placeholder:"Data Type",options:_,disabled:o,helperText:s?.message??" "})})),e.createElement(n,{item:!0},e.createElement(b,{placement:"top",title:"Select a value if the column is a foreign key that references a catalog entity field"},e.createElement(m,{variant:"subtitle2"},"Foreign Key")),e.createElement(p,{name:`${r}.schema.${t}.foreignKey`,control:l,render:({field:c,fieldState:{error:s}})=>e.createElement(h,{...c,control:l,placeholder:"Foreign Key",options:k,disabled:o,helperText:s?.message??" "})})),e.createElement(n,{item:!0},e.createElement(E,{onClick:()=>y(t),disabled:o||u.length===1},e.createElement(C,{fontSize:"small"})),e.createElement(E,{onClick:()=>g(t+1,H),disabled:o},e.createElement(N,{fontSize:"small"})))))))};export{w as QueryFactDetailsComponent};
|
|
2
2
|
//# sourceMappingURL=QueryFactDetailsComponent.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{makeStyles as d,Paper as u}from"@material-ui/core";import o from"react";import{useForm as S,FormProvider as E}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"../../../../hooks/useSoundcheckAlert.esm.js";import{useConfirmationModal as v}from"../../../../hooks/useConfirmationModal.esm.js";import{useNavigateBack as b}from"../../../../hooks/useNavigateBack.esm.js";import{useUpdateCollectorConfig as h}from"../../../../hooks/collectors/useUpdateCollectorConfig.esm.js";import{integrationsPageRouteRef as y}from"../../../../routes.esm.js";import{FooterButtons as B}from"../../../FooterButtons/FooterButtons.esm.js";import"../../../SoundcheckHeader/SoundcheckHeader.esm.js";import"../../../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as w}from"../../../SoundcheckHeader/useHeader.esm.js";import{FactCollectionConfig as F}from"../Common/FactCollectionConfig.esm.js";import{collectorHeaderContent as T,confirmationModalContent as k}from"../Common/utils.esm.js";import{mapConfigToCatalogCollectorConfig as D,defaultCatalogConfig as M,mapCatalogCollectorConfigToConfig as N}from"./utils.esm.js";const P=d(t=>({spacer:{height:t.spacing(8),width:"100%"},section:{marginBottom:t.spacing(2)},form:{marginBottom:t.spacing(2)}})),x=({disabled:t,selectedCollector:e})=>{const r=S({defaultValues:e?D(e.config):M(),mode:"onChange"}),{formState:{errors:n},handleSubmit:a}=r,i=P(),l=!!n.entityDescriptor,{mutateAsync:c}=h(),[s,p]=b(y),{showModal:f}=v(),m=async g=>{if(!await f(k(e)))return;const C=N(g);await c({collectorId:e.id,config:C})&&p()};return w(T(e)),o.createElement(o.Fragment,null,o.createElement(u,{className:i.form},o.createElement(E,{...r},o.createElement("form",{onSubmit:a(m)},o.createElement(F,{name:"entityDescriptor",label:"Entity Descriptor",description:"Collects entities from Backstage's Software Catalog.",disabled:t})))),o.createElement("div",{className:i.section},o.createElement(B,{onCancel:s,saveButtonText:"Save",isLoading:!1,onSave:a(m),disableSave:l})))};export{x as CatalogConfigurator};
|
|
2
|
+
//# sourceMappingURL=CatalogConfigurator.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{defaultCollectorOption as f}from"../Common/CollectorOption.esm.js";import{mapBackendConfigToFormIntegrationConfig as a,mapFormIntegrationConfigToBackendConfig as C}from"../Common/utils.esm.js";const e="entity_descriptor",i=o=>({entityDescriptor:f(o)});function g(o){const{entityDescriptor:t}=o;return t.enabled?{collects:C({factType:e,configOption:t})}:{}}function l(o){const t=i(o);if(o){const n=o.collects;if(n){const r=n.type,c={...a({factTypeConfig:n,parentConfig:o}),enabled:!0};r===e&&(t.entityDescriptor=c)}}return t}export{e as ENTITY_DESCRIPTOR_COLLECTOR_TYPE,i as defaultCatalogConfig,g as mapCatalogCollectorConfigToConfig,l as mapConfigToCatalogCollectorConfig};
|
|
2
|
+
//# sourceMappingURL=utils.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{z as t}from"zod";import{FrequencySchema as
|
|
1
|
+
import{z as t}from"zod";import{FrequencySchema as l,formFiltersSchema as m,CacheConfigSchema as u}from"../../../../utils/validation.esm.js";import{mapToCacheConfig as p,defaultCacheConfig as y}from"../../../CacheConfig/utils.esm.js";import"../../../CacheConfig/CacheConfigComponent.esm.js";import{mapCatalogFilterToFilters as o,mapCatalogFilterToFormKeyValueFilters as i}from"../../../Filter/utils.esm.js";import"../../../Filter/FilterComponent.esm.js";import{emptyFilters as r,emptyKeyValueFilters as a}from"../../../Filter/types.esm.js";import"../../../Frequency/types.esm.js";import{mapHumanDurationOrCronToFrequency as c,defaultFrequency as d}from"../../../Frequency/util.esm.js";import"../../../Frequency/FrequencyComponent.esm.js";const n=(e={})=>({filters:{filter:e?.filter&&typeof e.filter=="object"?o(e.filter):{...r(),selectedKinds:["Component"]},keyValueFilter:e?.filter&&typeof e.filter=="object"?i(e.filter):a(),excludeFilter:e?.exclude&&typeof e.exclude=="object"?o(e.exclude):r(),excludeKeyValueFilter:e?.exclude&&typeof e.exclude=="object"?i(e.exclude):a()},frequency:e?.frequency?c(e.frequency):d(),cacheConfig:e?.cache?p(e.cache):y(),batchSize:e?.batchSize,initialDelay:e?.initialDelay?c(e.initialDelay):void 0}),h=(e={})=>({enabled:!1,...n(e)}),f=t.object({frequency:l,filters:m,cacheConfig:u,initialDelay:l.optional(),batchSize:t.number().min(1,"Batch size should be at least 1").optional().nullable()}),s=f.extend({enabled:t.boolean()}).strict();export{f as BaseCollectorSchema,s as CollectorOptionSchema,n as defaultBaseCollectorOption,h as defaultCollectorOption};
|
|
2
2
|
//# sourceMappingURL=CollectorOption.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{makeStyles as
|
|
1
|
+
import{makeStyles as I,FormControlLabel as K,Switch as R,Box as G,Typography as h,Divider as L,Tabs as O,Tab as d,Grid as b,Button as v}from"@material-ui/core";import W from"@material-ui/icons/Add";import Z from"@material-ui/icons/Remove";import e,{useState as j}from"react";import{useFormContext as q,useFieldArray as H,useWatch as J,Controller as F}from"react-hook-form";import{validateCacheConfig as M}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 P}from"../../../CacheConfig/CacheConfigComponent.esm.js";import"@backstage/catalog-model";import"@spotify/backstage-plugin-soundcheck-common";import{FilterComponent as Q}from"../../../Filter/FilterComponent.esm.js";import{CollectorSchedulingOptions as U}from"./CollectorSchedulingOptions.esm.js";const X=I(t=>({root:{padding:t.spacing(1.5,6)},tabsContainer:{marginRight:16},tab:{height:"64px",textAlign:"left"},contentContainer:{width:"100%",padding:t.spacing(1)},divider:{marginTop:t.spacing(1),marginBottom:t.spacing(1)},switchTrack:{backgroundColor:`${t.palette.primary.main} !important`},buttonsContainer:{marginTop:t.spacing(1),marginBottom:t.spacing(2)}})),f="FactDetails",g="Schedule",y="Filters",x="Caching",Y=({name:t,label:C,description:N,disabled:o,FactDetailsComponent:m,multipleCollectors:n})=>{const{control:s,formState:k}=q(),E=k.errors?.[t],{fields:S,insert:D,remove:T}=H({control:s,name:n?.enable?`${t}.collectors`:t}),p=n?.enable?S:[{id:t}],$=m?f:g,[r,u]=j(Array(p.length).fill($)),V=(a,l,c)=>{u([...r.slice(0,c),l,...r.slice(c+1)])},w=a=>{D(a+1,n?.defaultConfig),u([...r.slice(0,a+1),$,...r.slice(a+1)])},A=a=>{T(a),u([...r.slice(0,a),...r.slice(a+1)])},B=J({control:s,name:`${t}.enabled`}),i=X();return e.createElement("div",{className:i.root},e.createElement(F,{name:`${t}.enabled`,control:s,render:({field:a})=>e.createElement(K,{control:e.createElement(R,{...a,checked:a.value,"data-testid":`${t}-switch`,classes:{track:a.value?i.switchTrack:void 0},disabled:o}),label:e.createElement(G,{display:"flex",flexDirection:"column"},e.createElement(h,{variant:"body1",component:"span"},e.createElement("b",null,`${C}`)),e.createElement(h,{variant:"caption",color:"textSecondary",component:"p"},`${N}`))})}),B&&e.createElement("div",null,p.map((a,l)=>e.createElement("div",{key:a.id},l!==0&&e.createElement(L,{className:i.divider}),e.createElement(O,{orientation:"horizontal",variant:"scrollable",value:r[l],onChange:(c,z)=>V(c,z,l),className:i.tabsContainer},m&&e.createElement(d,{label:"Fact Details",value:f,className:i.tab}),e.createElement(d,{label:"Schedule",value:g,className:i.tab}),e.createElement(d,{label:"Filters",value:y,className:i.tab}),e.createElement(d,{label:"Caching",value:x,className:i.tab})),e.createElement("div",{className:i.contentContainer},r[l]===f&&m&&e.createElement(m,{name:n?.enable?`${t}.collectors.${l}.factDetails`:`${t}.factDetails`,disabled:o}),r[l]===g&&e.createElement(e.Fragment,null,e.createElement(U,{name:n?.enable?`${t}.collectors.${l}`:t})),r[l]===y&&e.createElement(Q,{disabled:o,filterName:n?.enable?`${t}.collectors.${l}.filters.filter`:`${t}.filters.filter`,keyValueFilterName:n?.enable?`${t}.collectors.${l}.filters.keyValueFilter`:`${t}.filters.keyValueFilter`,excludeFilterName:n?.enable?`${t}.collectors.${l}.filters.excludeFilter`:`${t}.filters.excludeFilter`,excludeKeyValueFilterName:n?.enable?`${t}.collectors.${l}.filters.excludeKeyValueFilter`:`${t}.filters.excludeKeyValueFilter`}),r[l]===x&&e.createElement(F,{name:n?.enable?`${t}.collectors.${l}.cacheConfig`:`${t}.cacheConfig`,control:s,rules:{validate:M},render:({field:c})=>e.createElement(P,{disabled:o,value:c.value,onChange:c.onChange,errors:n?.enable?E?.collectors?.[l]?.cacheConfig:E?.cacheConfig})})),n?.enable&&e.createElement(b,{container:!0,spacing:1,className:i.buttonsContainer},p.length>1&&e.createElement(b,{item:!0},e.createElement(v,{startIcon:e.createElement(Z,null),onClick:()=>A(l),disabled:o,variant:"outlined",size:"small",color:"secondary"},"Remove")),e.createElement(b,{item:!0},e.createElement(v,{startIcon:e.createElement(W,null),onClick:()=>w(l),disabled:o,variant:"outlined",size:"small",color:"primary"},"Add ",C)))))))};export{Y as FactCollectionConfig};
|
|
2
2
|
//# sourceMappingURL=FactCollectionConfig.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{mapToCacheConfig as
|
|
1
|
+
import{mapToCacheConfig as c,mapCacheConfigToHumanDurationOrBoolean as f}from"../../../CacheConfig/utils.esm.js";import"../../../CacheConfig/CacheConfigComponent.esm.js";import{mapCatalogFilterToFilters as o,mapCatalogFilterToFormKeyValueFilters as a,mapFiltersToCatalogFilter as r}from"../../../Filter/utils.esm.js";import"../../../Filter/FilterComponent.esm.js";import"../../../Frequency/types.esm.js";import{mapHumanDurationOrCronToFrequency as n,mapFrequencyToHumanDurationOrCron as l}from"../../../Frequency/util.esm.js";import"../../../Frequency/FrequencyComponent.esm.js";const u=e=>({title:e.name??e.id,description:e.description,docLink:`https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/fact-collectors/3p-integrations/${e.id}`}),m=e=>({title:"Update Integration",message:`Are you sure you want to update the ${e.name} integration?`,error:!1}),p=({configOption:e,factType:i,additionalParams:t={}})=>({type:i,frequency:l(e.frequency),filter:r(e.filters.filter,e.filters.keyValueFilter),exclude:r(e.filters.excludeFilter,e.filters.excludeKeyValueFilter),cache:f(e.cacheConfig),batchSize:e.batchSize??void 0,initialDelay:e.initialDelay?l(e.initialDelay):void 0,...t}),d=({parentConfig:e,factTypeConfig:i})=>{const t=i.initialDelay??e.initialDelay;return{frequency:n(i.frequency??e.frequency),filters:{filter:o(i.filter??e.filter),keyValueFilter:a(i.filter??e.filter),excludeFilter:o(i.exclude??e.exclude),excludeKeyValueFilter:a(i.exclude??e.exclude)},cacheConfig:c(i.cache??e.cache),batchSize:i.batchSize??e.batchSize,initialDelay:t?n(t):void 0}};export{u as collectorHeaderContent,m as confirmationModalContent,d as mapBackendConfigToFormIntegrationConfig,p as mapFormIntegrationConfigToBackendConfig};
|
|
2
2
|
//# sourceMappingURL=utils.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"react";import{
|
|
1
|
+
import t from"react";import{AzureDevOpsConfigurator as i}from"./AzureDevOps/AzureDevOpsConfigurator.esm.js";import{BigQueryConfigurator as e}from"./BigQuery/BigQueryConfigurator.esm.js";import{CatalogConfigurator as a}from"./Catalog/CatalogConfigurator.esm.js";import{DataDogConfigurator as m}from"./DataDog/DataDogConfigurator.esm.js";import{GithubConfigurator as f}from"./Github/GithubConfigurator.esm.js";import{GitlabConfigurator as u}from"./Gitlab/GitlabConfigurator.esm.js";import{HttpConfigurator as g}from"./HTTP/HttpConfigurator.esm.js";import{JiraConfigurator as n}from"./Jira/JiraConfigurator.esm.js";import{KubernetesConfigurator as p}from"./Kubernetes/KubernetesConfigurator.esm.js";import{NewRelicConfigurator as C}from"./NewRelic/NewRelicConfigurator.esm.js";import{PagerDutyConfigurator as c}from"./PagerDuty/PagerDutyConfigurator.esm.js";import{ScmConfigurator as l}from"./SCM/ScmConfigurator.esm.js";import{SonarQubeConfigurator as b}from"./SonarQube/SonarQubeConfigurator.esm.js";const s={github:f,gitlab:u,scm:l,pagerduty:c,datadog:m,kubernetes:p,jira:n,sonarqube:b,newrelic:C,bigquery:e,catalog:a,azure:i,http:g},d=({selectedCollector:r})=>{const o=s[r?.id];return t.createElement(o,{selectedCollector:r})};export{d as Configurator};
|
|
2
2
|
//# sourceMappingURL=Configurator.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{zodResolver as v}from"@hookform/resolvers/zod";import{makeStyles as S,Paper as h}from"@material-ui/core";import e,{useCallback as F}from"react";import{useForm as q,FormProvider as E}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"../../../../hooks/useSoundcheckAlert.esm.js";import{useConfirmationModal as H}from"../../../../hooks/useConfirmationModal.esm.js";import{useNavigateBack as R}from"../../../../hooks/useNavigateBack.esm.js";import{useUpdateCollectorConfig as T}from"../../../../hooks/collectors/useUpdateCollectorConfig.esm.js";import{integrationsPageRouteRef as w}from"../../../../routes.esm.js";import{FooterButtons as y}from"../../../FooterButtons/FooterButtons.esm.js";import"../../../SoundcheckHeader/SoundcheckHeader.esm.js";import"../../../SoundcheckHeader/SoundcheckHeaderContext.esm.js";import{useHeader as B}from"../../../SoundcheckHeader/useHeader.esm.js";import{FactCollectionConfig as P}from"../Common/FactCollectionConfig.esm.js";import{collectorHeaderContent as k,confirmationModalContent as M}from"../Common/utils.esm.js";import{RequestFactDetailsComponent as N}from"./RequestFactDetailsComponent.esm.js";import{mapConfigToHttpCollectorConfig as x,defaultHttpConfig as A,defaultRequestCollectorConfig as D,mapHttpCollectorConfigToConfig as V}from"./utils.esm.js";import{httpCollectorFormSchema as z}from"./validation.esm.js";const I=S(t=>({spacer:{height:t.spacing(8),width:"100%"},section:{marginBottom:t.spacing(2)}})),L=({disabled:t,selectedCollector:o})=>{const s=F(async(r,...a)=>{const g={enabled:!1,collectors:[]},b={request:r.request.enabled?r.request:g};return v(z)(b,...a)},[]),i=q({defaultValues:o?x(o.config):A(),mode:"onChange",resolver:s}),{formState:{isValid:c},handleSubmit:m}=i,n=I(),p=!c,{mutateAsync:f}=T(),[d,u]=R(w),{showModal:C}=H(),l=async r=>{if(!await C(M(o)))return;const a=V(r);await f({collectorId:o.id,config:a})&&u()};return B(k(o)),e.createElement(e.Fragment,null,e.createElement(h,{className:n.section},e.createElement(E,{...i},e.createElement("form",{onSubmit:m(l)},e.createElement(P,{name:"request",label:"Request",description:"Collects data from HTTP endpoint.",disabled:t,FactDetailsComponent:N,multipleCollectors:{enable:!0,defaultConfig:D()}})))),e.createElement("div",{className:n.section},e.createElement(y,{onCancel:d,saveButtonText:"Save",isLoading:!1,onSave:m(l),disableSave:p})))};export{L as HttpConfigurator};
|
|
2
|
+
//# sourceMappingURL=HttpConfigurator.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Grid as a,TextField as p,MenuItem as f,FormHelperText as x,Typography as y,IconButton as g}from"@material-ui/core";import T from"@material-ui/icons/Add";import k from"@material-ui/icons/Remove";import q from"classnames";import{highlight as N,languages as b}from"prismjs";import"prismjs/components/prism-json";import e from"react";import{useFormContext as H,useFieldArray as I,Controller as s}from"react-hook-form";import v from"react-simple-code-editor";import{FormFieldLabel as m}from"../../../FormFieldLabel/FormFieldLabel.esm.js";import{useStyles as S}from"./RequestFactDetailsComponent.esm.js";import{HTTP_METHOD_OPTIONS as P,defaultNewHeaderConfig as F}from"./utils.esm.js";const $=({name:c,disabled:o})=>{const r=S(),{control:i}=H(),{fields:u,insert:h,remove:E}=I({control:i,name:`${c}.headers`});return e.createElement(a,{container:!0,spacing:1,direction:"column",className:r.root},e.createElement(a,{item:!0},e.createElement(m,{title:"Target Plugin ID (Optional)",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/fact-collectors/3p-integrations/http#request-required"}),e.createElement(s,{name:`${c}.targetPluginId`,control:i,render:({field:l,fieldState:{error:t}})=>e.createElement(p,{...l,fullWidth:!0,type:"text",variant:"outlined",margin:"dense",placeholder:"Example: soundcheck",className:r.textInput,disabled:o,error:!!t,helperText:t?.message??"Specify if calling a plugin's API to use {{targetPluginBaseUrl}} and {{targetPluginAuthToken}} template tags",FormHelperTextProps:{className:r.helperText}})})),e.createElement(a,{item:!0},e.createElement(m,{title:"Request URL",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/fact-collectors/3p-integrations/http#request-required"}),e.createElement(a,{container:!0,spacing:1,direction:"row"},e.createElement(a,{item:!0,xs:2},e.createElement(s,{name:`${c}.method`,control:i,render:({field:l,fieldState:{error:t}})=>e.createElement(p,{...l,fullWidth:!0,select:!0,type:"text",variant:"outlined",margin:"dense",placeholder:"Method",className:r.textInput,disabled:o,error:!!t,helperText:t?.message??"Method",FormHelperTextProps:{className:r.helperText}},P.map(n=>e.createElement(f,{key:n,value:n},n)))})),e.createElement(a,{item:!0,xs:10},e.createElement(s,{name:`${c}.url`,control:i,render:({field:l,fieldState:{error:t}})=>e.createElement(p,{...l,fullWidth:!0,type:"text",variant:"outlined",margin:"dense",placeholder:"Example: https://api.example.com/{{entity.metadata.name}}/get",className:r.textInput,disabled:o,error:!!t,helperText:t?.message??"Request URL can use liquid template language",FormHelperTextProps:{className:r.helperText}})})))),e.createElement(a,{item:!0},e.createElement(m,{title:"Request Body (Optional)",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/fact-collectors/3p-integrations/http#request-required"}),e.createElement(s,{name:`${c}.body`,control:i,render:({field:l,fieldState:{error:t}})=>e.createElement("div",null,e.createElement("div",{className:q(r.jsonInput,t?r.jsonInputError:void 0)},e.createElement(v,{...l,highlight:n=>N(n??"",b.json,"json"),onValueChange:l.onChange,padding:10,disabled:o,placeholder:"Request Body",textareaClassName:r.jsonTextarea})),e.createElement(x,{className:r.helperText,error:!!t},t?.message??"Request body can use liquid template language"))})),e.createElement(a,{item:!0},e.createElement(a,{container:!0,spacing:0,direction:"column"},e.createElement(m,{title:"Request Headers (Optional)",docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/fact-collectors/3p-integrations/http#request-required"}),e.createElement(y,{color:"textSecondary",variant:"caption"},"Header keys and values can use liquid template language"),u.map((l,t)=>e.createElement(a,{item:!0,container:!0,alignItems:"center",spacing:2,key:l.id},e.createElement(a,{item:!0,xs:5},e.createElement(m,{title:"Key"}),e.createElement(s,{name:`${c}.headers.${t}.key`,control:i,render:({field:n,fieldState:{error:d}})=>e.createElement(p,{...n,fullWidth:!0,type:"text",variant:"outlined",margin:"dense",placeholder:"Header Key",className:r.textInput,disabled:o,error:!!d,helperText:d?.message??" ",FormHelperTextProps:{className:r.helperText}})})),e.createElement(a,{item:!0,xs:5},e.createElement(m,{title:"Value"}),e.createElement(s,{name:`${c}.headers.${t}.value`,control:i,render:({field:n,fieldState:{error:d}})=>e.createElement(p,{...n,fullWidth:!0,type:"text",variant:"outlined",margin:"dense",placeholder:"Header Value",className:r.textInput,disabled:o,error:!!d,helperText:d?.message??" ",FormHelperTextProps:{className:r.helperText}})})),e.createElement(a,{item:!0,xs:2},e.createElement(g,{onClick:()=>E(t),disabled:o||u.length===1},e.createElement(k,{fontSize:"small"})),e.createElement(g,{onClick:()=>h(t+1,F()),disabled:o},e.createElement(T,{fontSize:"small"}))))))))};export{$ as HttpRequestComponent};
|
|
2
|
+
//# sourceMappingURL=HttpRequestComponent.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Grid as a,TextField as p,FormHelperText as d}from"@material-ui/core";import h from"classnames";import{highlight as f,languages as g}from"prismjs";import"prismjs/components/prism-json";import e from"react";import{useFormContext as u,Controller as m}from"react-hook-form";import E from"react-simple-code-editor";import{FormFieldLabel as i}from"../../../FormFieldLabel/FormFieldLabel.esm.js";import{HttpStatusesInput as x}from"./HttpStatusesInput.esm.js";import{useStyles as S}from"./RequestFactDetailsComponent.esm.js";const T=({name:n,disabled:l})=>{const r=S(),{control:s}=u();return e.createElement(a,{container:!0,spacing:1,direction:"column",className:r.root},e.createElement(a,{item:!0},e.createElement(i,{title:"Transform Response (Optional)",docLink:"https://docs.jsonata.org/overview.html"}),e.createElement(m,{name:`${n}.transform`,control:s,render:({field:o,fieldState:{error:t}})=>e.createElement(p,{...o,fullWidth:!0,type:"text",variant:"outlined",margin:"dense",placeholder:"JSONata expression",className:r.textInput,disabled:l,error:!!t,helperText:t?.message??"JSONata expression to transform the original HTTP response",FormHelperTextProps:{className:r.helperText}})})),e.createElement(a,{item:!0},e.createElement(i,{title:"Response JSON Schema (Optional)",docLink:"https://json-schema.org/docs"}),e.createElement(m,{name:`${n}.schema`,control:s,render:({field:o,fieldState:{error:t}})=>e.createElement("div",null,e.createElement("div",{className:h(r.jsonInput,t?r.jsonInputError:void 0)},e.createElement(E,{...o,highlight:c=>f(c??"",g.json,"json"),onValueChange:o.onChange,padding:10,disabled:l,placeholder:"JSON Schema",textareaClassName:r.jsonTextarea})),e.createElement(d,{className:r.helperText,error:!!t},t?.message??"JSON schema of the final HTTP response"))})),e.createElement(a,{item:!0},e.createElement(i,{title:"Empty Response on Status Codes (Optional)"}),e.createElement(m,{name:`${n}.emptyOnStatuses`,control:s,render:({field:o,fieldState:{error:t}})=>e.createElement(x,{disabled:l,value:o.value,onChange:o.onChange,errors:t,helperText:"Collect an empty fact instead of throwing a collection error"})})))};export{T as HttpResponseComponent};
|
|
2
|
+
//# sourceMappingURL=HttpResponseComponent.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Grid as n,TextField as c}from"@material-ui/core";import t from"react";import{useFormContext as u,Controller as s}from"react-hook-form";import{FormFieldLabel as d}from"../../../FormFieldLabel/FormFieldLabel.esm.js";import{HttpStatusesInput as f}from"./HttpStatusesInput.esm.js";import{useStyles as g}from"./RequestFactDetailsComponent.esm.js";const x=({name:o,disabled:i})=>{const l=g(),{control:m}=u(),p=(e,r)=>{if(e.target.value){const a=parseInt(e.target.value,10)??null;r({...e,target:{...e.target,value:a}})}else r({...e,target:{...e.target,value:null}})};return t.createElement(n,{container:!0,spacing:1,direction:"column",className:l.root},t.createElement(n,{item:!0},t.createElement(d,{title:"Max Number of Retries (Optional)"}),t.createElement(s,{name:`${o}.maxRetries`,control:m,render:({field:e,fieldState:{error:r}})=>t.createElement(c,{...e,fullWidth:!0,onChange:a=>p(a,e.onChange),type:"number",variant:"outlined",margin:"dense",placeholder:"Example: 3",className:l.textInput,disabled:i,error:!!r,helperText:r?.message??"If not provided failed requests won't be retried",FormHelperTextProps:{className:l.helperText}})})),t.createElement(n,{item:!0},t.createElement(d,{title:"Retry Delay in Milliseconds (Optional)"}),t.createElement(s,{name:`${o}.retryDelay`,control:m,render:({field:e,fieldState:{error:r}})=>t.createElement(c,{...e,fullWidth:!0,onChange:a=>p(a,e.onChange),type:"number",variant:"outlined",margin:"dense",placeholder:"Example: 60000",className:l.textInput,disabled:i,error:!!r,helperText:r?.message??"If not provided failed requests will be retried immediately",FormHelperTextProps:{className:l.helperText}})})),t.createElement(n,{item:!0},t.createElement(d,{title:"Retry on Status Codes (Optional)"}),t.createElement(s,{name:`${o}.retryOnStatuses`,control:m,render:({field:e,fieldState:{error:r}})=>t.createElement(f,{disabled:i,value:e.value,onChange:e.onChange,errors:r,helperText:"If not provided all failed requests will be retried"})})))};export{x as HttpRetriesComponent};
|
|
2
|
+
//# sourceMappingURL=HttpRetriesComponent.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{makeStyles as h,Box as u,Chip as g,TextField as x,FormControlLabel as T,Checkbox as E}from"@material-ui/core";import C from"@material-ui/icons/CheckBox";import S from"@material-ui/icons/CheckBoxOutlineBlank";import{Autocomplete as N}from"@material-ui/lab";import l,{useState as v,useEffect as k}from"react";import{ListboxVirtualized as I}from"../../../ListboxVirtualized/ListboxVirtualized.esm.js";import{HTTP_STATUSES as i}from"./utils.esm.js";const L=h(r=>({statusInput:{marginTop:0},statusChips:{marginBottom:r.spacing(1)},helperText:{marginLeft:0}})),z=({value:r,onChange:s,disabled:n,errors:p,helperText:d})=>{const m=L(),[o,c]=v(r??[]);k(()=>{s&&s(o.map(e=>Number(e)))},[o,s]);const b=(e,t)=>{c(o?.filter(a=>a!==t))},f=(e,t)=>{const a=t.length?t[t.length-1]:void 0;a&&isNaN(Number(a))||c(t)};return l.createElement(u,null,l.createElement(u,null,o.map(e=>l.createElement(g,{key:e,label:e,size:"small",className:m.statusChips,onDelete:t=>b(t,e),clickable:!1,disabled:n}))),l.createElement(N,{disableCloseOnSelect:!0,fullWidth:!0,multiple:!0,freeSolo:!0,popupIcon:null,renderTags:()=>null,disabled:n,options:i.map(e=>e.value),getOptionLabel:e=>i.find(t=>t.value===e)?.label??"",value:o,onChange:(e,t)=>f(e,t),ListboxComponent:I,ListboxProps:{itemHeight:40},renderInput:e=>l.createElement(x,{...e,variant:"outlined",margin:"dense",className:m.statusInput,placeholder:"Example: 500",disabled:n,error:!!p,helperText:p?.message??d,FormHelperTextProps:{className:m.helperText}}),renderOption:(e,{selected:t})=>l.createElement(T,{onClick:a=>a.preventDefault(),control:l.createElement(E,{icon:l.createElement(S,{fontSize:"small"}),checkedIcon:l.createElement(C,{fontSize:"small"}),checked:t,disabled:n}),label:i.find(a=>a.value===e)?.label??""})}))};export{z as HttpStatusesInput};
|
|
2
|
+
//# sourceMappingURL=HttpStatusesInput.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{makeStyles as u,Box as x,TextField as E,Tabs as b,Tab as m}from"@material-ui/core";import e,{useState as f}from"react";import{useFormContext as h,Controller as g}from"react-hook-form";import{FormFieldLabel as C}from"../../../FormFieldLabel/FormFieldLabel.esm.js";import{HttpRequestComponent as T}from"./HttpRequestComponent.esm.js";import{HttpResponseComponent as v}from"./HttpResponseComponent.esm.js";import{HttpRetriesComponent as F}from"./HttpRetriesComponent.esm.js";const p=u(t=>({root:{paddingTop:t.spacing(1),width:"800px"},textInput:{marginTop:0},jsonInput:{marginTop:0,width:"100%",minHeight:"100px",maxHeight:"300px",overflowY:"scroll",outline:`1px solid ${t.palette.action.disabled}`,borderRadius:"4px",display:"grid","&:hover":{outlineColor:t.palette.textContrast}},jsonInputError:{outlineColor:t.palette.error.main,"&:hover":{outlineColor:t.palette.error.main}},jsonTextarea:{outline:"none"},helperText:{marginLeft:0}}));function i({children:t,value:r,index:a,className:o}){return e.createElement("div",{hidden:r!==a,className:o},r===a&&t)}const N=({name:t,disabled:r})=>{const a=p(),{control:o}=h(),[n,d]=f(0),c=(s,l)=>{d(l)};return e.createElement(x,{className:a.root},e.createElement(C,{title:"Fact Name"}),e.createElement(g,{name:`${t}.factName`,control:o,render:({field:s,fieldState:{error:l}})=>e.createElement(E,{...s,fullWidth:!0,type:"text",variant:"outlined",margin:"dense",placeholder:"Fact Name",className:a.textInput,disabled:r,error:!!l,helperText:l?.message??"Fact name must be unique",FormHelperTextProps:{className:a.helperText}})}),e.createElement(b,{value:n,onChange:c},e.createElement(m,{label:"Request"}),e.createElement(m,{label:"Response"}),e.createElement(m,{label:"Retries"})),e.createElement(i,{value:n,index:0},e.createElement(T,{name:`${t}.request`,disabled:r})),e.createElement(i,{value:n,index:1},e.createElement(v,{name:`${t}.response`,disabled:r})),e.createElement(i,{value:n,index:2},e.createElement(F,{name:`${t}.retries`,disabled:r})))};export{N as RequestFactDetailsComponent,p as useStyles};
|
|
2
|
+
//# sourceMappingURL=RequestFactDetailsComponent.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{asArray as d}from"@spotify/backstage-plugin-soundcheck-common";import{defaultBaseCollectorOption as b}from"../Common/CollectorOption.esm.js";import{mapBackendConfigToFormIntegrationConfig as f,mapFormIntegrationConfigToBackendConfig as p}from"../Common/utils.esm.js";const m=["GET","POST"],n="GET",g=[{value:"100",label:"100 Continue"},{value:"101",label:"101 Switching Protocols"},{value:"102",label:"102 Processing"},{value:"103",label:"103 Early Hints"},{value:"200",label:"200 OK"},{value:"201",label:"201 Created"},{value:"202",label:"202 Accepted"},{value:"203",label:"203 Non-Authoritative Information"},{value:"204",label:"204 No Content"},{value:"205",label:"205 Reset Content"},{value:"206",label:"206 Partial Content"},{value:"207",label:"207 Multi-Status"},{value:"208",label:"208 Already Reported"},{value:"226",label:"226 IM Used"},{value:"300",label:"300 Multiple Choices"},{value:"301",label:"301 Moved Permanently"},{value:"302",label:"302 Found"},{value:"303",label:"303 See Other"},{value:"304",label:"304 Not Modified"},{value:"305",label:"305 Use Proxy"},{value:"306",label:"306 Switch Proxy"},{value:"307",label:"307 Temporary Redirect"},{value:"308",label:"308 Permanent Redirect"},{value:"400",label:"400 Bad Request"},{value:"401",label:"401 Unauthorized"},{value:"402",label:"402 Payment Required"},{value:"403",label:"403 Forbidden"},{value:"404",label:"404 Not Found"},{value:"405",label:"405 Method Not Allowed"},{value:"406",label:"406 Not Acceptable"},{value:"407",label:"407 Proxy Authentication Required"},{value:"408",label:"408 Request Timeout"},{value:"409",label:"409 Conflict"},{value:"410",label:"410 Gone"},{value:"411",label:"411 Length Required"},{value:"412",label:"412 Precondition Failed"},{value:"413",label:"413 Payload Too Large"},{value:"414",label:"414 URI Too Long"},{value:"415",label:"415 Unsupported Media Type"},{value:"416",label:"416 Range Not Satisfiable"},{value:"417",label:"417 Expectation Failed"},{value:"418",label:"418 I'm a teapot"},{value:"421",label:"421 Misdirected Request"},{value:"422",label:"422 Unprocessable Content"},{value:"423",label:"423 Locked"},{value:"424",label:"424 Failed Dependency"},{value:"425",label:"425 Too Early"},{value:"426",label:"426 Upgrade Required"},{value:"428",label:"428 Precondition Required"},{value:"429",label:"429 Too Many Requests"},{value:"431",label:"431 Request Header Fields Too Large"},{value:"451",label:"451 Unavailable For Legal Reasons"},{value:"500",label:"500 Internal Server Error"},{value:"501",label:"501 Not Implemented"},{value:"502",label:"502 Bad Gateway"},{value:"503",label:"503 Service Unavailable"},{value:"504",label:"504 Gateway Timeout"},{value:"505",label:"505 HTTP Version Not Supported"},{value:"506",label:"506 Variant Also Negotiates"},{value:"507",label:"507 Insufficient Storage"},{value:"508",label:"508 Loop Detected"},{value:"510",label:"510 Not Extended"},{value:"511",label:"511 Network Authentication Required"}],i=()=>({key:"",value:""}),u=()=>({...b(),factDetails:{factName:"",request:{method:n,url:"",headers:[{key:"Content-Type",value:"application/json"}]},response:{emptyOnStatuses:[404]},retries:{}}}),c=()=>({request:{enabled:!1,collectors:[u()]}});function y(a){const{request:l}=a;if(l.enabled){const t={},o=[];return t.collects=o,l.collectors.forEach(e=>{const s=Object.assign({},...e.factDetails.request.headers?.filter(({key:r})=>r.length)?.map(({key:r,value:v})=>({[r]:v})));o.push(p({configOption:e,additionalParams:{factName:e.factDetails.factName,request:{...e.factDetails.request,headers:Object.keys(s).length?s:void 0,body:e.factDetails.request.body?.length?e.factDetails.request.body:void 0,targetPluginId:e.factDetails.request.targetPluginId?.length?e.factDetails.request.targetPluginId:void 0},response:{transform:e.factDetails.response.transform?.length?e.factDetails.response.transform:void 0,schema:e.factDetails.response.schema?.length?e.factDetails.response.schema:void 0,emptyOnStatuses:e.factDetails.response.emptyOnStatuses?.length?e.factDetails.response.emptyOnStatuses:void 0},retries:{maxRetries:e.factDetails.retries.maxRetries?e.factDetails.retries.maxRetries:void 0,retryDelay:e.factDetails.retries.retryDelay?e.factDetails.retries.retryDelay:void 0,retryOnStatuses:e.factDetails.retries.retryOnStatuses?.length?e.factDetails.retries.retryOnStatuses:void 0}}}))}),t}return{collects:[]}}function h(a){const l=c();if(a){const t=a.collects;if(t){const o=d(t);o.length&&(l.request={enabled:!0,collectors:o.map(e=>({...f({parentConfig:a,factTypeConfig:e}),factDetails:{factName:e.factName,request:{...e.request,method:e.request.method??n,headers:Object.keys(e.request.headers??{}).length?Object.entries(e.request.headers).map(([s,r])=>({key:s,value:r})):[i()]},response:e.response??{},retries:e.retries??{}}}))})}}return l}export{n as DEFAULT_HTTP_METHOD,m as HTTP_METHOD_OPTIONS,g as HTTP_STATUSES,c as defaultHttpConfig,i as defaultNewHeaderConfig,u as defaultRequestCollectorConfig,h as mapConfigToHttpCollectorConfig,y as mapHttpCollectorConfigToConfig};
|
|
2
|
+
//# sourceMappingURL=utils.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{validNameRegex as p}from"@spotify/backstage-plugin-soundcheck-common";import{z as t}from"zod";import{FIELD_IS_REQUIRED_MSG as i}from"../../../../utils/validation.esm.js";import{BaseCollectorSchema as u}from"../Common/CollectorOption.esm.js";const n="Fact name is not unique",c="The field contains forbidden characters",l="Max 100 characters",f=t.strictObject({method:t.enum(["POST","GET"]).optional(),url:t.string().min(1,i),headers:t.array(t.strictObject({key:t.string().optional(),value:t.string().optional()})),body:t.string().optional(),targetPluginId:t.string().optional()}),b=t.strictObject({transform:t.string().optional(),schema:t.string().optional(),emptyOnStatuses:t.array(t.number()).optional()}),d=t.strictObject({maxRetries:t.number().min(0).optional().nullable(),retryDelay:t.number().min(0).optional().nullable(),retryOnStatuses:t.array(t.number()).optional()}),g=u.extend({factDetails:t.strictObject({factName:t.string().min(1,i).max(100,l).regex(p,c),request:f,response:b,retries:d})}).strict(),S=t.strictObject({enabled:t.boolean(),collectors:t.array(g).superRefine((r,m)=>{const o=r.map(e=>e.factDetails.factName),s=o.filter((e,a)=>o.indexOf(e)!==a);s.length&&r.forEach((e,a)=>{s.includes(e.factDetails.factName)&&m.addIssue({code:t.ZodIssueCode.custom,message:n,path:[a,"factDetails","factName"]})})})}),_=t.strictObject({request:S});export{n as FACT_NAME_IS_NOT_UNIQUE_MSG,c as INVALID_CHARACTERS_MSG,l as MAX_100_CHARACTERS_MSG,_ as httpCollectorFormSchema};
|
|
2
|
+
//# sourceMappingURL=validation.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{makeStyles as v,Box as g,Typography as m,TextField as p,Grid as o,MenuItem as y,IconButton as P}from"@material-ui/core";import I from"@material-ui/icons/Add";import N from"@material-ui/icons/Remove";import e from"react";import{useFormContext as F,useFieldArray as C,Controller as d}from"react-hook-form";import{FactDetailsComponent as $}from"./FactDetailsComponent.esm.js";import{ELEMENT_TYPES as j,ARRAY_ELEMENT_TYPES as L,DEFAULT_JSON_FACT_DATA as _,SCM_COLLECTOR_FIELDS as A}from"./utils.esm.js";const D=v(a=>({filePathInput:{marginTop:0,width:"690px"},labelInput:{marginTop:0,width:"255px"},jsonPathInput:{marginTop:0,width:"300px"},typeInput:{marginTop:0,width:"150px"},helperText:{marginLeft:0},caption:{margin:a.spacing(2,0)},filePathSection:{marginTop:a.spacing(1)}})),k=({name:a,disabled:l})=>{const t=D(),{filePath:E,label:x,type:u,json:s}=A.factDetails,{control:i}=F(),{fields:f,insert:
|
|
1
|
+
import{makeStyles as v,Box as g,Typography as m,TextField as p,Grid as o,MenuItem as y,IconButton as P}from"@material-ui/core";import I from"@material-ui/icons/Add";import N from"@material-ui/icons/Remove";import e from"react";import{useFormContext as F,useFieldArray as C,Controller as d}from"react-hook-form";import{FactDetailsComponent as $}from"./FactDetailsComponent.esm.js";import{ELEMENT_TYPES as j,ARRAY_ELEMENT_TYPES as L,DEFAULT_JSON_FACT_DATA as _,SCM_COLLECTOR_FIELDS as A}from"./utils.esm.js";const D=v(a=>({filePathInput:{marginTop:0,width:"690px"},labelInput:{marginTop:0,width:"255px"},jsonPathInput:{marginTop:0,width:"300px"},typeInput:{marginTop:0,width:"150px"},helperText:{marginLeft:0},caption:{margin:a.spacing(2,0)},filePathSection:{marginTop:a.spacing(1)}})),k=({name:a,disabled:l})=>{const t=D(),{filePath:E,label:x,type:u,json:s}=A.factDetails,{control:i}=F(),{fields:f,insert:S,remove:b}=C({control:i,name:`${a}.data`});return e.createElement(g,null,e.createElement($,{name:a,control:i,disabled:l}),e.createElement("div",{className:t.filePathSection},e.createElement(g,null,e.createElement(m,{variant:"subtitle2"},E.name),e.createElement(m,{variant:"caption"},E.helperText)),e.createElement(d,{name:`${a}.path`,control:i,render:({field:h,fieldState:{error:r}})=>e.createElement(p,{...h,type:"text",variant:"outlined",margin:"dense",placeholder:E.placeholder,className:t.filePathInput,disabled:l,error:!!r,helperText:r?.message,FormHelperTextProps:{className:t.helperText}})})),e.createElement("div",{className:t.caption},e.createElement(m,{variant:"subtitle1"},s.jsonElementsSection.name),e.createElement(m,{variant:"caption"},s.jsonElementsSection.description)),e.createElement(o,{container:!0,spacing:0,direction:"column"},f.map((h,r)=>e.createElement(o,{item:!0,container:!0,alignItems:"center",spacing:2,key:h.id},e.createElement(o,{item:!0},e.createElement(m,{variant:"subtitle2"},x.name),e.createElement(d,{name:`${a}.data.${r}.name`,control:i,render:({field:c,fieldState:{error:n}})=>e.createElement(p,{...c,type:"text",variant:"outlined",margin:"dense",placeholder:x.placeholder,className:t.labelInput,disabled:l,error:!!n,helperText:n?.message??" ",FormHelperTextProps:{className:t.helperText}})})),e.createElement(o,{item:!0},e.createElement(m,{variant:"subtitle2"},s.jsonPath.name),e.createElement(d,{name:`${a}.data.${r}.jsonPath`,control:i,render:({field:c,fieldState:{error:n}})=>e.createElement(p,{...c,type:"text",variant:"outlined",margin:"dense",placeholder:s.jsonPath.placeholder,className:t.jsonPathInput,disabled:l,error:!!n,helperText:n?.message??" ",FormHelperTextProps:{className:t.helperText}})})),e.createElement(o,{item:!0},e.createElement(m,{variant:"subtitle2"},u.name),e.createElement(d,{name:`${a}.data.${r}.type`,control:i,render:({field:c,fieldState:{error:n}})=>e.createElement(p,{...c,select:!0,type:"text",variant:"outlined",margin:"dense",placeholder:u.placeholder,className:t.typeInput,disabled:l,error:!!n,helperText:n?.message??" ",FormHelperTextProps:{className:t.helperText}},[...j,...L].map(T=>e.createElement(y,{key:T,value:T},T)))})),e.createElement(o,{item:!0},e.createElement(P,{onClick:()=>b(r),disabled:l||f.length===1},e.createElement(N,{fontSize:"small"})),e.createElement(P,{onClick:()=>S(r+1,_),disabled:l},e.createElement(I,{fontSize:"small"})))))))};export{k as JsonFactDetailsComponent};
|
|
2
2
|
//# sourceMappingURL=JsonFactDetailsComponent.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{makeStyles as P,Box as s,Grid as m,Typography as a,TextField as d,RadioGroup as L,FormControlLabel as C,Radio as N,MenuItem as D,IconButton as I}from"@material-ui/core";import _ from"@material-ui/icons/Add";import k from"@material-ui/icons/Remove";import e,{useState as A}from"react";import{useFormContext as H,useFieldArray as R,Controller as E}from"react-hook-form";import{FactDetailsComponent as w}from"./FactDetailsComponent.esm.js";import{ELEMENT_TYPES as z,DEFAULT_REGEX_FACT_DATA as M,SCM_COLLECTOR_FIELDS as B}from"./utils.esm.js";const u="CaptureGroupsMode",x="TrueFalseMode",O=P(n=>({textInput:{marginTop:0,width:"690px"},labelInput:{marginTop:0,width:"255px"},typeInput:{marginTop:0,width:"150px"},helperText:{marginLeft:0},caption:{margin:n.spacing(2,0)},regexSection:{padding:n.spacing(1,0)}})),U=({name:n,disabled:c})=>{const r=O(),{label:f,type:F,filePath:g,regex:l}=B.factDetails,{control:i}=H(),{fields:h,insert:
|
|
1
|
+
import{makeStyles as P,Box as s,Grid as m,Typography as a,TextField as d,RadioGroup as L,FormControlLabel as C,Radio as N,MenuItem as D,IconButton as I}from"@material-ui/core";import _ from"@material-ui/icons/Add";import k from"@material-ui/icons/Remove";import e,{useState as A}from"react";import{useFormContext as H,useFieldArray as R,Controller as E}from"react-hook-form";import{FactDetailsComponent as w}from"./FactDetailsComponent.esm.js";import{ELEMENT_TYPES as z,DEFAULT_REGEX_FACT_DATA as M,SCM_COLLECTOR_FIELDS as B}from"./utils.esm.js";const u="CaptureGroupsMode",x="TrueFalseMode",O=P(n=>({textInput:{marginTop:0,width:"690px"},labelInput:{marginTop:0,width:"255px"},typeInput:{marginTop:0,width:"150px"},helperText:{marginLeft:0},caption:{margin:n.spacing(2,0)},regexSection:{padding:n.spacing(1,0)}})),U=({name:n,disabled:c})=>{const r=O(),{label:f,type:F,filePath:g,regex:l}=B.factDetails,{control:i}=H(),{fields:h,insert:S,remove:y}=R({control:i,name:`${n}.data`}),[T,G]=A(h.length?u:x),$=o=>{const t=o.target.value;G(t),t===u?S(0,M):t===x&&y()};return e.createElement(s,null,e.createElement(w,{name:n,control:i,disabled:c}),e.createElement(m,{container:!0,spacing:1,direction:"column",className:r.regexSection},e.createElement(m,{item:!0},e.createElement(s,null,e.createElement(a,{variant:"subtitle2"},g.name),e.createElement(a,{variant:"caption"},g.helperText)),e.createElement(E,{name:`${n}.path`,control:i,render:({field:o,fieldState:{error:t}})=>e.createElement(d,{...o,type:"text",variant:"outlined",margin:"dense",placeholder:g.placeholder,className:r.textInput,disabled:c,error:!!t,helperText:t?.message??"",FormHelperTextProps:{className:r.helperText}})})),e.createElement(m,{item:!0},e.createElement(s,null,e.createElement(a,{variant:"subtitle2"},l.regex.name),e.createElement(a,{variant:"caption"},l.regex.helperText)),e.createElement(E,{name:`${n}.regex`,control:i,render:({field:o,fieldState:{error:t}})=>e.createElement(d,{...o,type:"text",variant:"outlined",margin:"dense",placeholder:l.regex.placeholder,className:r.textInput,disabled:c,error:!!t,helperText:t?.message??"",FormHelperTextProps:{className:r.helperText}})})),e.createElement(m,{item:!0},e.createElement(s,null,e.createElement(a,{variant:"subtitle2"},l.flags.name),e.createElement(a,{variant:"caption"},l.flags.helperText)),e.createElement(E,{name:`${n}.flags`,control:i,render:({field:o,fieldState:{error:t}})=>e.createElement(d,{...o,type:"text",variant:"outlined",margin:"dense",placeholder:l.flags.placeholder,className:r.textInput,disabled:c,error:!!t,helperText:t?.message??"",FormHelperTextProps:{className:r.helperText}})}))),e.createElement(L,{row:!0,name:"regexMode",value:T,onChange:$},e.createElement(C,{value:x,control:e.createElement(N,null),label:e.createElement(a,{variant:"subtitle2"},l.trueFalseMode.label)}),e.createElement(C,{value:u,control:e.createElement(N,null),label:e.createElement(a,{variant:"subtitle2"},l.captureGroupsMode.label)})),T===x&&e.createElement(a,{variant:"caption"},l.trueFalseMode.description),T===u&&e.createElement(s,null,e.createElement(a,{variant:"caption"},l.captureGroupsMode.description),e.createElement("div",{className:r.caption},e.createElement(a,{variant:"subtitle2"},l.captureGroupsSection.name),e.createElement(a,{variant:"caption"},l.captureGroupsSection.description)),e.createElement(m,{container:!0,spacing:0,direction:"column"},h.map((o,t)=>e.createElement(m,{item:!0,container:!0,alignItems:"center",spacing:2,key:o.id},e.createElement(m,{item:!0},e.createElement(a,{variant:"subtitle2"},f.name),e.createElement(E,{name:`${n}.data.${t}.name`,control:i,render:({field:b,fieldState:{error:p}})=>e.createElement(d,{...b,type:"text",variant:"outlined",margin:"dense",placeholder:f.placeholder,className:r.labelInput,disabled:c,error:!!p,helperText:p?.message??" ",FormHelperTextProps:{className:r.helperText}})})),e.createElement(m,{item:!0},e.createElement(a,{variant:"subtitle2"},F.name),e.createElement(E,{name:`${n}.data.${t}.type`,control:i,render:({field:b,fieldState:{error:p}})=>e.createElement(d,{...b,select:!0,type:"text",variant:"outlined",margin:"dense",placeholder:F.placeholder,className:r.typeInput,disabled:c,error:!!p,helperText:p?.message??" ",FormHelperTextProps:{className:r.helperText}},z.map(v=>e.createElement(D,{key:v,value:v},v)))})),e.createElement(m,{item:!0},e.createElement(I,{onClick:()=>y(t),disabled:c||h.length===1},e.createElement(k,{fontSize:"small"})),e.createElement(I,{onClick:()=>S(t+1,M),disabled:c},e.createElement(_,{fontSize:"small"}))))))))};export{U as RegexFactDetailsComponent};
|
|
2
2
|
//# sourceMappingURL=RegexFactDetailsComponent.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{makeStyles as p,useTheme as
|
|
1
|
+
import{makeStyles as p,useTheme as f}from"@material-ui/core";import c from"react";import g from"../../../images/azure-devops-rgb.svg";import s from"../../../images/azure-devops-white.svg";import n from"../../../images/bigquery-rgb.svg";import h from"../../../images/bigquery-white.svg";import l from"../../../images/cat-blk.svg";import u from"../../../images/cat-wht.svg";import b from"../../../images/dd_logo_h_rgb.svg";import d from"../../../images/dd_logo_h_white.svg";import k from"../../../images/GitHub_Logo.svg";import y from"../../../images/GitHub_Logo_White.svg";import q from"../../../images/gitlab-rgb.svg";import w from"../../../images/gitlab-white.svg";import j from"../../../images/http-rgb.svg";import B from"../../../images/http-white.svg";import $ from"../../../images/jira-rgb.svg";import x from"../../../images/jira-white.svg";import z from"../../../images/k8s_blue.svg";import I from"../../../images/k8s_white.svg";import L from"../../../images/new-relic-rgb.svg";import S from"../../../images/new-relic-white.svg";import T from"../../../images/pd-black.svg";import D from"../../../images/pd-white.svg";import E from"../../../images/SCM_DARK.svg";import F from"../../../images/SCM_LIGHT.svg";import M from"../../../images/sonarqube-rgb.svg";import A from"../../../images/sonarqube-white.svg";import C from"../../../images/soundcheck-black.svg";import G from"../../../images/soundcheck-white.svg";import H from"../../../images/tech-black.svg";import K from"../../../images/tech-white.svg";import{isDarkTheme as N}from"../../Charts/chartUtils.esm.js";const t={github:k,gitlab:q,datadog:b,scm:F,pagerduty:T,catalog:l,soundcheck:C,techinsights:H,kubernetes:z,jira:$,sonarqube:M,newrelic:L,bigquery:n,azure:g,http:j},i={github:y,gitlab:w,datadog:d,scm:E,pagerduty:D,catalog:u,soundcheck:G,techinsights:K,kubernetes:I,jira:x,sonarqube:A,newrelic:S,bigquery:h,azure:s,http:B},O=new Set(["catalog","soundcheck","techinsights","sonarqube"]),Q=p(o=>({image:{objectFit:"contain",color:"white",height:o.spacing(5)-4,maxWidth:"100%",marginBottom:o.spacing(1.5)},tallImage:{height:o.spacing(6.5),marginBottom:o.spacing(0)}})),R=o=>!!t[o]&&!!i[o],W=({collectorId:o,noMargin:e})=>{const r=Q(),a=f(),m=N(a)?i[o]:t[o];return m?c.createElement("img",{src:m,alt:o,style:e?{marginBottom:0}:{},className:`${r.image} ${O.has(o)?r.tallImage:""}`}):null};export{W as CollectorLogo,R as hasLogo};
|
|
2
2
|
//# sourceMappingURL=CollectorLogo.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{MarkdownContent as E}from"@backstage/core-components";import{useRouteRef as v}from"@backstage/core-plugin-api";import{usePermission as N}from"@backstage/plugin-permission-react";import{makeStyles as I,CardContent as g,CardHeader as k,Typography as u,Divider as x,CardActions as S,Button as T}from"@material-ui/core";import{soundcheckCollectorUpdatePermission as $}from"@spotify/backstage-plugin-soundcheck-common";import e from"react";import{useNavigate as A}from"react-router-dom";import{integrationDetailsRouteRef as B}from"../../../routes.esm.js";import{useSummaryCardStyles as H,Card as L}from"../../SummaryCard/SummaryCard.esm.js";import{hasLogo as R,CollectorLogo as w}from"./CollectorLogo.esm.js";const D=I(o=>({cardContent:{flex:1,paddingTop:o.spacing(1)},logoHeader:{paddingBottom:0,flex:0},headerContent:{display:"flex",alignItems:"center",height:o.spacing(5),marginBottom:o.spacing(1.5)},headerTypography:{marginBottom:0}})),l=["github","gitlab","scm","pagerduty","datadog","kubernetes","jira","sonarqube","newrelic","bigquery"],M=({collector:o})=>{const{description:p,id:t,isConfigurable:s,isEditable:
|
|
1
|
+
import{MarkdownContent as E}from"@backstage/core-components";import{useRouteRef as v}from"@backstage/core-plugin-api";import{usePermission as N}from"@backstage/plugin-permission-react";import{makeStyles as I,CardContent as g,CardHeader as k,Typography as u,Divider as x,CardActions as S,Button as T}from"@material-ui/core";import{soundcheckCollectorUpdatePermission as $}from"@spotify/backstage-plugin-soundcheck-common";import e from"react";import{useNavigate as A}from"react-router-dom";import{integrationDetailsRouteRef as B}from"../../../routes.esm.js";import{useSummaryCardStyles as H,Card as L}from"../../SummaryCard/SummaryCard.esm.js";import{hasLogo as R,CollectorLogo as w}from"./CollectorLogo.esm.js";const D=I(o=>({cardContent:{flex:1,paddingTop:o.spacing(1)},logoHeader:{paddingBottom:0,flex:0},headerContent:{display:"flex",alignItems:"center",height:o.spacing(5),marginBottom:o.spacing(1.5)},headerTypography:{marginBottom:0}})),l=["github","gitlab","scm","pagerduty","datadog","kubernetes","jira","sonarqube","newrelic","bigquery","catalog","azure","http"],M=({collector:o})=>{const{description:p,id:t,isConfigurable:s,isEditable:c,name:f}=o,{loading:m,allowed:d}=N({permission:$}),y=A(),h=v(B),a=H(),n=D(),C=l.includes(t)&&s&&c&&!m&&d,b=()=>{y(h({integrationId:t}))};let r;m||!d?r="You don't have permissions to configure this integration.":s?c?l.includes(t)||(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 i=f??t;return e.createElement(L,{"data-testid":t,className:a.card},R(t)?e.createElement(g,{className:n.logoHeader},e.createElement(w,{collectorId:t})):e.createElement(k,{title:i,titleTypographyProps:{className:`${a.summaryName} ${n.headerTypography}`},classes:{content:n.headerContent}}),e.createElement(g,{className:n.cardContent},e.createElement(u,{variant:"body1",component:"div"},e.createElement(E,{className:a.summaryDescription,content:p??""})),e.createElement(u,{color:"textSecondary",variant:"body2"},r)),C&&e.createElement("div",null,e.createElement(x,null),e.createElement(S,{className:a.actionArea},e.createElement(T,{"aria-label":`${i}-edit`,"data-testid":`${i}-button`,size:"medium",role:"link",onClick:b,className:a.button,variant:"outlined"},"Configure"))))};export{M as CollectorSummaryCard,l as ConfigurableCollectorIds};
|
|
2
2
|
//# sourceMappingURL=CollectorSummaryCard.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useApi as o}from"@backstage/core-plugin-api";import{entityPresentationApiRef as l,EntityRefLink as m}from"@backstage/plugin-catalog-react";import{Chip as i,Avatar as c}from"@material-ui/core";import{Skeleton as a}from"@material-ui/lab";import e from"react";import p from"react-use/esm/useAsync";const f=({entityOrRef:r})=>{const n=o(l),{value:t}=p(async()=>await n.forEntity(r).promise);return t?e.createElement(m,{entityRef:r},e.createElement(i,{size:"small",avatar:t.Icon?e.createElement(c,null,e.createElement(t.Icon,null)):void 0,label:t.primaryTitle,style:{cursor:"pointer"}})):e.createElement(i,{size:"small",avatar:e.createElement(a,{variant:"circle",width:16,height:16}),label:e.createElement(a,{variant:"text",width:65})})};export{f as EntityChip};
|
|
2
|
+
//# sourceMappingURL=EntityChip.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Link as u,InfoCard as
|
|
1
|
+
import{Link as u,InfoCard as g}from"@backstage/core-components";import{useRouteRef as l}from"@backstage/core-plugin-api";import{useEntity as C}from"@backstage/plugin-catalog-react";import{Divider as v}from"@material-ui/core";import h from"@material-ui/core/styles/makeStyles";import{SpotifyLicenseBanner as I}from"@spotify/backstage-plugin-core";import e,{Fragment as R}from"react";import{useAllCertifications as S}from"../../hooks/certifications/useAllCertifications.esm.js";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@backstage/catalog-model";import"@spotify/backstage-plugin-soundcheck-common";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import"react-router-dom";import{usePlaylists as L}from"../../hooks/playlists/usePlaylists.esm.js";import{certificationTrackRouteRef as w,certificationPlaylistTrackRouteRef as b}from"../../routes.esm.js";import{soundcheckBackend as N,invalidLicenseMessage as A}from"../../utils/license.esm.js";import{AlertPanel as P}from"../AlertPanel/AlertPanel.esm.js";import"../CertificationSidebar/CertificationSidebar.esm.js";import{CertificationSummary as T}from"../CertificationSidebar/CertificationSummary.esm.js";import"@material-ui/lab";import"../CertificationSidebar/Check.esm.js";import"../CertificationSidebar/LevelSummary.esm.js";import{NoCertifications as x}from"../EmptyState/EmptyState.esm.js";import{CardSkeleton as B}from"./skeletons/CardSkeleton.esm.js";const m=h(t=>({certificationWrapper:{display:"flex",justifyContent:"space-between",alignItems:"center"},infoCard:{display:"grid",gridRowGap:t.spacing(2)},emptyState:{overflow:"hidden"}})),n=({children:t,title:i})=>{const a=m();return e.createElement(g,{title:i},e.createElement("div",{className:a.infoCard},e.createElement(I,{inline:!0,backend:N,invalidLicenseMessage:A}),t))},D=(t,i)=>t.find(a=>a.trackIds.some(o=>o===i))?.id??"",M=({title:t="Soundcheck"})=>{const{entity:i}=C(),a=m(),{data:o,isError:s,isLoading:p}=S(i),{data:c,isError:d,isLoading:f}=L(i),k=l(w),y=l(b);return s||d?e.createElement(n,{title:t},e.createElement(P,{severity:"error",title:"Error loading certifications"})):p||f||!o||!c?e.createElement(n,{title:t},e.createElement(B,null)):o.length?e.createElement(n,{title:t},o.map((r,E)=>e.createElement(R,{key:r.track.name},e.createElement("div",{className:a.certificationWrapper,"data-testid":"soundcheck-track-row"},e.createElement(T,{key:r.track.id,name:r.track.name,badge:r.track.badge,trackType:r.track?.type}),e.createElement(u,{to:r.track.type==="playlist"?y({playlistId:D(c,r.track.id),trackId:r.track.id}):k({trackId:r.track.id})},"View Details")),E<o.length-1?e.createElement(v,null):null))):e.createElement(n,{title:t},e.createElement("div",{className:a.emptyState},e.createElement(x,null)))};export{M as Card,m as useStyles};
|
|
2
2
|
//# sourceMappingURL=Card.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{parseEntityRef as
|
|
1
|
+
import{parseEntityRef as S,DEFAULT_NAMESPACE as O}from"@backstage/catalog-model";import{makeStyles as F,Typography as v,Box as A,FormControlLabel as w,Checkbox as N,TextField as T}from"@material-ui/core";import z from"@material-ui/icons/CheckBox";import I from"@material-ui/icons/CheckBoxOutlineBlank";import P from"@material-ui/icons/ExpandMore";import{Autocomplete as U}from"@material-ui/lab";import t,{useState as B,useMemo as D,useCallback as f}from"react";import{useGetEntityFacets as G}from"../../hooks/catalog/useGetEntityFacets.esm.js";import{FormFieldLabel as M}from"../FormFieldLabel/FormFieldLabel.esm.js";import{ListboxVirtualized as _}from"../ListboxVirtualized/ListboxVirtualized.esm.js";const H=F({container:{padding:0},formControl:{flexGrow:1},label:{lineHeight:"1em"}}),K=({facet:s,label:p,values:l,onChange:a,disabled:u,filter:b,isOwnerSelect:E})=>{const c=H(),[g,i]=B(!1),{data:n,isLoading:C,error:h}=G(s,b),o=D(()=>n?.map(e=>e.toLocaleLowerCase("en-US")),[n]),d=l?.map(e=>e.toLocaleLowerCase("en-US"))??[],L=f((e,r)=>{a(r),o&&o.every(m=>r.includes(m))&&i(!1)},[o,a,i]),x=f(()=>{a(l?.length?l:void 0)},[l,a]);if(!n||!o||h)return t.createElement(v,{color:"error"},"Failed to load facet: ",s);const k=u||C||!l?.length&&(!n?.length||!o?.length),y=Array.from(new Set([...o,...d]));return t.createElement(A,{pb:1,pt:1,className:c.container},t.createElement(M,{title:p,docLink:"https://backstage.spotify.com/docs/plugins/soundcheck/core-concepts/filters"}),t.createElement(U,{open:g,onOpen:()=>i(!0),onClose:()=>i(!1),className:c.formControl,multiple:!0,limitTags:4,disableCloseOnSelect:!0,"aria-label":p,options:y,value:d,getOptionLabel:e=>{if(E){const r=n[o.indexOf(e)];return r?S(r,{defaultKind:"group",defaultNamespace:O}).name:e}return n[o.indexOf(e)]??e},onChange:L,onBlur:x,disabled:k,ListboxComponent:_,renderOption:(e,{selected:r})=>t.createElement(w,{onClick:m=>m.preventDefault(),control:t.createElement(N,{icon:t.createElement(I,{fontSize:"small"}),checkedIcon:t.createElement(z,{fontSize:"small"}),checked:r}),label:n[o.indexOf(e)]??e,classes:{label:c.label}}),size:"small",popupIcon:t.createElement(P,{"data-testid":"selected-facets-expand"}),renderInput:e=>t.createElement(T,{...e,variant:"outlined"})}))};export{K as EntityAutocompletePicker};
|
|
2
2
|
//# sourceMappingURL=EntityAutocompletePicker.esm.js.map
|