PageSourceSearch

https://zop.dev/zopnight/app/assets/IacPolicyTable-D6i9jGH2.js

js zop.dev collected 2026-09-25 14:35:34 UTC 4,579 bytes, 1 lines download raw bytes

1import{r as d,j as e}from"./react-vendor-CSsSSEML.js";import{f as j,P as N,B as p,E as v}from"./index-BVsjb7mB.js";import{E}from"./ErrorState-CE1mnLGb.js";import{C}from"./ConfirmDialog-BvaLv-yh.js";import{T as w}from"./TableSkeleton-CEkMNKo7.js";import{T as P}from"./Toggle-j70g6imr.js";import{f as S,g as I,t as D,v as T,d as k,k as O,E as R}from"./bits-CHU18EAR.js";import{P as _}from"./PolicyWizard-u7BMqtjH.js";import"./tanstack-vendor-D2LStv3_.js";import"./sentry-vendor-DQkRq1-W.js";import"./TypeToConfirmInput-BRI3yPKX.js";import"./useCopyToClipboard-D1iEeEhF.js";import"./SearchableSelect-BM_5_tjW.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"33b2f1a2eb67da61a8a79f4c3c0fca45c630c2e5"};var r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="ce880e74-7bb6-48ef-95b8-ebf2e242f97e",t._sentryDebugIdIdentifier="sentry-dbid-ce880e74-7bb6-48ef-95b8-ebf2e242f97e")}catch{}})();function L(t){if(t.targetType!=="repository"||!t.targetId)return"Organisation-wide";const r=String(t.targetId).split(",").map(o=>o.trim()).filter(Boolean);return r.length===1?r[0]:`${r.length} repositories`}function Q(){const{data:t=[]}=S(),r=d.useMemo(()=>Object.fromEntries(t.map(s=>[s.rule,s])),[t]),{data:o=[],isLoading:f,isError:u,error:h,refetch:m}=I(),y=D(),x=T(),n=j(N.IAC_POLICY_MANAGE),[b,l]=d.useState(!1),[i,c]=d.useState(null);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("p",{className:"max-w-2xl text-sm text-text-muted",children:"Author policies from the builtin catalog or custom Rego and attach each to one or more repositories. Existing organisation-wide policies stay listed and enforceable."}),n&&e.jsx(p,{variant:"primary",size:"sm",onClick:()=>l(!0),children:"Create policy"})]}),f?e.jsx(w,{rows:4}):u?e.jsx(E,{error:h,onRetry:m,resource:"policies"}):o.length===0?e.jsx(v,{title:"No IaC policies yet",description:"Create your first policy — pick a builtin rule (encryption, budget caps, tags…) or write custom Rego, then attach it to one or more repositories.",icon:e.jsx("div",{className:"text-3xl opacity-50",children:"❯"}),action:n?e.jsx(p,{variant:"primary",size:"sm",onClick:()=>l(!0),children:"Create policy"}):void 0}):e.jsx("div",{className:"overflow-hidden rounded-lg border border-border bg-surface",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[720px] text-[12.5px]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-[11px] font-medium text-text-muted",children:[e.jsx("th",{className:"px-4 py-2.5 text-left font-medium",children:"Policy"}),e.jsx("th",{className:"px-4 py-2.5 text-left font-medium",children:"Scope"}),e.jsx("th",{className:"px-4 py-2.5 text-left font-medium",children:"Severity"}),e.jsx("th",{className:"px-4 py-2.5 text-left font-medium",children:"Enforcement"}),e.jsx("th",{className:"px-4 py-2.5 text-center font-medium",children:"Enabled"}),e.jsx("th",{className:"px-4 py-2.5 text-right font-medium"})]})}),e.jsx("tbody",{children:o.map(s=>{const a=k(s,r);return e.jsxs("tr",{className:"border-b border-border/60 last:border-0",children:[e.jsxs("td",{className:"px-4 py-2.5",children:[e.jsx("div",{className:"font-medium text-text-primary",children:s.name||a.name||a.rule}),e.jsx("div",{className:"font-mono text-[11px] text-text-muted",children:a.rule})]}),e.jsx("td",{className:"px-4 py-2.5 font-mono text-[11.5px] text-text-secondary",children:L(s)}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(O,{level:a.severity})}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(R,{value:a.enforcement})}),e.jsx("td",{className:"px-4 py-2.5 text-center",children:e.jsx(P,{checked:s.enabled!==!1,onChange:g=>y.mutate({id:s.id,enabled:g}),label:s.enabled!==!1?"On":"Off",disabled:!n})}),e.jsx("td",{className:"px-4 py-2.5 text-right",children:n&&e.jsx("button",{type:"button",onClick:()=>c(s),className:"rounded px-2 py-1 text-[11.5px] font-medium text-text-muted hover:text-danger-600",children:"Delete"})})]},s.id)})})]})})}),e.jsx(_,{open:b,onClose:()=>l(!1),onCreated:m}),e.jsx(C,{open:!!i,onClose:()=>c(null),onConfirm:()=>i&&x.mutate(i.id,{onSuccess:()=>c(null)}),title:i?`Delete “${i.name||"this policy"}”?`:"",message:"This removes the policy and stops enforcing it on future validations.",confirmLabel:"Delete policy",variant:"delete",isLoading:x.isPending})]})}
1export{Q as IacPolicyTable};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.