mirror of
https://github.com/OpenMaxIO/openmaxio-object-browser
synced 2026-07-01 07:41:18 -07:00
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net> Signed-off-by: Benjamin Perez <benjamin@bexsoft.net> Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
"use strict";(self.webpackChunkportal_ui=self.webpackChunkportal_ui||[]).push([[3061],{75578:function(e,t,n){var a=n(1413),i=n(72791),r=n(80184);t.Z=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;function n(n){return(0,r.jsx)(i.Suspense,{fallback:t,children:(0,r.jsx)(e,(0,a.Z)({},n))})}return n}},98994:function(e,t,n){var a=n(72791),i=n(22338),r=n(79762),s=n(5171),l=n(80184),c={};t.Z=function(e){var t=e.rowRenderFunction,n=e.totalItems,o=e.defaultHeight,u=function(e){var n=e.index,a=e.style;return(0,l.jsx)("div",{style:a,children:t(n)})};return(0,l.jsx)(a.Fragment,{children:(0,l.jsx)(r.Z,{isItemLoaded:function(e){return!!c[e]},loadMoreItems:function(e,t){for(var n=e;n<=t;n++)c[n]=1;for(var a=e;a<=t;a++)c[a]=2},itemCount:n,children:function(e){var t=e.onItemsRendered,a=e.ref;return(0,l.jsx)(s.qj,{children:function(e){var r=e.width,s=e.height;return(0,l.jsx)(i.t7,{itemSize:o||220,height:s,itemCount:n,width:r,ref:a,onItemsRendered:t,children:u})}})}})})}},3061:function(e,t,n){n.r(t),n.d(t,{default:function(){return P}});var a=n(29439),i=n(1413),r=n(72791),s=n(75952),l=n(61889),c=n(40986),o=n(11135),u=n(25787),d=n(45248),h=n(23814),f=n(81207),x=n(57689),p=n(17238),g=n(82295),v=n(80184),m=function(e){var t=e.label,n=e.value,a=e.unit,i=e.variant,s=void 0===i?"normal":i;return(0,v.jsxs)("div",{style:{margin:"0px 20px"},children:[(0,v.jsxs)("div",{style:{textAlign:"center"},children:[(0,v.jsx)("span",{style:{fontSize:18,color:"normal"===s?"#000":"#999",fontWeight:400},children:n}),a&&(0,v.jsxs)(r.Fragment,{children:[" ",(0,v.jsx)("span",{style:{fontSize:12,color:"#8F9090",fontWeight:"bold"},children:a})]})]}),(0,v.jsx)("div",{style:{textAlign:"center",color:"normal"===s?"#767676":"#bababa",fontSize:12,whiteSpace:"nowrap"},children:t})]})},j=n(74815),y=n(25469),b=(0,u.Z)((function(e){return(0,o.Z)({redState:{color:e.palette.error.main,"& .min-icon":{width:16,height:16,float:"left",marginRight:4}},yellowState:{color:e.palette.warning.main,"& .min-icon":{width:16,height:16,float:"left",marginRight:4}},greenState:{color:e.palette.success.main,"& .min-icon":{width:16,height:16,float:"left",marginRight:4}},greyState:{color:"grey","& .min-icon":{width:16,height:16,float:"left",marginRight:4}},tenantItem:{border:"1px solid #EAEAEA",marginBottom:16,padding:"15px 30px","&:hover":{backgroundColor:"#FAFAFA",cursor:"pointer"}},titleContainer:{display:"flex",justifyContent:"space-between",width:"100%"},title:{fontSize:18,fontWeight:"bold"},namespaceLabel:{display:"inline-flex",backgroundColor:"#EAEDEF",borderRadius:2,padding:"4px 8px",fontSize:10,marginRight:20},status:{fontSize:12,color:"#8F9090"}})}))((function(e){var t=e.tenant,n=e.classes,a=(0,y.TL)(),i=(0,x.s0)(),c={value:"n/a",unit:""},o={value:"n/a",unit:""},u={value:"n/a",unit:""},h={value:"n/a",unit:""},f={value:"n/a",unit:""};if(t.capacity_raw){var b=(0,d.ae)("".concat(t.capacity_raw),!0).split(" ");c.value=b[0],c.unit=b[1]}if(t.capacity){var Z=(0,d.ae)("".concat(t.capacity),!0).split(" ");o.value=Z[0],o.unit=Z[1]}if(t.capacity_usage){var S=(0,d.l5)(t.capacity_usage,!0).split(" ");u.value=S[0],u.unit=S[1]}var C=[];if(t.tiers&&0!==t.tiers.length){C=t.tiers.map((function(e){return{value:e.size,variant:e.name}}));var w=t.tiers.filter((function(e){return"internal"===e.type})).reduce((function(e,t){return e+t.size}),0),_=t.tiers.filter((function(e){return"internal"!==e.type})).reduce((function(e,t){return e+t.size}),0),z=(0,d.l5)(_,!0).split(" ");f.value=z[0],f.unit=z[1];var A=(0,d.l5)(w,!0).split(" ");h.value=A[0],h.unit=A[1]}else C=[{value:t.capacity_usage||0,variant:"STANDARD"}];return(0,v.jsx)(r.Fragment,{children:(0,v.jsx)("div",{className:n.tenantItem,id:"list-tenant-".concat(t.name),onClick:function(){a((0,p.V7)({name:t.name,namespace:t.namespace})),a((0,g.v)()),i("/namespaces/".concat(t.namespace,"/tenants/").concat(t.name,"/summary"))},children:(0,v.jsxs)(l.ZP,{container:!0,children:[(0,v.jsxs)(l.ZP,{item:!0,xs:12,className:n.titleContainer,children:[(0,v.jsx)("div",{className:n.title,children:(0,v.jsx)("span",{children:t.name})}),(0,v.jsx)("div",{children:(0,v.jsxs)("span",{className:n.namespaceLabel,children:["Namespace:\xa0",t.namespace]})})]}),(0,v.jsx)(l.ZP,{item:!0,xs:12,sx:{marginTop:2},children:(0,v.jsxs)(l.ZP,{container:!0,children:[(0,v.jsx)(l.ZP,{item:!0,xs:2,children:(0,v.jsx)(j.Z,{totalCapacity:t.capacity||0,usedSpaceVariants:C,statusClass:function(e){switch(e){case"red":return n.redState;case"yellow":return n.yellowState;case"green":return n.greenState;default:return n.greyState}}(t.health_status)})}),(0,v.jsxs)(l.ZP,{item:!0,xs:!0,children:[(0,v.jsxs)(l.ZP,{item:!0,xs:!0,sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",marginTop:"10px"},children:[(0,v.jsx)(m,{label:"Raw Capacity",value:c.value,unit:c.unit}),(0,v.jsx)(m,{label:"Usable Capacity",value:o.value,unit:o.unit}),(0,v.jsx)(m,{label:"Pools",value:t.pool_count.toString(),variant:"faded"})]}),(0,v.jsx)(l.ZP,{item:!0,xs:12,sx:{paddingLeft:"20px",marginTop:"15px"},children:(0,v.jsxs)("span",{className:n.status,children:[(0,v.jsx)("strong",{children:"State:"})," ",t.currentState]})})]}),(0,v.jsx)(l.ZP,{item:!0,xs:3,children:(0,v.jsx)(r.Fragment,{children:(0,v.jsxs)(l.ZP,{container:!0,children:[(0,v.jsxs)(l.ZP,{item:!0,xs:2,textAlign:"center",justifyContent:"center",justifyItems:"center",children:[(0,v.jsx)(s.FU8,{style:{width:25,color:"rgb(91,91,91)"}}),(0,v.jsx)("div",{style:{color:"rgb(118, 118, 118)",fontSize:12,fontWeight:"400"},children:"Usage"})]}),(0,v.jsx)(l.ZP,{item:!0,xs:1}),(0,v.jsxs)(l.ZP,{item:!0,style:{paddingTop:8},children:[(!t.tiers||0===t.tiers.length)&&(0,v.jsxs)("div",{style:{fontSize:14,fontWeight:400},children:[(0,v.jsxs)("span",{style:{color:"rgb(62,62,62)"},children:["Internal:"," "]})," ","".concat(u.value," ").concat(u.unit)]}),t.tiers&&t.tiers.length>0&&(0,v.jsxs)(r.Fragment,{children:[(0,v.jsxs)("div",{style:{fontSize:14,fontWeight:400},children:[(0,v.jsxs)("span",{style:{color:"rgb(62,62,62)"},children:["Internal:"," "]})," ","".concat(h.value," ").concat(h.unit)]}),(0,v.jsxs)("div",{style:{fontSize:14,fontWeight:400},children:[(0,v.jsxs)("span",{style:{color:"rgb(62,62,62)"},children:["Tiered:"," "]})," ","".concat(f.value," ").concat(f.unit)]})]})]})]})})})]})})]})})})})),Z=n(81806),S=n(75578),C=n(98994),w=n(59114),_=n(74794),z=n(87995),A=n(90673),T=n(27454),F=n(47974),R=(0,S.Z)(r.lazy((function(){return n.e(7798).then(n.bind(n,37798))}))),P=(0,u.Z)((function(e){return(0,o.Z)((0,i.Z)((0,i.Z)((0,i.Z)((0,i.Z)({},h.OR),h.qg),h.Bz),{},{tenantsList:{height:"calc(100vh - 195px)"},sortByContainer:{display:"flex",justifyContent:"flex-end",marginBottom:10},innerSort:{maxWidth:200,width:"95%",display:"flex",flexDirection:"row",alignItems:"center"},sortByLabel:{whiteSpace:"nowrap",fontSize:14,color:"#838383",fontWeight:"bold",marginRight:10}}))}))((function(e){var t=e.classes,n=(0,y.TL)(),i=(0,x.s0)(),o=(0,r.useState)(!1),u=(0,a.Z)(o,2),h=u[0],p=u[1],g=(0,r.useState)(""),m=(0,a.Z)(g,2),j=m[0],S=m[1],P=(0,r.useState)([]),I=(0,a.Z)(P,2),N=I[0],k=I[1],B=(0,r.useState)(!1),D=(0,a.Z)(B,2),E=D[0],L=D[1],W=(0,r.useState)(null),U=(0,a.Z)(W,2),V=U[0],K=U[1],M=(0,r.useState)("name"),O=(0,a.Z)(M,2),q=O[0],G=O[1],H=N.filter((function(e){return""===j||e.name.indexOf(j)>=0}));H.sort((function(e,t){switch(q){case"capacity":return e.capacity&&t.capacity?e.capacity>t.capacity?1:e.capacity<t.capacity?-1:0:0;case"usage":return e.capacity_usage&&t.capacity_usage?e.capacity_usage>t.capacity_usage?1:e.capacity_usage<t.capacity_usage?-1:0:0;case"active_status":return"red"===e.health_status&&"red"!==t.health_status?1:"red"!==e.health_status&&"red"===t.health_status?-1:0;case"failing_status":return"green"===e.health_status&&"green"!==t.health_status?1:"green"!==e.health_status&&"green"===t.health_status?-1:0;default:return e.name>t.name?1:e.name<t.name?-1:0}})),(0,r.useEffect)((function(){if(h){f.Z.invoke("GET","/api/v1/tenants").then((function(e){if(null!==e){var t=[];null!==e.tenants&&(t=e.tenants);for(var n=0;n<t.length;n++)t[n].total_capacity=(0,d.ae)(t[n].total_size+"");k(t),p(!1)}else p(!1)})).catch((function(e){n((0,z.Ih)(e)),p(!1)}))}}),[h,n]),(0,r.useEffect)((function(){p(!0)}),[]);return(0,v.jsxs)(r.Fragment,{children:[E&&(0,v.jsx)(R,{newServiceAccount:V,open:E,closeModal:function(){L(!1),K(null)},entity:"Tenant"}),(0,v.jsx)(F.Z,{label:"Tenants",middleComponent:(0,v.jsx)(w.Z,{placeholder:"Filter Tenants",onChange:function(e){S(e)},value:j}),actions:(0,v.jsxs)(l.ZP,{item:!0,xs:12,sx:{display:"flex",justifyContent:"flex-end"},children:[(0,v.jsx)(T.Z,{tooltip:"Refresh Tenant List",children:(0,v.jsx)(s.zxk,{id:"refresh-tenant-list",onClick:function(){p(!0)},icon:(0,v.jsx)(s.DuK,{}),variant:"regular"})}),(0,v.jsx)(T.Z,{tooltip:"Create Tenant",children:(0,v.jsx)(s.zxk,{id:"create-tenant",label:"Create Tenant",onClick:function(){i("/tenants/add")},icon:(0,v.jsx)(s.dtP,{}),variant:"callAction"})})]})}),(0,v.jsx)(_.Z,{children:(0,v.jsxs)(l.ZP,{item:!0,xs:12,className:t.tenantsList,children:[h&&(0,v.jsx)(c.Z,{}),!h&&(0,v.jsxs)(r.Fragment,{children:[0!==H.length&&(0,v.jsxs)(r.Fragment,{children:[(0,v.jsx)(l.ZP,{item:!0,xs:12,className:t.sortByContainer,children:(0,v.jsxs)("div",{className:t.innerSort,children:[(0,v.jsx)("span",{className:t.sortByLabel,children:"Sort by"}),(0,v.jsx)(A.Z,{id:"sort-by",label:"",value:q,onChange:function(e){G(e.target.value)},name:"sort-by",options:[{label:"Name",value:"name"},{label:"Capacity",value:"capacity"},{label:"Usage",value:"usage"},{label:"Active Status",value:"active_status"},{label:"Failing Status",value:"failing_status"}]})]})}),(0,v.jsx)(C.Z,{rowRenderFunction:function(e){var t=H[e]||null;return t?(0,v.jsx)(b,{tenant:t}):null},totalItems:H.length})]}),0===H.length&&(0,v.jsx)(l.ZP,{container:!0,justifyContent:"center",alignContent:"center",alignItems:"center",children:(0,v.jsx)(l.ZP,{item:!0,xs:8,children:(0,v.jsx)(s.KfX,{iconComponent:(0,v.jsx)(s.zb0,{}),title:"Tenants",help:(0,v.jsxs)(r.Fragment,{children:["Tenant is the logical structure to represent a MinIO deployment. A tenant can have different size and configurations from other tenants, even a different storage class.",(0,v.jsx)("br",{}),(0,v.jsx)("br",{}),"To get started,\xa0",(0,v.jsx)(Z.Z,{onClick:function(){i("/tenants/add")},children:"Create a Tenant."})]})})})})]})]})})]})}))},74815:function(e,t,n){n.d(t,{Z:function(){return d}});var a=n(93433),i=(n(72791),n(73909)),r=n(21041),s=n(41048),l=n(45248),c=n(75952),o=n(80184),u=function(e){var t=e.totalValue,n=e.sizeItems,a=e.bgColor,i=void 0===a?"#ededed":a;return(0,o.jsx)("div",{style:{width:"100%",height:12,backgroundColor:i,borderRadius:30,display:"flex",transitionDuration:"0.3s",overflow:"hidden"},children:n.map((function(e,n){var a=100*e.value/t;return(0,o.jsx)("div",{style:{width:"".concat(a,"%"),height:"100%",backgroundColor:e.color,transitionDuration:"0.3s"}},"itemSize-".concat(n.toString()))}))})},d=function(e){var t=e.totalCapacity,n=e.usedSpaceVariants,d=e.statusClass,h=e.render,f=void 0===h?"pie":h,x=["#8dacd3","#bca1ea","#92e8d2","#efc9ac","#97f274","#f7d291","#71ACCB","#f28282","#e28cc1","#2781B0"],p="#ededed",g=n.reduce((function(e,t){return e+t.value}),0),v=t-g,m=[],j=n.find((function(e){return"STANDARD"===e.variant}))||{value:0,variant:"empty"};n.length>10?m=[{value:g-j.value,color:"#2781B0",label:"Total Tiers Space"}]:m=n.filter((function(e){return"STANDARD"!==e.variant})).map((function(e,t){return{value:e.value,color:x[t],label:"Tier - ".concat(e.variant)}}));var y="#07193E",b=100*j.value/t;b>=90?y="#C83B51":b>=75&&(y="#FFAB0F");var Z=[{value:j.value,color:y,label:"Used Space by Tenant"}].concat((0,a.Z)(m),[{value:v,color:"bar"===f?p:"transparent",label:"Empty Space"}]);if("bar"===f){var S=Z.map((function(e){return{value:e.value,color:e.color,itemName:e.label}}));return(0,o.jsx)("div",{style:{width:"100%",marginBottom:15},children:(0,o.jsx)(u,{totalValue:t,sizeItems:S,bgColor:p})})}return(0,o.jsxs)("div",{style:{position:"relative",width:110,height:110},children:[(0,o.jsx)("div",{style:{position:"absolute",right:-5,top:15,zIndex:400},className:d,children:(0,o.jsx)(c.J$M,{style:{border:"#fff 2px solid",borderRadius:"100%",width:20,height:20}})}),(0,o.jsx)("span",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontWeight:"bold",color:"#000",fontSize:12},children:isNaN(g)?"N/A":(0,l.l5)(g)}),(0,o.jsx)("div",{children:(0,o.jsxs)(i.u,{width:110,height:110,children:[(0,o.jsx)(r.b,{data:[{value:100}],cx:"50%",cy:"50%",dataKey:"value",outerRadius:50,innerRadius:40,fill:p,isAnimationActive:!1,stroke:"none"}),(0,o.jsx)(r.b,{data:Z,cx:"50%",cy:"50%",dataKey:"value",outerRadius:50,innerRadius:40,children:Z.map((function(e,t){return(0,o.jsx)(s.b,{fill:e.color,stroke:"none"},"cellCapacity-".concat(t))}))})]})})]})}}}]);
|
|
//# sourceMappingURL=3061.6d2f437f.chunk.js.map
|