@spotify/backstage-plugin-soundcheck 0.22.2 → 0.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/components/CheckDetails/CheckDetails.esm.js +1 -1
- package/dist/components/CheckPage/CheckPageBUI.esm.js +1 -1
- package/dist/components/ChecksTable/ChecksTable.esm.js +1 -1
- package/dist/components/ChecksTable/FixMeCell.esm.js +1 -1
- package/dist/components/ChecksTable/PullRequestsTable.esm.js +1 -1
- package/dist/components/FixMeButton/FixMeButton.esm.js +1 -1
- package/dist/components/ViewPullRequests/ViewPullRequests.esm.js +1 -1
- package/dist/hooks/fixMe/useFixMe.esm.js +1 -1
- package/package.json +2 -2
- package/dist/components/LoadingIcon/LoadingIcon.esm.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @spotify/backstage-plugin-soundcheck
|
|
2
2
|
|
|
3
|
+
## 0.22.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added additional fields for 'Fix With Fleetshift' Pull Requests.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @spotify/backstage-plugin-soundcheck-common@0.21.3
|
|
10
|
+
|
|
3
11
|
## 0.22.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e,jsxs as n,Fragment as W}from"react/jsx-runtime";import{stringifyEntityRef as B}from"@backstage/catalog-model";import{useEntity as $}from"@backstage/plugin-catalog-react";import{makeStyles as q,Box as l,Typography as d,Button as g,Tooltip as U}from"@material-ui/core";import{Alert as b}from"@material-ui/lab";import{useState as E}from"react";import{CheckerType as G,ResultState as h}from"../../graphql/generated/index.esm.js";import"@backstage/core-plugin-api";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@spotify/backstage-plugin-soundcheck-common";import{useCheck as J}from"../../hooks/checks/useCheck.esm.js";import{useCheckDetails as V}from"../../hooks/checks/useCheckDetails.esm.js";import"../../hooks/useSoundcheckAlert.esm.js";import{useGetExemption as _}from"../../hooks/exemptions/useGetExemption.esm.js";import"../../hooks/useConfirmationModal.esm.js";import"react-router-dom";import"react-use/lib/useLocalStorage";import"react-use/lib/useAsync";import{useSetManualResult as H}from"../../hooks/checks/useSetManualResult.esm.js";import{useFixWithAika as K}from"../../hooks/fixWithAika/useFixWithAika.esm.js";import{AlertPanel as Q}from"../AlertPanel/AlertPanel.esm.js";import{CheckResultInputPopup as X}from"../CertificationSidebar/CheckResultInputPopup.esm.js";import{ExemptionJustificationDialog as Y}from"../CertificationSidebar/ExemptionJustificationDialog.esm.js";import{RelativeTime as Z}from"../RelativeTime/RelativeTime.esm.js";import{SoundcheckMarkdownContentDeprecated as ee}from"../SoundcheckMarkdownContent/SoundcheckMarkdownContentDeprecated.esm.js";import"@backstage/core-components";import"react-markdown";import"rehype-raw";import"remark-gfm";import"../SoundcheckMarkdownContent/SoundcheckMarkdownContentBUI.esm.js";import{CheckPullRequest as te}from"./CheckPullRequest.esm.js";import{ResultStateBox as ie}from"./ResultStateBox.esm.js";import{CheckDetailsSkeleton as re}from"./skeletons/CheckDetailsSkeleton.esm.js";const u=q(t=>({root:{padding:`${t.spacing(3)}px ${t.spacing(5)}px`},title:{fontWeight:"normal",fontSize:t.typography.h5.fontSize},description:{padding:`${t.spacing(3)}px 0`},subtitle:{fontWeight:"normal",fontSize:t.typography.h6.fontSize},topBar:{display:"flex",justifyContent:"space-between",marginBottom:t.spacing(2)},exemptButton:{marginLeft:t.spacing(1)},exemptAlert:{marginBottom:t.spacing(2)}})),N=({setPopupDisplayed:t})=>{const i=u();return e(g,{className:i.exemptButton,size:"small",onClick:()=>t(!0),"aria-label":"Set Check Status Button",children:"Set Check Status"})},w=({isExempt:t,setPopupDisplayed:i})=>{const r=u();return e(U,{title:t?"Remove Exemption":"Set Exempt From Check",children:e(g,{className:r.exemptButton,size:"small",color:"inherit",onClick:()=>i(!0),"aria-label":"Exempt From Check",children:t?"Remove Exemption":"Add Exemption"})})},oe=({trackId:t,checkId:i})=>{const r=u(),{entity:m}=$(),{data:f,isLoading:A,isError:D}=V(m,t,i),[T,S]=E(!1),[I,k]=E(!1),y=B(m),{data:a,isLoading:z}=_(y,i??""),{data:s}=J(i),{showAikaButton:P,pullRequest:o}=K({result:f?.result,type:s?.type,rule:s?.rule,entityRef:y,checkId:s?.id}),{mutateAsync:L}=H();if(D)return e(l,{padding:2,children:e(Q,{severity:"error",title:"Error loading check details"})});if(A||!t||!i)return e(re,{});if(!f)return null;const v=s?.type===G.Manual,{name:C,description:M,result:p,timestamp:R,details:O}=f,j=async(x,c)=>{!m||!i||await L({checkId:i,entityRef:y,justification:c,state:x})},F=x=>{const c=window.open(x,"_blank","noopener,noreferrer");c&&(c.opener=null)};return n("div",{className:r.root,"data-testid":"check-details-view",children:[n("div",{className:r.topBar,children:[e(d,{variant:"h2",className:r.title,children:C}),n(l,{display:"flex",alignItems:"center",children:[R?e(Z,{timestamp:R,description:"Last updated"}):null,v&&!a?.exemption&&p!==h.NotReported&&e(N,{setPopupDisplayed:k}),!z&&p!==h.NotApplicable&&e(w,{isExempt:!!a?.exemption,setPopupDisplayed:S})]})]}),e(Y,{entityRef:B(m),checkId:i,isOpen:T,setIsOpen:S}),e(X,{isOpen:I,setIsOpen:k,setCallback:j}),!a?.exemption&&p===h.Exempt&&e(b,{className:r.exemptAlert,severity:"warning",variant:"outlined",children:"This check's exemption for this entity was recently removed. The recent exemption state will clear once the check has been run."}),!!a?.exemption&&e(l,{marginBottom:2,children:e(b,{className:r.exemptAlert,severity:"warning",variant:"outlined",children:"This entity has been exempted from this check."})}),v&&!a?.exemption&&p===h.NotReported?n(l,{children:[e(d,{children:"This check is manual and must have its state set by a user."}),e(l,{marginTop:1,children:e(g,{variant:"contained",color:"primary",onClick:()=>k(!0),"aria-label":"Set Check Status",size:"small",children:"Set Check Status"})})]}):n(W,{children:[e(d,{className:r.subtitle,children:"Most Recent Result:"}),e(ie,{name:C,state:p,details:O,templateRef:s?.templateRef??void 0}),P&&o&&e(te,{title:o.label,branch:o.prBranch??o.provider,onView:()=>{o.prUrl&&F(o.prUrl)}})]}),n("div",{className:r.description,"data-testid":"soundcheck-check-details-description",children:[e(d,{variant:"h3",className:r.subtitle,children:"Description"}),e(ee,{content:M})]})]})};export{oe as CheckDetails,w as ExemptDialogButton,N as SetCheckStatusButton,u as useStyles};
|
|
2
2
|
//# sourceMappingURL=CheckDetails.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as r,jsxs as m,Fragment as
|
|
1
|
+
import{jsx as r,jsxs as m,Fragment as J}from"react/jsx-runtime";import{parseEntityRef as ue}from"@backstage/catalog-model";import{useRouteRef as P}from"@backstage/core-plugin-api";import{usePermission as ke}from"@backstage/plugin-permission-react";import{Container as K,HeaderPage as ge,Flex as w,Box as F}from"@backstage/ui";import{makeStyles as Ee}from"@material-ui/core";import{toEntityFilterQuery as x,combineEntityFilterQueries as Se,soundcheckCheckReadPermission as Ie}from"@spotify/backstage-plugin-soundcheck-common";import{useState as L,useMemo as a,useEffect as Te}from"react";import{useSearchParams as be,useParams as ye}from"react-router-dom";import Ce from"react-use/lib/useDebounce";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@backstage/plugin-catalog-react";import{useCheck as Re}from"../../hooks/checks/useCheck.esm.js";import"../../hooks/useSoundcheckAlert.esm.js";import{useTrack as ve}from"../../hooks/tracks/useTrack.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{useCheckStatus as Ne}from"../../hooks/aggregations/useCheckStatus.esm.js";import"react-use/lib/useLocalStorage";import{useFixMe as Pe}from"../../hooks/fixMe/useFixMe.esm.js";import{useFilters as we}from"../../hooks/filters/useFilters.esm.js";import{useLCPReporting as Fe}from"../../hooks/useLCPReporting.esm.js";import{useLoadTimeReporting as xe}from"../../hooks/useLoadTimeReporting.esm.js";import{trackDetailsRouteRef as Le,checksPageRouteRef as Ae,tracksPageRouteRef as Me}from"../../routes.esm.js";import"../../utils/facetFilters/types.esm.js";import{parseNumberOfDays as je}from"../../utils/facetFilters/utils.esm.js";import{DescriptionCard as Be}from"../Cards/DescriptionCard/DescriptionCard.esm.js";import"../Cards/HistoricalTrackStatusCard/HistoricalTrackStatusCard.esm.js";import"../Cards/TrackStatusCard/TrackStatusCard.esm.js";import{CheckStatusCard as Oe}from"../Cards/CheckStatusCard/CheckStatusCard.esm.js";import{HistoricalCheckStatusCard as qe}from"../Cards/HistoricalCheckStatusCard/HistoricalCheckStatusCard.esm.js";import{ChipSelector as De}from"../ChipSelector/ChipSelector.esm.js";import"../EmptyState/EmptyState.esm.js";import{EmptyStateBUI as A}from"../EmptyState/EmptyStateBUI.esm.js";import"@remixicon/react";import"../FilterSidebar/FilterSidebar.esm.js";import"../FilterSidebar/StateFilter.esm.js";import"lodash";import{toFilter as Ue}from"../FilterSidebar/util.esm.js";import{FixMeButton as Ve}from"../FixMeButton/FixMeButton.esm.js";import{LoadingTableSkeleton as Xe}from"../LoadingTableSkeleton/LoadingTableSkeleton.esm.js";import{SimpleMenu as $e}from"../Menus/SimpleMenu.esm.js";import{useCheckActions as Qe}from"../Menus/useCheckActions.esm.js";import{PageCustomActions as He}from"../PageCustomActions/PageCustomActions.esm.js";import{ViewPullRequests as Ge}from"../ViewPullRequests/ViewPullRequests.esm.js";import{CheckEntitiesTableBUI as Je}from"./CheckEntitiesTable/CheckEntitiesTableBUI.esm.js";import{ExemptionsTableBUI as Ke}from"./ExemptionsTableBUI.esm.js";const Ye=Ee(()=>({container:{marginBottom:"var(--bui-space-12)"},tables:{margin:"var(--bui-space-12) 0 0"},tableContent:{margin:"var(--bui-space-3) 0 0"}})),s={ENTITIES:"Entities",EXEMPTIONS:"Exemptions"},We={entities:s.ENTITIES,exemptions:s.EXEMPTIONS},Ze={[s.ENTITIES]:"entities",[s.EXEMPTIONS]:"exemptions"},_e=(h,e)=>h.levels.flatMap(({checks:p})=>p).find(({id:p})=>p===e)||null,ze=()=>{const h=Ye(),[e,p]=be(),{trackId:o,checkId:i}=ye(),{data:c,isLoading:g,isError:Y}=ve(o),{data:d,isLoading:k,isError:W}=Re(i),M=d?.ownerEntityRef,Z=M?ue(M).name:void 0,j=Qe(d??void 0),_=P(Le),z=P(Ae),ee=P(Me),[B,te]=L(()=>{const t=e.get("section"),u=t?We[t]:null;return new Set([u??s.ENTITIES])}),b=B.values().next().value??s.ENTITIES,[f,O]=L(e.get("search")||""),[q,re]=L(""),ie=t=>{te(t),O("");const u=t.values().next().value,G=u?Ze[u]:void 0;G?p({section:G},{replace:!0}):p({},{replace:!0})},l=a(()=>e.getAll("states"),[e]),E=a(()=>e.getAll("owners"),[e]),S=a(()=>e.getAll("lifecycles"),[e]),I=a(()=>e.getAll("types"),[e]),T=a(()=>e.getAll("systems"),[e]),y=a(()=>je(e.get("numberOfDays")),[e]);Ce(()=>{re(f);const t=new URLSearchParams(e.toString());f?t.set("search",f):t.delete("search"),p(t,{replace:!0})},300,[f]);const D=a(()=>({routeName:"soundcheck-check-insights",additionalAttributes:{checkId:i||"",trackId:o||"",filtersApplied:E.length+S.length+I.length+T.length+l.length,ownersFilter:E.join(",")||"",lifecyclesFilter:S.join(",")||"",typesFilter:I.join(",")||"",systemsFilter:T.join(",")||"",statesFilter:l.join(",")||"",numberOfDays:y,checkSearch:q}}),[i,o,E,S,I,T,l,y,q]),{reportContentLoaded:U}=xe(D),{reporter:oe}=Fe(D),n=a(()=>d??c?.levels.flatMap(t=>t.checks).find(t=>t.id===i),[d,i,c?.levels]),C=Ue({lifecycles:S,owners:E,types:I,systems:T}),{data:R,isLoading:v,isError:se}=Ne({checkId:i,trackId:o,filter:C,states:l?.length?l:void 0},!!i),{showFixMeButton:ae,hasShift:ce,pullRequests:V,href:le}=Pe({type:d?.type,rule:d?.rule,checkStatus:R,checkId:i??""});let N;if(i)if(c){const t=x(c.filter),u=x(_e(c,i)?.filter);N=Se(t,u)}else n?.filter&&(N=x(n.filter));const{loading:X,allowed:$}=ke({permission:Ie,resourceRef:i}),ne=a(()=>!!n&&!X&&!$,[$,n,X]),{filters:me,selected:pe,setSelected:he,onRemoveTag:de,selectedTags:fe}=we({entityFilterQuery:N,hasStatusFilters:!0}),Q=Y||W||se,H=oe?.getLCPValue();return Te(()=>{!k&&!v&&(!o||!g)&&U({lcp:H})},[k,v,g,o,U,H]),k||o&&g?r(Xe,{}):!k&&!n?r(K,{className:h.container,children:r(A,{title:"Check not found",body:`There is no check with the requested id: ${i}.`})}):ne?r(A,{title:"Cannot view check",body:`No permission to view check with the requested id: ${i}.`}):o&&!g&&!c?r(A,{title:"No track found",body:`There is no track with the requested id: ${o}.`}):m(J,{children:[r(ge,{title:n?.name??"",breadcrumbs:o?[{label:"Tracks",href:ee()},{label:c?.name??"Track",href:_({trackId:o})}]:[{label:"Checks",href:z()}],customActions:r($e,{label:"Check Actions",disabled:!j.length,placement:"left top",menuActions:j})}),m(K,{className:h.container,children:[m(w,{children:[r(Be,{description:n?.description??void 0,owner:Z,isError:Q,isLoading:k}),r(Oe,{states:l,status:R,isLoading:v,isError:Q}),r(qe,{checkId:i,trackId:o,filter:C,states:l,checkStatus:R,numberOfDays:y})]}),m(F,{className:h.tables,children:[m(w,{justify:"between",children:[r(F,{minWidth:"12rem",children:r(De,{options:Object.values(s),selected:B,ariaLabel:"Sections",onSelectionChange:ie})}),m(w,{align:"center",gap:"4",children:[ae&&m(J,{children:[V.length>0&&r(Ge,{checkName:n?.name,pullRequests:V}),r(Ve,{hasShift:ce,href:le})]}),r(He,{searchValue:f,setSearchValue:t=>O(t),filters:me,selected:pe,setSelected:he,onRemoveTag:de,selectedTags:fe,showSearch:b!==s.ENTITIES})]})]}),m(F,{className:h.tableContent,children:[b===s.ENTITIES&&r(Je,{checkId:i,trackId:c?.id,filter:C,states:l}),b===s.EXEMPTIONS&&r(Ke,{checkId:i,searchValue:f})]})]})]})]})};export{ze as CheckPageBUI};
|
|
2
2
|
//# sourceMappingURL=CheckPageBUI.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t,jsxs as p,Fragment as H}from"react/jsx-runtime";import{useRouteRef as O}from"@backstage/core-plugin-api";import{Row as V,CellText as T,Flex as W,Box as F,Text as _,TableRoot as q,TableHeader as J,Column as S,TableBody as K,TablePagination as Q}from"@backstage/ui";import{makeStyles as X}from"@material-ui/core";import{sortBy as Y}from"lodash";import{memo as N,useMemo as k,useState as z,useEffect as Z,useCallback as ee}from"react";import{CircularProgressbar as te}from"react-circular-progressbar";import{useNavigate as re}from"react-router-dom";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@backstage/plugin-catalog-react";import"@spotify/backstage-plugin-soundcheck-common";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{usePagination as oe}from"../../hooks/usePagination.esm.js";import"react-use/lib/useLocalStorage";import{useSortSearchParams as ie}from"../../hooks/useSortSearchParams.esm.js";import{isCheckFailed as se}from"../../hooks/fixMe/useFixMe.esm.js";import{useFeatureFlag as D}from"../../hooks/useFeatureFlag.esm.js";import{trackCheckDetailsRouteRef as ne}from"../../routes.esm.js";import{getPercentage as M}from"../../utils/formatters.esm.js";import"../CheckStatusBar/CheckStatusBar.esm.js";import{CheckStatusBarBUI as ae}from"../CheckStatusBar/CheckStatusBarBUI.esm.js";import{CustomCell as ce}from"../CustomCell/CustomCell.esm.js";import"../EmptyState/EmptyState.esm.js";import{EmptyStateBUI as le}from"../EmptyState/EmptyStateBUI.esm.js";import"@backstage/plugin-permission-react";import"@remixicon/react";import{FixMeCell as me}from"./FixMeCell.esm.js";const de=X(()=>({statusBar:{width:"45%"},customCell:{padding:"0 var(--bui-space-3)"},circularProgressbar:{width:"var(--bui-space-7)"}})),$=10,pe=["compliance","name","checks"],v=o=>pe.includes(o),ue=N(()=>t("svg",{width:"0",height:"0",style:{position:"absolute",visibility:"hidden"},children:t("defs",{children:p("linearGradient",{id:"progressGradient",x1:"1",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:"var(--bui-fg-warning)"}),t("stop",{offset:"100%",stopColor:"var(--bui-fg-success)"})]})})})),E=(o,i)=>i?.find(a=>a.id===o),G=o=>o?o.numberOfEntities-o.notApplicable-o.exempt:0,ge=N(({trackId:o,check:i,checkStatuses:a,searchParams:u,showFixMeColumn:c})=>{const P=de(),n=O(ne),b=re(),l=E(i.id,a),{passPercent:g,applicableChecks:h}=k(()=>{const s=G(l);return{passPercent:M(l?.passed,s),applicableChecks:s}},[l]);return p(V,{onAction:()=>{const s=n({trackId:o,checkId:i.id});b(u?`${s}${u}`:s)},children:[t(T,{leadingIcon:p("div",{className:P.circularProgressbar,title:`${g}%`,children:[t(ue,{}),t(te,{value:g,strokeWidth:12,styles:{path:{stroke:"url(#progressGradient)"},trail:{stroke:'rgba(var("--bui-fg-secondary"), 0.25)'}}})]}),title:`${g}%`}),t(T,{title:i.name}),t(ce,{children:p(W,{align:"center",gap:"3",justify:"between",children:[t(F,{children:p(_,{color:"secondary",children:[l?.passed??0," of ",h," checks passing"]})}),t(F,{className:P.statusBar,children:t(ae,{status:l})})]})}),t(me,{status:l,check:i,isColumnVisible:c})]},i.id)}),he=({trackId:o,checks:i,checkStatuses:a,searchValue:u,levelOrdinal:c})=>{const{updateSortParams:P,searchParams:n}=ie(),b=D("portal"),l=D("portal-ai-fm"),g=n.get("level"),h=c===void 0||g!==null&&String(c)===g,[s,y]=z(()=>{if(h){const e=n.get("sortDirection");if(e==="ascending"||e==="descending")return e}return"descending"}),[f,B]=z(()=>{if(h){const e=n.get("sort");if(e&&v(e))return e}return"compliance"}),L=k(()=>{const e=new URLSearchParams(n.toString());e.set("sort",f),e.set("sortDirection",s),typeof c=="number"?e.set("level",String(c)):e.delete("level");const r=e.toString();return r?`?${r}`:""},[c,n,f,s]);Z(()=>{if(!h)return;const e=n.get("sortDirection");(e==="ascending"||e==="descending")&&y(e);const r=n.get("sort");r&&v(r)&&B(r)},[h,n]);const U=ee(({direction:e,column:r})=>{const d=String(r);v(d)&&B(d),y(e),P({sort:v(d)?d:"compliance",sortDirection:e,level:c})},[c,P]),I=k(()=>{if(!u?.length)return i??[];const e=u.toLowerCase();return i?.filter(({name:r})=>r.toLowerCase().includes(e))??[]},[i,u]),C=k(()=>{const e=Y([...I],r=>{const d=E(r.id,a);if(f==="compliance"){const A=G(d);return M(d?.passed,A)}return f==="checks"?d?.passed:r.name.toLowerCase()});return s==="descending"&&e.reverse(),e},[I,a,f,s]),{paginatedItems:w,paginationProps:m}=oe({pageParam:"perPage",defaultPageSize:$,items:C}),j=C.length>$,R=k(()=>{const e=new Map;return(a??[]).forEach(r=>e.set(r.id,r)),e},[a]),x=k(()=>!b||!l?!1:w.some(e=>{const r=R.get(e.id);return se(r)}),[b,l,w,R]);return C?.length?p(H,{children:[p(q,{onSortChange:U,sortDescriptor:{direction:s,column:f},children:[p(J,{children:[t(S,{id:"compliance",allowsSorting:!0,style:{width:"10%"},children:"Compliance"}),t(S,{id:"name",allowsSorting:!0,isRowHeader:!0,children:"Name"}),t(S,{id:"checks",allowsSorting:!0,style:{width:"25%"},children:"Checks"}),t(S,{id:"fix-me",style:{width:x?"
|
|
1
|
+
import{jsx as t,jsxs as p,Fragment as H}from"react/jsx-runtime";import{useRouteRef as O}from"@backstage/core-plugin-api";import{Row as V,CellText as T,Flex as W,Box as F,Text as _,TableRoot as q,TableHeader as J,Column as S,TableBody as K,TablePagination as Q}from"@backstage/ui";import{makeStyles as X}from"@material-ui/core";import{sortBy as Y}from"lodash";import{memo as N,useMemo as k,useState as z,useEffect as Z,useCallback as ee}from"react";import{CircularProgressbar as te}from"react-circular-progressbar";import{useNavigate as re}from"react-router-dom";import"@backstage/catalog-model";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@backstage/plugin-catalog-react";import"@spotify/backstage-plugin-soundcheck-common";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import{usePagination as oe}from"../../hooks/usePagination.esm.js";import"react-use/lib/useLocalStorage";import{useSortSearchParams as ie}from"../../hooks/useSortSearchParams.esm.js";import{isCheckFailed as se}from"../../hooks/fixMe/useFixMe.esm.js";import{useFeatureFlag as D}from"../../hooks/useFeatureFlag.esm.js";import{trackCheckDetailsRouteRef as ne}from"../../routes.esm.js";import{getPercentage as M}from"../../utils/formatters.esm.js";import"../CheckStatusBar/CheckStatusBar.esm.js";import{CheckStatusBarBUI as ae}from"../CheckStatusBar/CheckStatusBarBUI.esm.js";import{CustomCell as ce}from"../CustomCell/CustomCell.esm.js";import"../EmptyState/EmptyState.esm.js";import{EmptyStateBUI as le}from"../EmptyState/EmptyStateBUI.esm.js";import"@backstage/plugin-permission-react";import"@remixicon/react";import{FixMeCell as me}from"./FixMeCell.esm.js";const de=X(()=>({statusBar:{width:"45%"},customCell:{padding:"0 var(--bui-space-3)"},circularProgressbar:{width:"var(--bui-space-7)"}})),$=10,pe=["compliance","name","checks"],v=o=>pe.includes(o),ue=N(()=>t("svg",{width:"0",height:"0",style:{position:"absolute",visibility:"hidden"},children:t("defs",{children:p("linearGradient",{id:"progressGradient",x1:"1",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:"var(--bui-fg-warning)"}),t("stop",{offset:"100%",stopColor:"var(--bui-fg-success)"})]})})})),E=(o,i)=>i?.find(a=>a.id===o),G=o=>o?o.numberOfEntities-o.notApplicable-o.exempt:0,ge=N(({trackId:o,check:i,checkStatuses:a,searchParams:u,showFixMeColumn:c})=>{const P=de(),n=O(ne),b=re(),l=E(i.id,a),{passPercent:g,applicableChecks:h}=k(()=>{const s=G(l);return{passPercent:M(l?.passed,s),applicableChecks:s}},[l]);return p(V,{onAction:()=>{const s=n({trackId:o,checkId:i.id});b(u?`${s}${u}`:s)},children:[t(T,{leadingIcon:p("div",{className:P.circularProgressbar,title:`${g}%`,children:[t(ue,{}),t(te,{value:g,strokeWidth:12,styles:{path:{stroke:"url(#progressGradient)"},trail:{stroke:'rgba(var("--bui-fg-secondary"), 0.25)'}}})]}),title:`${g}%`}),t(T,{title:i.name}),t(ce,{children:p(W,{align:"center",gap:"3",justify:"between",children:[t(F,{children:p(_,{color:"secondary",children:[l?.passed??0," of ",h," checks passing"]})}),t(F,{className:P.statusBar,children:t(ae,{status:l})})]})}),t(me,{status:l,check:i,isColumnVisible:c})]},i.id)}),he=({trackId:o,checks:i,checkStatuses:a,searchValue:u,levelOrdinal:c})=>{const{updateSortParams:P,searchParams:n}=ie(),b=D("portal"),l=D("portal-ai-fm"),g=n.get("level"),h=c===void 0||g!==null&&String(c)===g,[s,y]=z(()=>{if(h){const e=n.get("sortDirection");if(e==="ascending"||e==="descending")return e}return"descending"}),[f,B]=z(()=>{if(h){const e=n.get("sort");if(e&&v(e))return e}return"compliance"}),L=k(()=>{const e=new URLSearchParams(n.toString());e.set("sort",f),e.set("sortDirection",s),typeof c=="number"?e.set("level",String(c)):e.delete("level");const r=e.toString();return r?`?${r}`:""},[c,n,f,s]);Z(()=>{if(!h)return;const e=n.get("sortDirection");(e==="ascending"||e==="descending")&&y(e);const r=n.get("sort");r&&v(r)&&B(r)},[h,n]);const U=ee(({direction:e,column:r})=>{const d=String(r);v(d)&&B(d),y(e),P({sort:v(d)?d:"compliance",sortDirection:e,level:c})},[c,P]),I=k(()=>{if(!u?.length)return i??[];const e=u.toLowerCase();return i?.filter(({name:r})=>r.toLowerCase().includes(e))??[]},[i,u]),C=k(()=>{const e=Y([...I],r=>{const d=E(r.id,a);if(f==="compliance"){const A=G(d);return M(d?.passed,A)}return f==="checks"?d?.passed:r.name.toLowerCase()});return s==="descending"&&e.reverse(),e},[I,a,f,s]),{paginatedItems:w,paginationProps:m}=oe({pageParam:"perPage",defaultPageSize:$,items:C}),j=C.length>$,R=k(()=>{const e=new Map;return(a??[]).forEach(r=>e.set(r.id,r)),e},[a]),x=k(()=>!b||!l?!1:w.some(e=>{const r=R.get(e.id);return se(r)}),[b,l,w,R]);return C?.length?p(H,{children:[p(q,{onSortChange:U,sortDescriptor:{direction:s,column:f},children:[p(J,{children:[t(S,{id:"compliance",allowsSorting:!0,style:{width:"10%"},children:"Compliance"}),t(S,{id:"name",allowsSorting:!0,isRowHeader:!0,children:"Name"}),t(S,{id:"checks",allowsSorting:!0,style:{width:"25%"},children:"Checks"}),t(S,{id:"fix-me",style:{width:x?"23%":0,padding:x?void 0:0}})]}),t(K,{children:w.map(e=>t(ge,{trackId:o,check:e,checkStatuses:a,searchParams:L,showFixMeColumn:x},e.id))})]}),j&&t(Q,{totalCount:C.length,offset:m.offset,hasNextPage:m.offset+m.pageSize<(C.length??0),hasPreviousPage:m.offset>0,onNextPage:m.onNextPage,onPreviousPage:m.onPreviousPage,onPageSizeChange:m.onPageSizeChange,pageSize:m.pageSize})]}):t(le,{title:"No checks",body:"There are no checks found."})};export{he as ChecksTable};
|
|
2
2
|
//# sourceMappingURL=ChecksTable.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Flex as i,Card as C,CardBody as R,Text as o,Cell as b}from"@backstage/ui";import{RiShiningFill as F,RiGitMergeFill as x,RiGitPullRequestFill as k,RiErrorWarningFill as q}from"@remixicon/react";import"@backstage/catalog-model";import"@backstage/core-plugin-api";import"@tanstack/react-query";import"../../api.esm.js";import"../../hooks/graphqlKeys.esm.js";import"@backstage/plugin-catalog-react";import"@spotify/backstage-plugin-soundcheck-common";import{useCheck as v}from"../../hooks/checks/useCheck.esm.js";import"react";import"../../hooks/useSoundcheckAlert.esm.js";import"../../hooks/useConfirmationModal.esm.js";import"react-router-dom";import"react-use/lib/useLocalStorage";import{useFixMe as M}from"../../hooks/fixMe/useFixMe.esm.js";import{CustomCell as P}from"../CustomCell/CustomCell.esm.js";import{FixMeButton as h}from"../FixMeButton/FixMeButton.esm.js";import{ProgressBar as w}from"../ProgressBar/ProgressBar.esm.js";import{ViewPullRequests as S}from"../ViewPullRequests/ViewPullRequests.esm.js";const l={merged:"#c054deff",opened:"var(--bui-fg-success)",failed:"var(--bui-fg-danger)"},j=({check:n,status:g,isColumnVisible:f=!0})=>{const{data:c}=v(n.id),{showFixMeButton:d,hasShift:a,pullRequests:t,openPullRequestsCount:p,mergedPullRequestsCount:s,failedPullRequestsCount:m,pullRequestsCount:y,href:u}=M({type:c?.type,rule:c?.rule,checkStatus:g,checkId:n.id});return f?e(P,{children:r(i,{align:"center",justify:"end",children:[d&&!t.length&&e(h,{hasShift:a,href:u}),d&&t.length>0&&e(C,{style:{margin:"var(--bui-space-2) 0 var(--bui-space-2)"},children:e(R,{children:r(i,{direction:"column",children:[r(i,{align:"center",gap:"2",children:[e(F,{size:12}),e(o,{weight:"bold",children:"Fixes in progress"})]}),r(i,{align:"center",gap:"2",children:[e(w,{segments:[{key:"merged",value:s,label:"Merged",color:l.merged},{key:"opened",value:p,label:"Opened",color:l.opened},{key:"failed",value:m,label:"Failed",color:l.failed}]}),r(o,{weight:"bold",children:[s,"/",y]})]}),r(i,{gap:"6",children:[r(i,{align:"center",gap:"1",children:[e(x,{size:16,color:l.merged}),r(o,{color:"secondary",children:[s," merged"]})]}),r(i,{align:"center",gap:"1",children:[e(k,{size:16,color:l.opened}),r(o,{color:"secondary",children:[p," open"]})]}),r(i,{align:"center",gap:"1",children:[e(q,{size:16,color:l.failed}),r(o,{color:"secondary",children:[m," failed"]})]})]}),r(i,{align:"center",gap:"1",justify:"between",children:[t.length>0&&e(S,{checkName:n.name,pullRequests:t}),e(h,{hasShift:a,href:u})]})]})})})]})}):e(b,{style:{padding:0}})};export{j as FixMeCell};
|
|
2
2
|
//# sourceMappingURL=FixMeCell.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as l}from"react/jsx-runtime";import{useTable as b,Table as h,CellText as t,Cell as r,Button as a}from"@backstage/ui";const p=({pullRequests:n})=>{const c=n.map(e=>({...e,action:null})),d=n.every(({component:e,owner:i,status:w})=>e&&i&&w),o=e=>{const i=window.open(e,"_blank","noopener,noreferrer");i&&(i.opener=null)},s=d?[{id:"component",label:"Component",width:"29%",isRowHeader:!0,cell:({component:e})=>l(t,{title:e??""})},{id:"owner",label:"Owner",width:"25%",cell:({owner:e})=>l(t,{title:e??""})},{id:"status",label:"Status",width:"10%",cell:({status:e})=>l(t,{title:e??""})},{id:"branch",label:"Branch",width:"30%",cell:({branch:e})=>l(t,{title:e??""})},{id:"action",label:"Action",width:"6%",cell:({url:e})=>l(r,{children:l(a,{onClick:()=>{e&&o(e)},children:"View"})})}]:[{id:"title",label:"Title",width:"80%",isRowHeader:!0,cell:({title:e})=>l(t,{title:e})},{id:"status",label:"Status",width:"14%",cell:({remedyStatus:e})=>l(t,{title:e})},{id:"action",label:"Action",width:"6%",cell:({url:e})=>l(r,{children:l(a,{onClick:()=>{e&&o(e)},children:"View"})})}],{tableProps:u}=b({mode:"complete",data:c});return l(h,{columnConfig:s,...u})};export{p as PullRequestsTable};
|
|
2
2
|
//# sourceMappingURL=PullRequestsTable.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{Button as s}from"@backstage/ui";import{useNavigate as n}from"react-router-dom";const f=({href:i,isDisabled:t,hasShift:e})=>{const o=n();return r(s,{onClick:()=>i&&o(i),isDisabled:t,children:e?"View Fix Progress":"Fix with Fleetshift"})};export{f as FixMeButton};
|
|
2
2
|
//# sourceMappingURL=FixMeButton.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as s,Fragment as a,jsx as e}from"react/jsx-runtime";import{Button as p,Dialog as c,DialogHeader as m,DialogBody as d}from"@backstage/ui";import{useState as h}from"react";import{PullRequestsTable as q}from"../ChecksTable/PullRequestsTable.esm.js";const R=({checkName:l,pullRequests:i})=>{const[o,n]=h(!1),u=l?`${l} - Pull Requests`:"Pull Requests",r=t=>{n(t)};return s(a,{children:[e(p,{variant:"tertiary",onClick:t=>{t.stopPropagation(),r(!0)},children:"View Pull Requests"}),s(c,{isOpen:o,onOpenChange:r,width:"60%",children:[e(m,{children:u}),e(d,{children:e(q,{pullRequests:i})})]})]})};export{R as ViewPullRequests};
|
|
2
2
|
//# sourceMappingURL=ViewPullRequests.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{REMEDY_STATUS as
|
|
1
|
+
import{REMEDY_STATUS as f}from"@spotify/backstage-plugin-soundcheck-common";import{CheckerType as y}from"../../graphql/generated/index.esm.js";import{useRemediesForCheck as P}from"../remedy/useRemediesForCheck.esm.js";import"react-use/lib/useAsync";import"@backstage/core-plugin-api";import"../../api.esm.js";import{useFeatureFlag as m}from"../useFeatureFlag.esm.js";const p=e=>(e?.failed??0)>0;function d({isPortal:e,isPortalAiFm:i,type:l,rule:r,checkStatus:n}){const a=l===y.Manual,s=!!r&&!a;return e&&i&&p(n)&&s}const S=e=>{if(!e)return;const i="Fleetshift: ";if(e.startsWith(i))return e.slice(i.length).trim()||void 0;const l=e.match(/^Fleetshift shift \((.*)\)$/);if(l){const r=l[1]?.trim();return!r||r==="unknown"?void 0:r}},C=({type:e,rule:i,checkStatus:l,checkId:r})=>{const n=m("portal"),a=m("portal-ai-fm"),{value:s}=P(r),h=(s?.length??0)>0,o=s?.filter(({prUrl:t})=>t).map(t=>({id:t.id,title:t.label,branch:t.prBranch??t.provider,url:t.prUrl,component:t.component,owner:t.owner,status:t.prStatus,remedyStatus:t.status}))??[],F=o?.length,k=o?.filter(({remedyStatus:t})=>t===f.RESOLVED).length,g=o?.filter(({remedyStatus:t})=>t===f.FAILED).length,R=o?.filter(({remedyStatus:t})=>t===f.IN_PROGRESS).length,c=d({isPortal:n,isPortalAiFm:a,type:e,rule:i,checkStatus:l,hasShift:h});let u;if(c){const t=s?.[0]?.shiftName?s?.[0]?.shiftName:S(s?.[0]?.label);h?t?u=`/fleetshift/shifts/${t}`:u="/fleetshift/shifts":u=`/fleetshift/shifts/new?source=soundcheck.check.${r}`}return{showFixMeButton:c,hasShift:h,href:u,pullRequests:o,pullRequestsCount:F,mergedPullRequestsCount:k,failedPullRequestsCount:g,openPullRequestsCount:R}};export{S as extractShiftNameFromLabel,p as isCheckFailed,d as isFixMeEligible,C as useFixMe};
|
|
2
2
|
//# sourceMappingURL=useFixMe.esm.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spotify/backstage-plugin-soundcheck",
|
|
3
3
|
"description": "Ensure quality, reliability and alignment of software development with codified checks and guidance.",
|
|
4
|
-
"version": "0.22.
|
|
4
|
+
"version": "0.22.3",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://backstage.spotify.com",
|
|
7
7
|
"main": "./dist/index.esm.js",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@nivo/treemap": "^0.99.0",
|
|
86
86
|
"@remixicon/react": "^4.6.0",
|
|
87
87
|
"@spotify/backstage-plugin-core": "^0.8.15",
|
|
88
|
-
"@spotify/backstage-plugin-soundcheck-common": "^0.21.
|
|
88
|
+
"@spotify/backstage-plugin-soundcheck-common": "^0.21.3",
|
|
89
89
|
"@tanstack/react-query": "^4.6.1",
|
|
90
90
|
"@uiw/react-md-editor": "3.20.10",
|
|
91
91
|
"classnames": "^2.3.2",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{makeStyles as n}from"@material-ui/core";import{RiLoopRightLine as r}from"@remixicon/react";const i=n(()=>({spin:{animation:"$spin 1s linear infinite"},"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}})),s=()=>{const o=i();return t(r,{className:o.spin})};export{s as LoadingIcon};
|
|
2
|
-
//# sourceMappingURL=LoadingIcon.esm.js.map
|