unleash-server 6.2.0 → 6.2.2
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/dist/lib/features/project/can-grant-project-role.d.ts +4 -0
- package/dist/lib/features/project/can-grant-project-role.d.ts.map +1 -0
- package/dist/lib/features/project/can-grant-project-role.js +17 -0
- package/dist/lib/features/project/can-grant-project-role.js.map +1 -0
- package/dist/lib/features/project/can-grant-project-role.test.d.ts +2 -0
- package/dist/lib/features/project/can-grant-project-role.test.d.ts.map +1 -0
- package/dist/lib/features/project/can-grant-project-role.test.js +111 -0
- package/dist/lib/features/project/can-grant-project-role.test.js.map +1 -0
- package/dist/lib/features/project/project-service.d.ts.map +1 -1
- package/dist/lib/features/project/project-service.e2e.test.js +31 -29
- package/dist/lib/features/project/project-service.e2e.test.js.map +1 -1
- package/dist/lib/features/project/project-service.js +13 -1
- package/dist/lib/features/project/project-service.js.map +1 -1
- package/dist/lib/features/project-environments/environments.d.ts.map +1 -1
- package/dist/lib/features/project-environments/environments.js +1 -1
- package/dist/lib/features/project-environments/environments.js.map +1 -1
- package/dist/lib/routes/admin-api/user/user.d.ts +1 -0
- package/dist/lib/routes/admin-api/user/user.d.ts.map +1 -1
- package/dist/lib/routes/admin-api/user/user.js +8 -1
- package/dist/lib/routes/admin-api/user/user.js.map +1 -1
- package/dist/lib/types/experimental.d.ts +1 -1
- package/dist/lib/types/experimental.d.ts.map +1 -1
- package/dist/lib/types/experimental.js +1 -0
- package/dist/lib/types/experimental.js.map +1 -1
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/{AdvancedPlayground-CRj3J15M.js → AdvancedPlayground-CRdeeG3w.js} +1 -1
- package/frontend/build/static/{CreateProject-CoMWBmMC.js → CreateProject-8AyZj2dp.js} +1 -1
- package/frontend/build/static/{FeatureMetricsChart-CJrrWMue.js → FeatureMetricsChart-DEo4WxO1.js} +1 -1
- package/frontend/build/static/FeatureStaleDialog-CrsbH2rq.js +7 -0
- package/frontend/build/static/{FeatureViewLazyExport-CCemx_kk.js → FeatureViewLazyExport-BwY7TYmZ.js} +2 -2
- package/frontend/build/static/{LazyAdminExport-C8Z5ig95.js → LazyAdminExport-0g_UOhr3.js} +2 -2
- package/frontend/build/static/{LazyProjectExport-Dooc4t2t.js → LazyProjectExport-C1eSkT3Z.js} +18 -18
- package/frontend/build/static/LineChartComponent-BLXX5chp.js +1 -0
- package/frontend/build/static/{NetworkOverview-DakM348r.js → NetworkOverview-DqGLVIJ6.js} +1 -1
- package/frontend/build/static/{NetworkTraffic-CfqRQOHm.js → NetworkTraffic-BWFLlaz7.js} +1 -1
- package/frontend/build/static/{NetworkTrafficUsage-BnIFfNNJ.js → NetworkTrafficUsage-BvoBumVR.js} +1 -1
- package/frontend/build/static/{ReactJSONEditor-z4lldZFR.js → ReactJSONEditor-Bvhd5heT.js} +1 -1
- package/frontend/build/static/{RoleCell-BLQYE7NO.js → RoleCell-DGcue0jn.js} +1 -1
- package/frontend/build/static/{StrategyItemContainer-0nEHrvdC.js → StrategyItemContainer-Das6_30A.js} +1 -1
- package/frontend/build/static/{index-DhEaCpkq.js → index-BsIpdLcw.js} +1 -1
- package/frontend/build/static/{index-C5Z6aehP.js → index-Cx91uh9W.js} +17 -17
- package/frontend/build/static/{unknownify-CLPkLMVA.js → unknownify-8qa4PVkQ.js} +1 -1
- package/frontend/build/static/{useApiTokens-DfEYjYPV.js → useApiTokens-5JgqgHim.js} +1 -1
- package/package.json +1 -1
- package/frontend/build/static/FeatureStaleDialog-Yc2Yc4V5.js +0 -7
- package/frontend/build/static/LineChartComponent-BxkVmXGQ.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as c,j as a,B as p,E as f,T as y,V as m,b as S,bb as h,r as u,C,i9 as j,ia as I,ib as v,ic as L,id as w,ie as k,ig as R,ih as z,ii as A}from"./index-Cx91uh9W.js";import{L as B}from"./index-BsIpdLcw.js";const E=c("ul")(({theme:e})=>({listStyle:"none",margin:0,padding:0})),P=c("li")(({theme:e})=>({marginBottom:e.spacing(.5),display:"flex",alignItems:"center"})),T=c("span")(({theme:e})=>({display:"inline-block",width:8,height:8,borderRadius:"50%",marginRight:e.spacing(1)})),g=16,D=e=>e==="left"?"flex-start":e==="right"?"flex-end":"center",Y=(e=0,t)=>t==="left"?e+g:t==="right"?e-g:e,b=({tooltip:e,children:t})=>a.jsx(p,{sx:n=>({top:((e==null?void 0:e.caretY)||0)+g,left:Y(e==null?void 0:e.caretX,e==null?void 0:e.align),width:"1px",position:"absolute",display:e?"flex":"none",pointerEvents:"none",zIndex:n.zIndex.tooltip,flexDirection:"column",alignItems:D(e==null?void 0:e.align)}),children:t}),_=({tooltip:e})=>a.jsx(b,{tooltip:e,children:a.jsxs(f,{elevation:3,sx:t=>({width:220,padding:t.spacing(1.5,2)}),children:[a.jsx(y,{variant:"body2",sx:t=>({marginBottom:t.spacing(1),color:t.palette.text.secondary}),children:e==null?void 0:e.title}),a.jsx(E,{children:e==null?void 0:e.body.map(t=>a.jsxs(P,{children:[a.jsx(T,{sx:{backgroundColor:t.color},children:" "}),a.jsx(y,{variant:"body2",sx:{display:"inline-block"},children:t.title})]},m(t)))})]})}),M=e=>t=>{var s,r;const n=t.tooltip;if(n.opacity===0){e(null);return}e({caretX:n==null?void 0:n.caretX,caretY:n==null?void 0:n.caretY,title:((s=n==null?void 0:n.title)==null?void 0:s.join(" "))||"",align:n==null?void 0:n.xAlign,body:((r=n==null?void 0:n.body)==null?void 0:r.map((i,o)=>{var l,d,x;return{title:(l=i==null?void 0:i.lines)==null?void 0:l.join(" "),color:(x=(d=n==null?void 0:n.labelColors)==null?void 0:d[o])==null?void 0:x.borderColor,value:""}}))||[],dataPoints:(n==null?void 0:n.dataPoints)||[]})},O={position:"bottom",labels:{boxWidth:12,padding:30,generateLabels:e=>{var o;const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:s,textAlign:r,color:i}}=((o=e==null?void 0:e.legend)==null?void 0:o.options)||{labels:{}};return e._getSortedDatasetMetas().map(l=>{const d=l.controller.getStyle(n?0:void 0);return{text:t[l.index].label,fillStyle:d.borderColor,fontColor:i,hidden:!l.visible,lineWidth:0,borderRadius:6,strokeStyle:d.borderColor,pointStyle:s||d.pointStyle,textAlign:r||d.textAlign,datasetIndex:l.index}})}}},W=(e,t,n,s)=>({responsive:!0,...s?{animation:{duration:0}}:{},plugins:{legend:{...O,display:!s},tooltip:{enabled:!1,position:"nearest",interaction:{axis:"xy",mode:"nearest"},external:M(n)}},locale:t.locale,interaction:{intersect:!1,axis:"xy",mode:"nearest"},elements:{point:{radius:0,hitRadius:15}},tension:.1,color:e.palette.text.secondary,scales:{y:{beginAtZero:!0,type:"linear",grid:{color:e.palette.divider,borderColor:e.palette.divider},ticks:{color:e.palette.text.secondary,display:!s,precision:0}},x:{type:"time",time:{unit:"week",tooltipFormat:"PPP"},grid:{color:"transparent",borderColor:"transparent"},ticks:{color:e.palette.text.secondary,display:!s,source:"data",maxRotation:90,minRotation:23.5}}}}),X=c("div")(({theme:e})=>({position:"relative"})),F=c("div")(({theme:e})=>({position:"absolute",inset:0,display:"flex",zIndex:e.zIndex.appBar,"&::before":{zIndex:e.zIndex.fab,content:'""',position:"absolute",inset:0,backgroundColor:e.palette.background.paper,opacity:.8}})),G=c("div")(({theme:e})=>({zIndex:e.zIndex.modal,margin:"auto",color:e.palette.text.secondary,textAlign:"center"})),H={id:"customLine",afterDraw:e=>{var n;if((n=e.tooltip)!=null&&n.opacity&&e.tooltip.x){const s=e.tooltip.caretX,r=e.scales.y,i=e.ctx;i.save();const o=i.createLinearGradient(s,r.top,s,r.bottom);o.addColorStop(0,"rgba(129, 122, 254, 0)"),o.addColorStop(1,"rgba(129, 122, 254, 0.12)"),i.fillStyle=o,i.fillRect(s-26/2,r.top,26,r.bottom-r.top),i.restore()}}},q=({data:e,aspectRatio:t=2.5,cover:n,overrideOptions:s,TooltipComponent:r})=>{const i=S(),{locationSettings:o}=h(),[l,d]=u.useState(null),x=u.useMemo(()=>({...W(i,o,d,!!n),...s}),[i,o,s,n]);return a.jsxs(X,{children:[a.jsx(B,{options:x,data:e,plugins:[H],height:100,width:100*t},n?"cover":"chart"),a.jsx(C,{condition:!n,show:r?a.jsx(b,{tooltip:l,children:a.jsx(r,{tooltip:l})}):a.jsx(_,{tooltip:l}),elseShow:a.jsx(F,{children:a.jsx(G,{children:n!==!0?n:" "})})})]})};j.register(I,v,L,w,k,R,z,A);export{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as i,T as d,cL as h,b as x,r as u,j as t,N as y,g8 as c,
|
|
1
|
+
import{s as i,T as d,cL as h,b as x,r as u,j as t,N as y,g8 as c,im as m,io as f,ip as j}from"./index-Cx91uh9W.js";import{u as b,a as g}from"./unknownify-8qa4PVkQ.js";const v=i("div")(({theme:e})=>({marginBottom:e.spacing(18),display:"flex",justifyContent:"center"})),w=i("div")(({theme:e})=>({display:"flex",justifyContent:"center",gap:e.spacing(4),flexWrap:"wrap"})),p=i("div")(({theme:e})=>({borderRadius:e.shape.borderRadiusMedium,border:"1px solid",borderColor:e.palette.secondary.border,backgroundColor:e.palette.secondary.light,display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(1.5),zIndex:1,"& > svg":{width:e.spacing(9),height:e.spacing(9)}})),S=i(d)(({theme:e})=>({fontWeight:e.fontWeight.bold})),k=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary})),A=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),q=e=>e[0]*1e3>new Date().getTime()-6e5,C=e=>{var a,s;const r=(e.values||[]).filter(l=>q(l)),o=r.length?Number.parseFloat(r[r.length-1][1]):0;return{label:e.label,reqs:o,type:g((s=(a=e.metric)==null?void 0:a.endpoint)==null?void 0:s.split("/")[2])}},E=(e,n)=>{var o;const r=n.label+n.type;return e[r]={...n,reqs:n.reqs+(((o=e[r])==null?void 0:o.reqs)??0)},e},T=e=>{var o,a;const r=(((a=(o=e==null?void 0:e.data)==null?void 0:o.result)==null?void 0:a.map(s=>{var l;return{...s,label:g((l=s.metric)==null?void 0:l.appName)}}).filter(s=>s.label!=="unknown"))||[]).map(C).reduce(E,{});return Object.values(r).map(s=>({...s,reqs:s.reqs.toFixed(2)})).filter(s=>s.reqs!=="0.00")??[]},R=()=>{h("Network - Overview");const e=x(),{metrics:n}=b(),r=u.useMemo(()=>T(n),[n]);return r.length===0?t.jsx(y,{severity:"warning",children:"No data available."}):t.jsxs(c.ArcherContainer,{strokeColor:e.palette.text.primary,endShape:{arrow:{arrowLength:4,arrowThickness:4}},children:[t.jsx(v,{children:t.jsx(c.ArcherElement,{id:"unleash",children:t.jsxs(p,{children:[t.jsx(m,{darkmode:t.jsx(f,{}),lightmode:t.jsx(j,{})}),t.jsx(d,{sx:{marginTop:e.spacing(1)},children:"Unleash"})]})})}),t.jsx(w,{children:r.map(({label:o,reqs:a,type:s},l)=>t.jsx(c.ArcherElement,{id:`${l}`,relations:[{targetId:"unleash",targetAnchor:"bottom",sourceAnchor:"top",style:{strokeColor:e.palette.secondary.border}}],children:t.jsxs(p,{children:[t.jsx(S,{children:o}),t.jsxs(k,{children:[a," req/s"]}),t.jsxs(A,{children:[s," app"]})]})}))})]})};export{R as NetworkOverview,R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var f=Object.defineProperty;var k=(t,e,
|
|
1
|
+
var f=Object.defineProperty;var k=(t,e,a)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var s=(t,e,a)=>k(t,typeof e!="symbol"?e+"":e,a);import{bb as C,b as v,r as p,cL as w,j as o,C as P,N as S,c_ as j,i9 as N,ia as I,ib as L,ic as M,id as R,ie as T,ih as A,ig as _,il as q,ik as u}from"./index-Cx91uh9W.js";import{u as E,a as g}from"./unknownify-8qa4PVkQ.js";import{L as D}from"./index-BsIpdLcw.js";class H{constructor(e){s(this,"current",0);s(this,"all");this.all=e}next(){const e=this.all[this.current];return this.current=(this.current+1)%this.all.length,e}}const m=["circle","rect","rectRounded","rectRot","triangle"],W=(t,e)=>t.map(a=>({x:a[0],y:e(a[1])})),$=(t,e)=>({locale:e.locale,responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},color:t.palette.text.secondary,plugins:{tooltip:{backgroundColor:t.palette.background.paper,bodyColor:t.palette.text.primary,titleColor:t.palette.action.active,borderColor:t.palette.primary.main,borderWidth:1,padding:10,boxPadding:5,usePointStyle:!0,callbacks:{title:a=>u(1e3*a[0].parsed.x,e.locale)},itemSort:(a,r)=>r.parsed.y-a.parsed.y},legend:{position:"bottom",align:"start",labels:{boxWidth:10,boxHeight:10,usePointStyle:!0,padding:24}},title:{text:"Top 10 requests per second in the last 6 hours",position:"top",align:"start",display:!0,font:{size:16,weight:"400"},color:t.palette.text.primary,padding:{bottom:32}}},scales:{y:{type:"linear",title:{display:!0,text:"Requests per second",color:t.palette.text.secondary},suggestedMin:0,ticks:{precision:0,color:t.palette.text.secondary},grid:{color:t.palette.divider,borderColor:t.palette.divider}},x:{type:"time",time:{unit:"minute"},grid:{display:!0,color:t.palette.divider,borderColor:t.palette.divider},ticks:{callback:(a,r,i)=>u(i[r].value*1e3,e.locale)}}}});class z{constructor(e){s(this,"items");s(this,"picked",new Map);this.items=new H(e)}pick(e){return this.picked.has(e)||this.picked.set(e,this.items.next()),this.picked.get(e)}}const B=(t,e)=>{var a;if((a=e==null?void 0:e.data)!=null&&a.result){const r=new z([t.palette.success,t.palette.error,t.palette.primary,t.palette.warning]);return e.data.result.map((i,x)=>{var c,d;const n=g((c=i.metric)==null?void 0:c.endpoint),b=g((d=i.metric)==null?void 0:d.appName),l=r.pick(n),y=i.values||[];return{label:`${n}: ${b}`,borderColor:l.main,backgroundColor:l.main,data:W(y,h=>Number.parseFloat(h)),elements:{point:{radius:4,pointStyle:m[x%m.length]},line:{borderDash:[8,4]}}}})}return[]},K=()=>{const{locationSettings:t}=C(),{metrics:e}=E(),a=v(),r=p.useMemo(()=>$(a,t),[a,t]);w("Network - Traffic");const i=p.useMemo(()=>({datasets:B(a,e)}),[a,e,t]);return o.jsx(P,{condition:i.datasets.length===0,show:o.jsx(S,{severity:"warning",children:"No data available."}),elseShow:o.jsx(j,{sx:{display:"grid",gap:4},children:o.jsx("div",{style:{height:400},children:o.jsx(D,{data:i,options:r,"aria-label":"An instance metrics line chart with two lines: requests per second for admin API and requests per second for client API"})})})})};N.register(I,L,M,R,T,A,_,q);export{K as NetworkTraffic,K as default};
|
package/frontend/build/static/{NetworkTrafficUsage-BnIFfNNJ.js → NetworkTrafficUsage-BvoBumVR.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as E,cs as O,c_ as K,cp as ct,j as f,H as ye,C as G,cD as me,
|
|
1
|
+
import{s as E,cs as O,c_ as K,cp as ct,j as f,H as ye,C as G,cD as me,ij as Lt,iq as z,ir as j,is as M,it as ce,iu as ke,iv as Wt,iw as x,i9 as se,ix as Q,iy as T,iz as Bt,iA as Yt,iB as F,iC as De,iD as de,iE as zt,iF as _t,iG as $,iH as re,iI as Ye,iJ as Xt,iK as ze,iL as B,iM as ut,iN as ft,iO as Nt,cL as Ht,b as Ut,b8 as $t,r as P,N as _e,L as Xe,g7 as Vt,ia as qt,ib as Jt,iP as Gt,il as Ft,ig as Kt,ih as Qt}from"./index-Cx91uh9W.js";import{B as Zt}from"./index-BsIpdLcw.js";import{u as en,a as tn}from"./LazyAdminExport-0g_UOhr3.js";import"./RoleCell-DGcue0jn.js";import"./useApiTokens-5JgqgHim.js";const nn=E(O)(({theme:t})=>({display:"flex",flexDirection:"row"})),Ne=E(O)(({theme:t})=>({display:"flex",flexDirection:"row",flex:"1 1"})),He=E(O)(({theme:t})=>({display:"flex",flexDirection:"column",flex:"1 1"})),Ue=E("div")(({theme:t})=>({display:"flex",flexDirection:"row",flex:"1 1",padding:t.spacing(3),border:`2px solid ${t.palette.divider}`,borderRadius:t.shape.borderRadiusLarge})),be=E(K)(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(2.5),color:t.palette.text.secondary,fontSize:t.fontSizes.smallBody,marginTop:t.spacing(2)})),V=E(K)(({theme:t})=>({display:"flex",flexDirection:"row"})),q=E("div")(({theme:t})=>({marginLeft:"auto",display:"flex",textDecoration:"none",color:t.palette.text.primary})),on=({usageTotal:t,includedTraffic:e,overageCost:n,estimatedMonthlyCost:o})=>{const r=t-e,i=ct("estimateTrafficDataCost");return f.jsxs(nn,{container:!0,spacing:4,children:[f.jsx(Ne,{item:!0,xs:5.5,md:5.5,children:f.jsx(Ue,{children:f.jsxs(He,{item:!0,children:[f.jsx(K,{children:f.jsx("b",{children:"Number of requests to Unleash"})}),f.jsx(be,{children:f.jsxs(V,{children:["Incoming requests selected month"," ",f.jsx(q,{children:f.jsxs(ye,{color:e>0?t<=e?"success":"error":"neutral",children:[t.toLocaleString()," requests"]})})]})}),f.jsx(G,{condition:e>0,show:f.jsx(be,{children:f.jsxs(V,{children:["Included in your plan monthly",f.jsxs(q,{children:[e.toLocaleString()," ","requests"]})]})})})]})})}),f.jsx(G,{condition:i&&e>0&&r>0,show:f.jsx(Ne,{item:!0,xs:5.5,md:5.5,children:f.jsx(Ue,{children:f.jsxs(He,{item:!0,children:[f.jsx(K,{children:f.jsx("b",{children:"Accrued traffic charges"})}),f.jsxs(be,{children:[f.jsxs(V,{children:["Requests overages this month (",f.jsx(me,{href:"https://www.getunleash.io/pricing",children:"pricing"}),")",f.jsxs(q,{children:[r.toLocaleString()," requests"]})]}),f.jsxs(V,{children:["Accrued traffic charges",f.jsx(q,{children:f.jsxs(ye,{color:"secondary",children:[n," USD"]})})]}),f.jsx(G,{condition:o>0,show:f.jsxs(V,{children:["Estimated traffic charges based on current usage",f.jsx(q,{children:f.jsxs(ye,{color:"secondary",children:[o," ","USD"]})})]})})]})]})})})})]})};/*!
|
|
2
2
|
* chartjs-plugin-annotation v2.2.1
|
|
3
3
|
* https://www.chartjs.org/chartjs-plugin-annotation/index
|
|
4
4
|
* (c) 2023 chartjs-plugin-annotation Contributors
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Lb,
|
|
1
|
+
import{g as Lb,i8 as Db,d5 as Fb,s as Bb,r as Ya,U as Ub,j as pu}from"./index-Cx91uh9W.js";import{V as i1,I as Vb,J as Hb,A as bi,K as kc,L as a1,R as s1,H as Jb,B as Ua,o as c1,E as Ji,z as Gd,C as Kb,M as Wb,b as Gb,e as Qb,g as Yb,i as Xb,j as Zb,k as ej,m as tj,n as nj,p as rj,q as oj,r as ij,t as aj,u as sj,v as cj,w as lj,x as uj,c as fj,d as dj,s as pj,h as vj,f as mj,a as hj,l as gj,G as yj,N as bj,O as jj,y as $j,P as wj,Q as xj,T as Sj,U as Va,W as Cj,X as kj,Y as _j,Z as Ej}from"./index-BEpcKp7m.js";function xn(t){return Array.isArray(t)}function In(t){return t!==null&&typeof t=="object"&&(t.constructor===void 0||t.constructor.name==="Object")}function l1(t){return t&&typeof t=="object"?t.op==="add":!1}function u1(t){return t&&typeof t=="object"?t.op==="remove":!1}function vf(t){return t&&typeof t=="object"?t.op==="replace":!1}function vu(t){return t&&typeof t=="object"?t.op==="copy":!1}function la(t){return t&&typeof t=="object"?t.op==="move":!1}function Oj(t,e){return JSON.stringify(t)===JSON.stringify(e)}function Mj(t,e){return t===e}function f1(t){return t.slice(0,t.length-1)}function Pj(t){return t[t.length-1]}function Tj(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Mj;if(t.length<e.length)return!1;for(let r=0;r<e.length;r++)if(!n(t[r],e[r]))return!1;return!0}function d1(t){return typeof t=="object"&&t!==null}function mf(t){if(xn(t)){const e=t.slice();return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else if(In(t)){const e={...t};return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else return t}function hf(t,e,n){if(t[e]===n)return t;{const r=mf(t);return r[e]=n,r}}function We(t,e){let n=t,r=0;for(;r<e.length;)In(n)?n=n[e[r]]:xn(n)?n=n[parseInt(e[r])]:n=void 0,r++;return n}function Yr(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e.length===0)return n;const o=e[0],i=Yr(t?t[o]:void 0,e.slice(1),n,r);if(In(t)||xn(t))return hf(t,o,i);if(r){const a=Rj.test(o)?[]:{};return a[o]=i,a}else throw new Error("Path does not exist")}const Rj=/^\d+$/;function p1(t,e,n){if(e.length===0)return n(t);if(!d1(t))throw new Error("Path doesn't exist");const r=e[0],o=p1(t[r],e.slice(1),n);return hf(t,r,o)}function gf(t,e){if(e.length===0)return t;if(!d1(t))throw new Error("Path does not exist");if(e.length===1){const o=e[0];if(o in t){const i=mf(t);return xn(i)&&i.splice(parseInt(o),1),In(i)&&delete i[o],i}else return t}const n=e[0],r=gf(t[n],e.slice(1));return hf(t,n,r)}function yf(t,e,n){const r=e.slice(0,e.length-1),o=e[e.length-1];return p1(t,r,i=>{if(!Array.isArray(i))throw new TypeError("Array expected at path "+JSON.stringify(r));const a=mf(i);return a.splice(parseInt(o),0,n),a})}function Lr(t,e){return t===void 0?!1:e.length===0?!0:t===null?!1:Lr(t[e[0]],e.slice(1))}function ao(t){const e=t.split("/");return e.shift(),e.map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"))}function Be(t){return t.map(bf).join("")}function bf(t){return"/"+String(t).replace(/~/g,"~0").replace(/\//g,"~1")}function Qd(t,e){return t+bf(e)}function nl(t,e){return t.startsWith(e)&&(t.length===e.length||t[e.length]==="/")}function to(t,e,n){let r=t;for(let o=0;o<e.length;o++){Fj(e[o]);let i=e[o];if(n&&n.before){const l=n.before(r,i);if(l!==void 0){if(l.document!==void 0&&(r=l.document),l.json!==void 0)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"');l.operation!==void 0&&(i=l.operation)}}const a=r,s=yo(r,i.path);if(i.op==="add")r=Ij(r,s,i.value);else if(i.op==="remove")r=Aj(r,s);else if(i.op==="replace")r=Nj(r,s,i.value);else if(i.op==="copy")r=zj(r,s,mu(i.from));else if(i.op==="move")r=qj(r,s,mu(i.from));else if(i.op==="test")Lj(r,s,i.value);else throw new Error("Unknown JSONPatch operation "+JSON.stringify(i));if(n&&n.after){const l=n.after(r,i,a);l!==void 0&&(r=l)}}return r}function Nj(t,e,n){return Yr(t,e,n)}function Aj(t,e){return gf(t,e)}function Ij(t,e,n){return Os(t,e)?yf(t,e,n):Yr(t,e,n)}function zj(t,e,n){const r=We(t,n);if(Os(t,e))return yf(t,e,r);{const o=We(t,n);return Yr(t,e,o)}}function qj(t,e,n){const r=We(t,n),o=gf(t,n);return Os(o,e)?yf(o,e,r):Yr(o,e,r)}function Lj(t,e,n){if(n===void 0)throw new Error(`Test failed: no value provided (path: "${Be(e)}")`);if(!Lr(t,e))throw new Error(`Test failed: path not found (path: "${Be(e)}")`);const r=We(t,e);if(!Oj(r,n))throw new Error(`Test failed, value differs (path: "${Be(e)}")`)}function Os(t,e){if(e.length===0)return!1;const n=We(t,f1(e));return Array.isArray(n)}function Dj(t,e){if(Pj(e)!=="-")return e;const n=f1(e),r=We(t,n);return n.concat(r.length)}function Fj(t){if(!["add","remove","replace","copy","move","test"].includes(t.op))throw new Error("Unknown JSONPatch op "+JSON.stringify(t.op));if(typeof t.path!="string")throw new Error('Required property "path" missing or not a string in operation '+JSON.stringify(t));if((t.op==="copy"||t.op==="move")&&typeof t.from!="string")throw new Error('Required property "from" missing or not a string in operation '+JSON.stringify(t))}function yo(t,e){return Dj(t,ao(e))}function mu(t){return ao(t)}function v1(t,e,n){let r=[];return to(t,e,{before:(i,a)=>{let s;const l=yo(i,a.path);if(a.op==="add")s=g1(i,l);else if(a.op==="remove")s=h1(i,l);else if(a.op==="replace")s=m1(i,l);else if(a.op==="copy")s=Bj(i,l);else if(a.op==="move")s=Uj(i,l,mu(a.from));else if(a.op==="test")s=[];else throw new Error("Unknown JSONPatch operation "+JSON.stringify(a));let c;if(n&&n.before){const u=n.before(i,a,s);if(u&&u.revertOperations&&(s=u.revertOperations),u&&u.document&&(c=u.document),u&&u.json)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"')}if(r=s.concat(r),c!==void 0)return{document:c}}}),r}function m1(t,e){return[{op:"replace",path:Be(e),value:We(t,e)}]}function h1(t,e){return[{op:"add",path:Be(e),value:We(t,e)}]}function g1(t,e){return Os(t,e)||!Lr(t,e)?[{op:"remove",path:Be(e)}]:m1(t,e)}function Bj(t,e){return g1(t,e)}function Uj(t,e,n){if(e.length<n.length&&Tj(n,e))return[{op:"replace",path:Be(e),value:t}];const r={op:"move",from:Be(e),path:Be(n)};return!Os(t,e)&&Lr(t,e)?[r,...h1(t,e)]:[r]}var _c={},Yd={b:"\b",f:"\f",n:`
|
|
2
2
|
`,r:"\r",t:" ",'"':'"',"/":"/","\\":"\\"},Vj=97;_c.parse=function(t,e,n){var r={},o=0,i=0,a=0,s=n&&n.bigint&&typeof BigInt<"u";return{data:l("",!0),pointers:r};function l(W,U){c();var te;b(W,"value");var F=m();switch(F){case"t":v("rue"),te=!0;break;case"f":v("alse"),te=!1;break;case"n":v("ull"),te=null;break;case'"':te=u();break;case"[":te=d(W);break;case"{":te=p(W);break;default:g(),"-0123456789".indexOf(F)>=0?te=f():R()}return b(W,"valueEnd"),c(),U&&a<t.length&&R(),te}function c(){e:for(;a<t.length;){switch(t[a]){case" ":i++;break;case" ":i+=4;break;case"\r":i=0;break;case`
|
|
3
3
|
`:i=0,o++;break;default:break e}a++}}function u(){for(var W="",U;U=m(),U!='"';)U=="\\"?(U=m(),U in Yd?W+=Yd[U]:U=="u"?W+=h():D()):W+=U;return W}function f(){var W="",U=!0;t[a]=="-"&&(W+=m()),W+=t[a]=="0"?m():y(),t[a]=="."&&(W+=m()+y(),U=!1),(t[a]=="e"||t[a]=="E")&&(W+=m(),(t[a]=="+"||t[a]=="-")&&(W+=m()),W+=y(),U=!1);var te=+W;return s&&U&&(te>Number.MAX_SAFE_INTEGER||te<Number.MIN_SAFE_INTEGER)?BigInt(W):te}function d(W){c();var U=[],te=0;if(m()=="]")return U;for(g();;){var F=W+"/"+te;U.push(l(F)),c();var J=m();if(J=="]")break;J!=","&&D(),c(),te++}return U}function p(W){c();var U={};if(m()=="}")return U;for(g();;){var te=w();m()!='"'&&D();var F=u(),J=W+"/"+hu(F);S(J,"key",te),b(J,"keyEnd"),c(),m()!=":"&&D(),c(),U[F]=l(J),c();var H=m();if(H=="}")break;H!=","&&D(),c()}return U}function v(W){for(var U=0;U<W.length;U++)m()!==W[U]&&D()}function m(){Z();var W=t[a];return a++,i++,W}function g(){a--,i--}function h(){for(var W=4,U=0;W--;){U<<=4;var te=m().toLowerCase();te>="a"&&te<="f"?U+=te.charCodeAt()-Vj+10:te>="0"&&te<="9"?U+=+te:D()}return String.fromCharCode(U)}function y(){for(var W="";t[a]>="0"&&t[a]<="9";)W+=m();if(W.length)return W;Z(),R()}function b(W,U){S(W,U,w())}function S(W,U,te){r[W]=r[W]||{},r[W][U]=te}function w(){return{line:o,column:i,pos:a}}function R(){throw new SyntaxError("Unexpected token "+t[a]+" in JSON at position "+a)}function D(){g(),R()}function Z(){if(a>=t.length)throw new SyntaxError("Unexpected end of JSON input")}};_c.stringify=function(t,e,n){if(!Js(t))return;var r=0,o,i,a=typeof n=="object"?n.space:n;switch(typeof a){case"number":var s=a>10?10:a<0?0:Math.floor(a);a=s&&S(s," "),o=s,i=s;break;case"string":a=a.slice(0,10),o=0,i=0;for(var l=0;l<a.length;l++){var c=a[l];switch(c){case" ":i++;break;case" ":i+=4;break;case"\r":i=0;break;case`
|
|
4
4
|
`:i=0,r++;break;default:throw new Error("whitespace characters not allowed in JSON")}o++}break;default:a=void 0}var u="",f={},d=0,p=0,v=0,m=n&&n.es6&&typeof Map=="function";return g(t,0,""),{json:u,pointers:f};function g(w,R,D){switch(b(D,"value"),typeof w){case"number":case"bigint":case"boolean":h(""+w);break;case"string":h(Ks(w));break;case"object":w===null?h("null"):typeof w.toJSON=="function"?h(Ks(w.toJSON())):Array.isArray(w)?Z():m?w.constructor.BYTES_PER_ELEMENT?Z():w instanceof Map?U():w instanceof Set?U(!0):W():W()}b(D,"valueEnd");function Z(){if(w.length){h("[");for(var te=R+1,F=0;F<w.length;F++){F&&h(","),y(te);var J=Js(w[F])?w[F]:null,H=D+"/"+F;g(J,te,H)}y(R),h("]")}else h("[]")}function W(){var te=Object.keys(w);if(te.length){h("{");for(var F=R+1,J=0;J<te.length;J++){var H=te[J],X=w[H];if(Js(X)){J&&h(",");var K=D+"/"+hu(H);y(F),b(K,"key"),h(Ks(H)),b(K,"keyEnd"),h(":"),a&&h(" "),g(X,F,K)}}y(R),h("}")}else h("{}")}function U(te){if(w.size){h("{");for(var F=R+1,J=!0,H=w.entries(),X=H.next();!X.done;){var K=X.value,Q=K[0],M=te?!0:K[1];if(Js(M)){J||h(","),J=!1;var A=D+"/"+hu(Q);y(F),b(A,"key"),h(Ks(Q)),b(A,"keyEnd"),h(":"),a&&h(" "),g(M,F,A)}X=H.next()}y(R),h("}")}else h("{}")}}function h(w){p+=w.length,v+=w.length,u+=w}function y(w){if(a){for(u+=`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as h,b8 as g,e as _,j as e,N as F,t as W,w as z,dn as D,B as j,dt as J,ag as ce,d4 as de,aj as ue,C,au as he,ak as pe,at as q,cD as B,ba as xe,e9 as me,cI as je,i4 as ge,L as X,eo as fe,af as v,fH as L,r as u,ep as S,aq as ye,x as be,y as Ce,ae as V,i1 as Te,ai as R,dW as ke,eh as Ae,a7 as A,a8 as ve,bd as Z,b0 as we,aN as ee,h as Ee,o as Ie,aS as Ne,i as Se,av as te,cp as Re,i5 as b,dA as De,h7 as Q,dy as Le,dz as Pe,T as P,dQ as _e,F as Fe,eK as Be,dN as Ue,eL as Oe,h2 as Me,bj as He,b5 as se,b7 as ne,b6 as $e,b1 as Ke,dJ as Ge}from"./index-C5Z6aehP.js";import{u as We}from"./useApiTokens-DfEYjYPV.js";const ze=h("div")(({theme:t})=>({display:"grid",gridTemplateColumns:"auto auto 1fr",gridAutoRows:"min-content",alignItems:"center",gap:t.spacing(1),marginTop:t.spacing(1.5)})),m=j,qe=()=>{const{uiConfig:t}=g(),{setToastData:s}=_(),n=a=>()=>{J(a),s({type:"success",title:"Copied to clipboard"})},o=`${t.unleashUrl}/api/`,r=`${t.unleashUrl}/api/frontend/`;return e.jsxs(F,{severity:"info",children:[e.jsxs("p",{children:["Read the"," ",e.jsx("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"SDK overview"})," ","to connect Unleash to your application. Please note it can take up to ",e.jsx("strong",{children:"1 minute"})," before a new API key is activated."]}),e.jsxs(ze,{children:[e.jsx(m,{children:e.jsx("strong",{children:"CLIENT API URL: "})}),e.jsx(m,{children:e.jsx("pre",{style:{display:"inline"},children:o})}),e.jsx(m,{children:e.jsx(W,{title:"Copy URL",arrow:!0,children:e.jsx(z,{onClick:n(o),size:"small",children:e.jsx(D,{})})})}),e.jsx(m,{children:e.jsx("strong",{children:"FRONTEND API URL: "})}),e.jsx(m,{children:e.jsx("pre",{style:{display:"inline"},children:r})}),e.jsx(m,{children:e.jsx(W,{title:"Copy URL",arrow:!0,children:e.jsx(z,{onClick:n(r),size:"small",children:e.jsx(D,{})})})})]})]})},Ve=["Icon","createdAt","seenAt"],Qe=["Icon","project","seenAt"],At=({compact:t=!1,setHiddenColumns:s,columns:n,loading:o,rows:r,headerGroups:a,globalFilter:i,prepareRow:p})=>{const x=ce(de.breakpoints.down("xl"));return ue([{condition:x,columns:Ve},{condition:t,columns:Qe}],s,n),e.jsxs(e.Fragment,{children:[e.jsx(C,{condition:r.length>0,show:e.jsx(j,{sx:{mb:4},children:e.jsx(qe,{})})}),e.jsx(j,{sx:{overflowX:"auto"},children:e.jsx(he,{value:i,children:e.jsx(pe,{rows:r,headerGroups:a,prepareRow:p})})}),e.jsx(C,{condition:r.length===0&&!o,show:e.jsx(C,{condition:(i==null?void 0:i.length)>0,show:e.jsxs(q,{children:["No tokens found matching “",i,"”"]}),elseShow:e.jsx(q,{children:e.jsxs("span",{children:["No tokens available. Read ",e.jsx(B,{href:"https://docs.getunleash.io/how-to/api",target:"_blank",rel:"noreferrer",children:"API How-to guides"})," "," to learn more."]})})})})]})},Ye=(t,s)=>{const n=s>=t;return{limitReached:n,limitMessage:n?`You have reached the limit of ${t} API tokens`:void 0}},vt=({path:t,permission:s,project:n})=>{const o=xe(),{tokens:r,loading:a}=We(),{uiConfig:i}=g(),{limitReached:p,limitMessage:x}=Ye(i.resourceLimits.apiTokens,r.length);return e.jsx(me,{Icon:je,onClick:()=>o(t),"data-testid":ge,permission:s,projectId:n,maxWidth:"700px",disabled:a||p,tooltipProps:{title:x},children:"New API token"})},Je=h(X)(({theme:t})=>({textDecoration:"none",color:t.palette.links,"&:hover, &:focus":{textDecoration:"underline"}})),Xe=h("div")({display:"flex",alignItems:"center"}),Ze=({projects:t,project:s})=>{const{searchQuery:n}=fe(),o=t&&Array.isArray(t)&&t.length>1?t:[];if(o.length>0)return e.jsx(v,{children:e.jsx(L,{title:o.map((r,a)=>e.jsxs(u.Fragment,{children:[a>0&&", ",!r||r==="*"?e.jsx(S,{search:n,children:"*"}):e.jsx(Je,{to:`/projects/${r}`,children:e.jsx(S,{search:n,children:r})})]},r)),placement:"bottom-start",arrow:!0,tabIndex:0,children:e.jsxs("span",{children:[`${o.length}`," projects"]})})});if(o.length===1&&o[0]!=="*"||s&&s!=="*"){const r=s||o[0];return e.jsx(ye,{to:`/projects/${r}`,title:r})}return e.jsx(v,{children:e.jsx(L,{title:"ALL current and future projects.",placement:"bottom",arrow:!0,children:e.jsx(Xe,{children:e.jsx(S,{search:n,children:"*"})})})})};var U={},et=Ce;Object.defineProperty(U,"__esModule",{value:!0});var oe=U.default=void 0,tt=et(be()),st=e,nt=(0,tt.default)((0,st.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"}),"Key");oe=U.default=nt;const ot=({secret:t,project:s,projects:n})=>{const o=t!=null&&t.includes(":")?"v2":"v1",r=t==null?void 0:t.startsWith("*:"),a=n&&(n==null?void 0:n.length)>1||(n==null?void 0:n.length)===1&&n[0]!=="*"||s&&s!=="*";return o==="v2"&&!r&&!a},rt=({...t})=>ot(t)?e.jsx(V,{icon:e.jsx(L,{title:e.jsxs("p",{children:["This is an orphaned token. All of its original projects have been deleted and it now has access to all current and future projects. You should stop using this token and delete it. Read more in"," ",e.jsx(B,{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/Unleash/unleash/releases/tag/v6.1.0",children:"release notes"}),"."]}),placement:"bottom-start",arrow:!0,children:e.jsx(Te,{"aria-label":"Orphaned token",color:"warning","data-testid":"orphaned-token-icon"})})}):e.jsx(V,{icon:e.jsx(oe,{color:"disabled"})}),wt=(t,s)=>{const n=u.useMemo(()=>({sortBy:[{id:"createdAt",desc:!0}]}),[]),o=u.useMemo(()=>[{id:"Icon",Cell:c=>e.jsx(rt,{secret:c.row.original.secret,project:c.row.original.project,projects:c.row.original.projects}),disableSortBy:!0,disableGlobalFilter:!0,width:50},{Header:"Username",accessor:"username",Cell:R,minWidth:35},{Header:"Type",accessor:"type",Cell:({value:c})=>e.jsx(R,{value:Y[c.toLowerCase()].label,subtitle:Y[c.toLowerCase()].title,subtitleTooltip:!0}),width:180},{Header:"Project",accessor:"project",Cell:c=>e.jsx(Ze,{project:c.row.original.project,projects:c.row.original.projects}),width:160},{Header:"Environment",accessor:"environment",Cell:R,width:120},{Header:"Created",accessor:"createdAt",Cell:ke,width:150,disableGlobalFilter:!0},{Header:"Last seen",accessor:"seenAt",Cell:Ae,width:140,disableGlobalFilter:!0},{Header:"Actions",width:120,id:"Actions",align:"center",disableSortBy:!0,disableGlobalFilter:!0,Cell:s}],[]),{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:p,prepareRow:x,state:f,setGlobalFilter:w,setHiddenColumns:E}=A.useTable({columns:o,data:t,initialState:n,sortTypes:ve,autoResetHiddenColumns:!1,disableSortRemove:!0},A.useGlobalFilter,A.useSortBy,A.useFlexLayout);return{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:p,prepareRow:x,state:f,setGlobalFilter:w,setHiddenColumns:E,columns:o}},Y={client:{label:"CLIENT",title:"Connect server-side SDK or Unleash Proxy/Edge"},frontend:{label:"FRONTEND",title:"Connect web and mobile SDK"},admin:{label:"ADMIN",title:"Full access for managing Unleash"}},Et=({token:t,project:s,permission:n,track:o})=>{const{setToastData:r}=_(),a=i=>{J(i)&&(r({type:"success",title:"Token copied to clipboard"}),o&&typeof o=="function"&&o())};return e.jsx(Z,{permission:n,projectId:s,tooltipProps:{title:"Copy token",arrow:!0},onClick:()=>a(t.secret),size:"large",children:e.jsx(D,{})})},at=h("ul")({marginBottom:0}),It=({token:t,permission:s,onRemove:n,project:o})=>{const[r,a]=u.useState(!1),{setToastData:i,setToastApiError:p}=_(),x=async()=>{try{await n(),a(!1),i({type:"success",title:"API token removed"})}catch(f){p(Ee(f))}};return e.jsxs(e.Fragment,{children:[e.jsx(Z,{permission:s,projectId:o,tooltipProps:{title:"Delete token",arrow:!0},onClick:()=>a(!0),size:"large",children:e.jsx(we,{})}),e.jsx(ee,{open:r,onClick:x,onClose:()=>a(!1),title:"Confirm deletion",children:e.jsxs("div",{children:["Are you sure you want to delete the following API token?",e.jsx("br",{}),e.jsxs(at,{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"username"}),":"," ",e.jsx("code",{children:t.username})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"type"}),": ",e.jsx("code",{children:t.type})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"environment"}),":"," ",e.jsx("code",{children:t.environment})]})]})]})})]})},it=h("div")(()=>({maxWidth:"400px"})),lt=h("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),ct=h(Ie)(({theme:t})=>({width:"100%",marginBottom:t.spacing(2)})),dt=h(Ne)(({theme:t})=>({marginBottom:t.spacing(2),minWidth:"400px",[t.breakpoints.down("sm")]:{minWidth:"379px"}})),re=h("p")(({theme:t})=>({marginBottom:t.spacing(1)})),ut=h("label")(({theme:t})=>({marginBottom:t.spacing(1)})),ht=h(Se)(({theme:t})=>({marginLeft:t.spacing(3)})),pt=h(j)({marginTop:"auto",display:"flex",justifyContent:"flex-end"}),Nt=({children:t,actions:s,handleSubmit:n,handleCancel:o})=>{var i;const{uiConfig:r}=g(),a=!!((i=r==null?void 0:r.flags)!=null&&i.UNLEASH_CLOUD);return e.jsxs(lt,{onSubmit:n,children:[e.jsx(C,{condition:a,show:e.jsxs(F,{severity:"info",sx:{mb:4},children:["Please be aware of our"," ",e.jsx(B,{href:"https://www.getunleash.io/fair-use-policy",children:"fair use policy"}),"."]})}),t,e.jsxs(pt,{children:[s,e.jsx(ht,{onClick:o,children:"Cancel"})]})]})};var d=(t=>(t.ADMIN="ADMIN",t.CLIENT="CLIENT",t.FRONTEND="FRONTEND",t))(d||{});const St=t=>{var $,K;const{environments:s}=te(),{uiConfig:n}=g(),o=Re("adminTokenKillSwitch"),r=($=s==null?void 0:s.find(l=>l.enabled))==null?void 0:$.name,a=b(De),i=b(Q,t),p=[{key:d.CLIENT,label:`Server-side SDK (${d.CLIENT})`,title:"Connect server-side SDK or Unleash Proxy/Edge",enabled:a||i}],x=b(Le),f=b(Pe),w=b(Q,t);!t&&!o&&p.push({key:d.ADMIN,label:d.ADMIN,title:"Full access for managing Unleash",enabled:x}),n.flags.embedProxyFrontend&&p.splice(1,0,{key:d.FRONTEND,label:`Client-side SDK (${d.FRONTEND})`,title:"Connect web and mobile SDK directly to Unleash",enabled:f||w});const E=(K=p.find(l=>l.enabled))==null?void 0:K.key,[c,ae]=u.useState(""),[T,O]=u.useState(E||d.CLIENT),[y,I]=u.useState([t||"*"]),[ie,le]=u.useState(y),[M,k]=u.useState(),[H,N]=u.useState({});return u.useEffect(()=>{k(T==="ADMIN"?"*":r)},[T,r]),{username:c,type:T,apiTokenTypes:p,projects:y,environment:M,setUsername:ae,setTokenType:l=>{l==="ADMIN"?(O(d.ADMIN),le(y),I(["*"]),k("*")):(O(l),I(ie),k(r))},setProjects:I,setEnvironment:k,getApiTokenPayload:()=>({username:c,type:T,environment:M,projects:y}),isValid:()=>{const l={};return c||(l.username="Username is required"),y.length===0&&(l.projects="At least one project is required"),N(l),Object.keys(l).length===0},clearErrors:l=>{if(l){const G={...H};delete G[l],N(G)}else N({})},errors:H}},Rt=({open:t,setOpen:s,closeConfirm:n,token:o,type:r})=>e.jsxs(ee,{open:t,setOpen:s,onClick:n,primaryButtonText:"Close",title:"New token created",children:[e.jsx(P,{variant:"body1",children:"Your new token has been created successfully."}),e.jsx(_e,{token:o}),e.jsx(C,{condition:r===d.FRONTEND,show:e.jsxs(F,{sx:{mt:2},severity:"info",children:["By default, all ",d.FRONTEND," tokens may be used from any CORS origin. If you'd like to configure a strict set of origins, please use the"," ",e.jsx(X,{to:"/admin/cors",target:"_blank",rel:"noreferrer",children:"CORS origins configuration page"}),"."]})})]}),Dt=({username:t,setUsername:s,errors:n,clearErrors:o})=>e.jsxs(e.Fragment,{children:[e.jsx(re,{children:"What would you like to call this token?"}),e.jsx(ct,{value:t,name:"username",onChange:r=>s(r.target.value),label:"Token name",error:n.username!==void 0,errorText:n.username,onFocus:()=>o("username"),autoFocus:!0})]}),Lt=({type:t,setType:s,apiTokenTypes:n})=>e.jsx(it,{children:e.jsxs(Fe,{sx:{mb:2,width:"100%"},children:[e.jsx(ut,{id:"token-type",children:"What do you want to connect?"}),e.jsx(Be,{"aria-labelledby":"token-type",defaultValue:"CLIENT",name:"radio-buttons-group",value:t,onChange:(o,r)=>s(r),children:n.map(({key:o,label:r,title:a,enabled:i})=>e.jsx(Ue,{value:o,sx:{mb:1},disabled:!i,control:e.jsx(Oe,{sx:{ml:.75,alignSelf:"flex-start"}}),label:e.jsx(j,{children:e.jsxs(j,{children:[e.jsx(P,{children:r}),e.jsx(P,{variant:"body2",color:"text.secondary",children:a})]})})},o))})]})}),Pt=({type:t,environment:s,setEnvironment:n})=>{const{environments:o}=te(),r=t===d.ADMIN?[{key:"*",label:"ALL"}]:o.map(a=>({key:a.name,label:`${a.name.concat(a.enabled?"":" - deprecated")}`,title:a.name,disabled:!1}));return e.jsxs(e.Fragment,{children:[e.jsx(re,{children:"Which environment should the token have access to?"}),e.jsx(dt,{disabled:t===d.ADMIN,options:r,value:s,onChange:n,label:"Environment",id:"api_key_environment",name:"environment",IconComponent:Me,fullWidth:!0})]})},xt=t=>t.map(s=>({...s.user,joinedAt:new Date(s.joinedAt),createdBy:s.createdBy})),_t=t=>{const{data:s,error:n,mutate:o}=He(se(`api/admin/groups/${t}`),mt);return u.useMemo(()=>({group:s&&{...s,users:xt((s==null?void 0:s.users)??[])},loading:!n&&!s,refetchGroup:()=>o(),error:n}),[s,n,o])},mt=t=>fetch(t).then(ne("Group")).then(s=>s.json()),Ft=()=>{const{isEnterprise:t}=g(),{data:s,error:n,mutate:o}=$e(t(),{serviceAccounts:[],rootRoles:[]},se("api/admin/service-account"),jt);return u.useMemo(()=>({serviceAccounts:(s==null?void 0:s.serviceAccounts)??[],roles:(s==null?void 0:s.rootRoles)??[],loading:!n&&!s,refetch:()=>o(),error:n}),[s,n,o])},jt=t=>fetch(t).then(ne("Service Accounts")).then(s=>s.json()),gt=h("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(.5),"& > *:not(:last-child)":{borderBottom:`1px solid ${t.palette.divider}`,paddingBottom:t.spacing(1)}})),Bt=({role:t,roles:s,value:n})=>{const{isEnterprise:o}=g();if(o()){const r=s||[t];return e.jsx(v,{children:e.jsx(Ke,{tooltip:e.jsx(gt,{children:r.map(a=>e.jsx(Ge,{roleId:a,tooltip:!0},a))}),children:n})})}return e.jsx(v,{children:n})};export{At as A,vt as C,Pt as E,It as R,re as S,d as T,Et as a,St as b,Nt as c,Dt as d,Lt as e,Rt as f,Ft as g,_t as h,Bt as i,oe as j,xt as m,wt as u};
|
|
1
|
+
import{s as h,b8 as g,e as _,j as e,N as F,t as W,w as z,dn as D,B as j,dt as J,ag as ce,d4 as de,aj as ue,C,au as he,ak as pe,at as q,cD as B,ba as xe,e9 as me,cI as je,i6 as ge,L as X,eo as fe,af as v,fH as L,r as u,ep as S,aq as ye,x as be,y as Ce,ae as V,i3 as Te,ai as R,dW as ke,eh as Ae,a7 as A,a8 as ve,bd as Z,b0 as we,aN as ee,h as Ee,o as Ie,aS as Ne,i as Se,av as te,cp as Re,i7 as b,dA as De,h7 as Q,dy as Le,dz as Pe,T as P,dQ as _e,F as Fe,eK as Be,dN as Ue,eL as Oe,h2 as Me,bj as He,b5 as se,b7 as ne,b6 as $e,b1 as Ke,dJ as Ge}from"./index-Cx91uh9W.js";import{u as We}from"./useApiTokens-5JgqgHim.js";const ze=h("div")(({theme:t})=>({display:"grid",gridTemplateColumns:"auto auto 1fr",gridAutoRows:"min-content",alignItems:"center",gap:t.spacing(1),marginTop:t.spacing(1.5)})),m=j,qe=()=>{const{uiConfig:t}=g(),{setToastData:s}=_(),n=a=>()=>{J(a),s({type:"success",title:"Copied to clipboard"})},o=`${t.unleashUrl}/api/`,r=`${t.unleashUrl}/api/frontend/`;return e.jsxs(F,{severity:"info",children:[e.jsxs("p",{children:["Read the"," ",e.jsx("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"SDK overview"})," ","to connect Unleash to your application. Please note it can take up to ",e.jsx("strong",{children:"1 minute"})," before a new API key is activated."]}),e.jsxs(ze,{children:[e.jsx(m,{children:e.jsx("strong",{children:"CLIENT API URL: "})}),e.jsx(m,{children:e.jsx("pre",{style:{display:"inline"},children:o})}),e.jsx(m,{children:e.jsx(W,{title:"Copy URL",arrow:!0,children:e.jsx(z,{onClick:n(o),size:"small",children:e.jsx(D,{})})})}),e.jsx(m,{children:e.jsx("strong",{children:"FRONTEND API URL: "})}),e.jsx(m,{children:e.jsx("pre",{style:{display:"inline"},children:r})}),e.jsx(m,{children:e.jsx(W,{title:"Copy URL",arrow:!0,children:e.jsx(z,{onClick:n(r),size:"small",children:e.jsx(D,{})})})})]})]})},Ve=["Icon","createdAt","seenAt"],Qe=["Icon","project","seenAt"],At=({compact:t=!1,setHiddenColumns:s,columns:n,loading:o,rows:r,headerGroups:a,globalFilter:i,prepareRow:p})=>{const x=ce(de.breakpoints.down("xl"));return ue([{condition:x,columns:Ve},{condition:t,columns:Qe}],s,n),e.jsxs(e.Fragment,{children:[e.jsx(C,{condition:r.length>0,show:e.jsx(j,{sx:{mb:4},children:e.jsx(qe,{})})}),e.jsx(j,{sx:{overflowX:"auto"},children:e.jsx(he,{value:i,children:e.jsx(pe,{rows:r,headerGroups:a,prepareRow:p})})}),e.jsx(C,{condition:r.length===0&&!o,show:e.jsx(C,{condition:(i==null?void 0:i.length)>0,show:e.jsxs(q,{children:["No tokens found matching “",i,"”"]}),elseShow:e.jsx(q,{children:e.jsxs("span",{children:["No tokens available. Read ",e.jsx(B,{href:"https://docs.getunleash.io/how-to/api",target:"_blank",rel:"noreferrer",children:"API How-to guides"})," "," to learn more."]})})})})]})},Ye=(t,s)=>{const n=s>=t;return{limitReached:n,limitMessage:n?`You have reached the limit of ${t} API tokens`:void 0}},vt=({path:t,permission:s,project:n})=>{const o=xe(),{tokens:r,loading:a}=We(),{uiConfig:i}=g(),{limitReached:p,limitMessage:x}=Ye(i.resourceLimits.apiTokens,r.length);return e.jsx(me,{Icon:je,onClick:()=>o(t),"data-testid":ge,permission:s,projectId:n,maxWidth:"700px",disabled:a||p,tooltipProps:{title:x},children:"New API token"})},Je=h(X)(({theme:t})=>({textDecoration:"none",color:t.palette.links,"&:hover, &:focus":{textDecoration:"underline"}})),Xe=h("div")({display:"flex",alignItems:"center"}),Ze=({projects:t,project:s})=>{const{searchQuery:n}=fe(),o=t&&Array.isArray(t)&&t.length>1?t:[];if(o.length>0)return e.jsx(v,{children:e.jsx(L,{title:o.map((r,a)=>e.jsxs(u.Fragment,{children:[a>0&&", ",!r||r==="*"?e.jsx(S,{search:n,children:"*"}):e.jsx(Je,{to:`/projects/${r}`,children:e.jsx(S,{search:n,children:r})})]},r)),placement:"bottom-start",arrow:!0,tabIndex:0,children:e.jsxs("span",{children:[`${o.length}`," projects"]})})});if(o.length===1&&o[0]!=="*"||s&&s!=="*"){const r=s||o[0];return e.jsx(ye,{to:`/projects/${r}`,title:r})}return e.jsx(v,{children:e.jsx(L,{title:"ALL current and future projects.",placement:"bottom",arrow:!0,children:e.jsx(Xe,{children:e.jsx(S,{search:n,children:"*"})})})})};var U={},et=Ce;Object.defineProperty(U,"__esModule",{value:!0});var oe=U.default=void 0,tt=et(be()),st=e,nt=(0,tt.default)((0,st.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"}),"Key");oe=U.default=nt;const ot=({secret:t,project:s,projects:n})=>{const o=t!=null&&t.includes(":")?"v2":"v1",r=t==null?void 0:t.startsWith("*:"),a=n&&(n==null?void 0:n.length)>1||(n==null?void 0:n.length)===1&&n[0]!=="*"||s&&s!=="*";return o==="v2"&&!r&&!a},rt=({...t})=>ot(t)?e.jsx(V,{icon:e.jsx(L,{title:e.jsxs("p",{children:["This is an orphaned token. All of its original projects have been deleted and it now has access to all current and future projects. You should stop using this token and delete it. Read more in"," ",e.jsx(B,{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/Unleash/unleash/releases/tag/v6.1.0",children:"release notes"}),"."]}),placement:"bottom-start",arrow:!0,children:e.jsx(Te,{"aria-label":"Orphaned token",color:"warning","data-testid":"orphaned-token-icon"})})}):e.jsx(V,{icon:e.jsx(oe,{color:"disabled"})}),wt=(t,s)=>{const n=u.useMemo(()=>({sortBy:[{id:"createdAt",desc:!0}]}),[]),o=u.useMemo(()=>[{id:"Icon",Cell:c=>e.jsx(rt,{secret:c.row.original.secret,project:c.row.original.project,projects:c.row.original.projects}),disableSortBy:!0,disableGlobalFilter:!0,width:50},{Header:"Username",accessor:"username",Cell:R,minWidth:35},{Header:"Type",accessor:"type",Cell:({value:c})=>e.jsx(R,{value:Y[c.toLowerCase()].label,subtitle:Y[c.toLowerCase()].title,subtitleTooltip:!0}),width:180},{Header:"Project",accessor:"project",Cell:c=>e.jsx(Ze,{project:c.row.original.project,projects:c.row.original.projects}),width:160},{Header:"Environment",accessor:"environment",Cell:R,width:120},{Header:"Created",accessor:"createdAt",Cell:ke,width:150,disableGlobalFilter:!0},{Header:"Last seen",accessor:"seenAt",Cell:Ae,width:140,disableGlobalFilter:!0},{Header:"Actions",width:120,id:"Actions",align:"center",disableSortBy:!0,disableGlobalFilter:!0,Cell:s}],[]),{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:p,prepareRow:x,state:f,setGlobalFilter:w,setHiddenColumns:E}=A.useTable({columns:o,data:t,initialState:n,sortTypes:ve,autoResetHiddenColumns:!1,disableSortRemove:!0},A.useGlobalFilter,A.useSortBy,A.useFlexLayout);return{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:p,prepareRow:x,state:f,setGlobalFilter:w,setHiddenColumns:E,columns:o}},Y={client:{label:"CLIENT",title:"Connect server-side SDK or Unleash Proxy/Edge"},frontend:{label:"FRONTEND",title:"Connect web and mobile SDK"},admin:{label:"ADMIN",title:"Full access for managing Unleash"}},Et=({token:t,project:s,permission:n,track:o})=>{const{setToastData:r}=_(),a=i=>{J(i)&&(r({type:"success",title:"Token copied to clipboard"}),o&&typeof o=="function"&&o())};return e.jsx(Z,{permission:n,projectId:s,tooltipProps:{title:"Copy token",arrow:!0},onClick:()=>a(t.secret),size:"large",children:e.jsx(D,{})})},at=h("ul")({marginBottom:0}),It=({token:t,permission:s,onRemove:n,project:o})=>{const[r,a]=u.useState(!1),{setToastData:i,setToastApiError:p}=_(),x=async()=>{try{await n(),a(!1),i({type:"success",title:"API token removed"})}catch(f){p(Ee(f))}};return e.jsxs(e.Fragment,{children:[e.jsx(Z,{permission:s,projectId:o,tooltipProps:{title:"Delete token",arrow:!0},onClick:()=>a(!0),size:"large",children:e.jsx(we,{})}),e.jsx(ee,{open:r,onClick:x,onClose:()=>a(!1),title:"Confirm deletion",children:e.jsxs("div",{children:["Are you sure you want to delete the following API token?",e.jsx("br",{}),e.jsxs(at,{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"username"}),":"," ",e.jsx("code",{children:t.username})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"type"}),": ",e.jsx("code",{children:t.type})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"environment"}),":"," ",e.jsx("code",{children:t.environment})]})]})]})})]})},it=h("div")(()=>({maxWidth:"400px"})),lt=h("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),ct=h(Ie)(({theme:t})=>({width:"100%",marginBottom:t.spacing(2)})),dt=h(Ne)(({theme:t})=>({marginBottom:t.spacing(2),minWidth:"400px",[t.breakpoints.down("sm")]:{minWidth:"379px"}})),re=h("p")(({theme:t})=>({marginBottom:t.spacing(1)})),ut=h("label")(({theme:t})=>({marginBottom:t.spacing(1)})),ht=h(Se)(({theme:t})=>({marginLeft:t.spacing(3)})),pt=h(j)({marginTop:"auto",display:"flex",justifyContent:"flex-end"}),Nt=({children:t,actions:s,handleSubmit:n,handleCancel:o})=>{var i;const{uiConfig:r}=g(),a=!!((i=r==null?void 0:r.flags)!=null&&i.UNLEASH_CLOUD);return e.jsxs(lt,{onSubmit:n,children:[e.jsx(C,{condition:a,show:e.jsxs(F,{severity:"info",sx:{mb:4},children:["Please be aware of our"," ",e.jsx(B,{href:"https://www.getunleash.io/fair-use-policy",children:"fair use policy"}),"."]})}),t,e.jsxs(pt,{children:[s,e.jsx(ht,{onClick:o,children:"Cancel"})]})]})};var d=(t=>(t.ADMIN="ADMIN",t.CLIENT="CLIENT",t.FRONTEND="FRONTEND",t))(d||{});const St=t=>{var $,K;const{environments:s}=te(),{uiConfig:n}=g(),o=Re("adminTokenKillSwitch"),r=($=s==null?void 0:s.find(l=>l.enabled))==null?void 0:$.name,a=b(De),i=b(Q,t),p=[{key:d.CLIENT,label:`Server-side SDK (${d.CLIENT})`,title:"Connect server-side SDK or Unleash Proxy/Edge",enabled:a||i}],x=b(Le),f=b(Pe),w=b(Q,t);!t&&!o&&p.push({key:d.ADMIN,label:d.ADMIN,title:"Full access for managing Unleash",enabled:x}),n.flags.embedProxyFrontend&&p.splice(1,0,{key:d.FRONTEND,label:`Client-side SDK (${d.FRONTEND})`,title:"Connect web and mobile SDK directly to Unleash",enabled:f||w});const E=(K=p.find(l=>l.enabled))==null?void 0:K.key,[c,ae]=u.useState(""),[T,O]=u.useState(E||d.CLIENT),[y,I]=u.useState([t||"*"]),[ie,le]=u.useState(y),[M,k]=u.useState(),[H,N]=u.useState({});return u.useEffect(()=>{k(T==="ADMIN"?"*":r)},[T,r]),{username:c,type:T,apiTokenTypes:p,projects:y,environment:M,setUsername:ae,setTokenType:l=>{l==="ADMIN"?(O(d.ADMIN),le(y),I(["*"]),k("*")):(O(l),I(ie),k(r))},setProjects:I,setEnvironment:k,getApiTokenPayload:()=>({username:c,type:T,environment:M,projects:y}),isValid:()=>{const l={};return c||(l.username="Username is required"),y.length===0&&(l.projects="At least one project is required"),N(l),Object.keys(l).length===0},clearErrors:l=>{if(l){const G={...H};delete G[l],N(G)}else N({})},errors:H}},Rt=({open:t,setOpen:s,closeConfirm:n,token:o,type:r})=>e.jsxs(ee,{open:t,setOpen:s,onClick:n,primaryButtonText:"Close",title:"New token created",children:[e.jsx(P,{variant:"body1",children:"Your new token has been created successfully."}),e.jsx(_e,{token:o}),e.jsx(C,{condition:r===d.FRONTEND,show:e.jsxs(F,{sx:{mt:2},severity:"info",children:["By default, all ",d.FRONTEND," tokens may be used from any CORS origin. If you'd like to configure a strict set of origins, please use the"," ",e.jsx(X,{to:"/admin/cors",target:"_blank",rel:"noreferrer",children:"CORS origins configuration page"}),"."]})})]}),Dt=({username:t,setUsername:s,errors:n,clearErrors:o})=>e.jsxs(e.Fragment,{children:[e.jsx(re,{children:"What would you like to call this token?"}),e.jsx(ct,{value:t,name:"username",onChange:r=>s(r.target.value),label:"Token name",error:n.username!==void 0,errorText:n.username,onFocus:()=>o("username"),autoFocus:!0})]}),Lt=({type:t,setType:s,apiTokenTypes:n})=>e.jsx(it,{children:e.jsxs(Fe,{sx:{mb:2,width:"100%"},children:[e.jsx(ut,{id:"token-type",children:"What do you want to connect?"}),e.jsx(Be,{"aria-labelledby":"token-type",defaultValue:"CLIENT",name:"radio-buttons-group",value:t,onChange:(o,r)=>s(r),children:n.map(({key:o,label:r,title:a,enabled:i})=>e.jsx(Ue,{value:o,sx:{mb:1},disabled:!i,control:e.jsx(Oe,{sx:{ml:.75,alignSelf:"flex-start"}}),label:e.jsx(j,{children:e.jsxs(j,{children:[e.jsx(P,{children:r}),e.jsx(P,{variant:"body2",color:"text.secondary",children:a})]})})},o))})]})}),Pt=({type:t,environment:s,setEnvironment:n})=>{const{environments:o}=te(),r=t===d.ADMIN?[{key:"*",label:"ALL"}]:o.map(a=>({key:a.name,label:`${a.name.concat(a.enabled?"":" - deprecated")}`,title:a.name,disabled:!1}));return e.jsxs(e.Fragment,{children:[e.jsx(re,{children:"Which environment should the token have access to?"}),e.jsx(dt,{disabled:t===d.ADMIN,options:r,value:s,onChange:n,label:"Environment",id:"api_key_environment",name:"environment",IconComponent:Me,fullWidth:!0})]})},xt=t=>t.map(s=>({...s.user,joinedAt:new Date(s.joinedAt),createdBy:s.createdBy})),_t=t=>{const{data:s,error:n,mutate:o}=He(se(`api/admin/groups/${t}`),mt);return u.useMemo(()=>({group:s&&{...s,users:xt((s==null?void 0:s.users)??[])},loading:!n&&!s,refetchGroup:()=>o(),error:n}),[s,n,o])},mt=t=>fetch(t).then(ne("Group")).then(s=>s.json()),Ft=()=>{const{isEnterprise:t}=g(),{data:s,error:n,mutate:o}=$e(t(),{serviceAccounts:[],rootRoles:[]},se("api/admin/service-account"),jt);return u.useMemo(()=>({serviceAccounts:(s==null?void 0:s.serviceAccounts)??[],roles:(s==null?void 0:s.rootRoles)??[],loading:!n&&!s,refetch:()=>o(),error:n}),[s,n,o])},jt=t=>fetch(t).then(ne("Service Accounts")).then(s=>s.json()),gt=h("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(.5),"& > *:not(:last-child)":{borderBottom:`1px solid ${t.palette.divider}`,paddingBottom:t.spacing(1)}})),Bt=({role:t,roles:s,value:n})=>{const{isEnterprise:o}=g();if(o()){const r=s||[t];return e.jsx(v,{children:e.jsx(Ke,{tooltip:e.jsx(gt,{children:r.map(a=>e.jsx(Ge,{roleId:a,tooltip:!0},a))}),children:n})})}return e.jsx(v,{children:n})};export{At as A,vt as C,Pt as E,It as R,re as S,d as T,Et as a,St as b,Nt as c,Dt as d,Lt as e,Rt as f,Ft as g,_t as h,Bt as i,oe as j,xt as m,wt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as d,w as j,B as a,cm as f,j as n,C as s,
|
|
1
|
+
import{s as d,w as j,B as a,cm as f,j as n,C as s,i5 as h,Y as S,bK as c,H as m,L as v}from"./index-Cx91uh9W.js";const k=d(j)({padding:0,cursor:"inherit",transition:"color 0.2s ease-in-out"}),y=d("div")(({theme:i})=>({fontSize:i.typography.fontSize,color:i.palette.text.secondary,position:"absolute",display:"none",right:"calc(100% + 6px)",top:i.spacing(2.5),[i.breakpoints.up("md")]:{display:"block"}})),B=d("div")(({theme:i})=>({fontSize:i.typography.fontSize,fontWeight:"normal",color:i.palette.text.secondary,display:"none",top:i.spacing(2.5),[i.breakpoints.up("md")]:{display:"block"}})),I=d("div")(({theme:i})=>({fontWeight:"normal",display:"none",[i.breakpoints.up("md")]:{display:"block"}})),w=d("div")({flexDirection:"column",justifyContent:"center",verticalAlign:"middle"}),C=d(a,{shouldForwardProp:i=>i!=="disabled"})(({theme:i,disabled:o})=>({borderRadius:i.shape.borderRadiusMedium,border:`1px solid ${i.palette.divider}`,"& + &":{marginTop:i.spacing(2)},background:o?i.palette.envAccordion.disabled:i.palette.background.paper})),L=d("div",{shouldForwardProp:i=>i!=="draggable"&&i!=="disabled"})(({theme:i,draggable:o,disabled:l})=>({padding:i.spacing(.5,2),display:"flex",gap:i.spacing(1),alignItems:"center",borderBottom:`1px solid ${i.palette.divider}`,fontWeight:i.typography.fontWeightMedium,paddingLeft:o?i.spacing(1):i.spacing(2),color:l?i.palette.text.secondary:i.palette.text.primary})),F=({strategy:i,onDragStart:o,onDragEnd:l,actions:p,children:x,orderNumber:t,style:b={},description:r})=>{const u=f(i.name),g="links"in i?({children:e})=>n.jsx(v,{to:i.links.edit,children:e}):({children:e})=>n.jsxs(n.Fragment,{children:[" ",e," "]});return n.jsxs(a,{sx:{position:"relative"},children:[n.jsx(s,{condition:t!==void 0,show:n.jsx(y,{children:t})}),n.jsxs(C,{disabled:(i==null?void 0:i.disabled)||!1,style:b,children:[n.jsxs(L,{draggable:!!o,disabled:!!(i!=null&&i.disabled),children:[n.jsx(s,{condition:!!o,show:()=>n.jsx(k,{draggable:!0,disableRipple:!0,size:"small",onDragStart:o,onDragEnd:l,sx:{cursor:"move"},children:n.jsx(h,{titleAccess:"Drag to reorder",cursor:"grab",sx:{color:"action.active"}})})}),n.jsx(u,{sx:{fill:e=>e.palette.action.disabled}}),n.jsxs(w,{children:[n.jsxs(g,{children:[n.jsx(S,{maxWidth:"400",maxLength:15,text:c(String(i.name))}),n.jsx(s,{condition:!!i.title,show:n.jsx(I,{children:c(String(i.title))})})]}),n.jsx(s,{condition:!!r,show:n.jsx(B,{children:r})})]}),n.jsx(s,{condition:!!(i!=null&&i.disabled),show:()=>n.jsx(n.Fragment,{children:n.jsx(m,{color:"disabled",children:"Disabled"})})}),n.jsx(a,{sx:{marginLeft:"auto",display:"flex",minHeight:e=>e.spacing(6),alignItems:"center"},children:p})]}),n.jsx(a,{sx:{p:2,justifyItems:"center"},children:x})]})]})};export{F as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{i9 as b,r as a,bl as m,iQ as I,iR as K}from"./index-Cx91uh9W.js";const y="label";function h(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function L(t,e){Object.assign(t.options,e)}function C(t,e){t.labels=e}function E(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y;const o=[];t.datasets=e.map(n=>{const c=t.datasets.find(f=>f[s]===n[s]);return!c||!n.data||o.includes(c)?{...n}:(o.push(c),Object.assign(c,n),c)})}function v(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y;const s={labels:[],datasets:[]};return C(s,t.labels),E(s,t.datasets,e),s}function B(t,e){let{height:s=150,width:o=300,redraw:n=!1,datasetIdKey:c,type:f,data:u,options:i,plugins:w=[],fallbackContent:O,updateMode:p,...j}=t;const l=a.useRef(null),r=a.useRef(),d=()=>{l.current&&(r.current=new b(l.current,{type:f,data:v(u,c),options:i&&{...i},plugins:w}),h(e,r.current))},g=()=>{h(e,null),r.current&&(r.current.destroy(),r.current=null)};return a.useEffect(()=>{!n&&r.current&&i&&L(r.current,i)},[n,i]),a.useEffect(()=>{!n&&r.current&&C(r.current.config.data,u.labels)},[n,u.labels]),a.useEffect(()=>{!n&&r.current&&u.datasets&&E(r.current.config.data,u.datasets,c)},[n,u.datasets]),a.useEffect(()=>{r.current&&(n?(g(),setTimeout(d)):r.current.update(p))},[n,i,u.labels,u.datasets,p]),a.useEffect(()=>{r.current&&(g(),setTimeout(d))},[f]),a.useEffect(()=>(d(),()=>g()),[]),m.createElement("canvas",Object.assign({ref:l,role:"img",height:s,width:o},j),O)}const T=a.forwardRef(B);function R(t,e){return b.register(e),a.forwardRef((s,o)=>m.createElement(T,Object.assign({},s,{ref:o,type:t})))}const k=R("line",I),M=R("bar",K);export{M as B,k as L};
|