github.com/minio/console@v1.4.1/web-app/build/static/js/1370.adfc1682.chunk.js (about)

     1  (self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[1370],{41206:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var r=n(65043),o=n(89923),i=n(61476),a=n.n(i),s=n(6681),c=n(70579);const l=e=>{let{value:t,label:n="",tooltip:i="",mode:l="json",onChange:d,editorHeight:p=250,helptip:u}=e;return(0,c.jsx)(o.BYM,{value:t,onChange:e=>d(e),mode:l,tooltip:i,editorHeight:p,label:n,helpTools:(0,c.jsx)(r.Fragment,{children:(0,c.jsx)(s.A,{tooltip:"Copy to Clipboard",children:(0,c.jsx)(a(),{text:t,children:(0,c.jsx)(o.$nd,{type:"button",id:"copy-code-mirror",icon:(0,c.jsx)(o.TdU,{}),color:"primary",variant:"regular"})})})}),helpTip:u,helpTipPlacement:"right"})}},71435:(e,t,n)=>{"use strict";n.d(t,{CS:()=>a,Ez:()=>r,WJ:()=>o,Zb:()=>i});const r={RED:"#C83B51",GREEN:"#4CCB92",YELLOW:"#FFBD62"},o=(e,t)=>e<=t/2?"bad":2!==t&&e===t/2+1?"warn":e===t?"good":void 0,i=e=>{switch(e){case"offline":return"bad";case"online":return"good";default:return"warn"}},a=(e,t)=>e<=t/2?"bad":e===t/2+1?"warn":e===t?"good":void 0},81370:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>S});var r=n(65043),o=n(22166),i=n(73216),a=n(89923),s=n(77403),c=n(41206),l=n(99161),d=n(77938),p=n(72237),u=n(64681),x=n(71435),h=n(70579);const f={display:"grid",gridTemplateColumns:"70px 1fr",gap:15},y=e=>{let{search:t="",children:n=""}=e;const r=new RegExp("(".concat(function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}(t),")"),"i"),o=String(n).split(r);return t?o.map(((e,t)=>r.test(e)?(0,h.jsx)("mark",{children:e},t):e)):n},m=e=>{let{policyStatements:t}=e;const[n,o]=(0,r.useState)("");return(0,h.jsxs)(a.xA9,{container:!0,children:[(0,h.jsx)(a.xA9,{item:!0,xs:12,children:(0,h.jsxs)(a.xA9,{container:!0,sx:{display:"flex",alignItems:"center"},children:[(0,h.jsx)(a.V7x,{content:(0,h.jsxs)(r.Fragment,{children:["Define which actions are permitted on a specified resource. Learn more about"," ",(0,h.jsx)("a",{target:"blank",href:"https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html",children:"IAM conditional statements"}),"."]}),placement:"right",children:(0,h.jsx)(a.xA9,{item:!0,xs:12,sm:6,sx:{fontWeight:"bold"},children:"Statements"})}),(0,h.jsx)(a.xA9,{item:!0,xs:12,sm:6,sx:{display:"flex",justifyContent:"flex-end"},children:(0,h.jsx)(u.A,{placeholder:"Search",onChange:o,value:n,sx:{maxWidth:380}})})]})}),!t&&(0,h.jsx)(r.Fragment,{children:"Policy has no statements"}),t&&(0,h.jsx)(a.xA9,{item:!0,xs:12,sx:{"& .policy-row":{borderBottom:"1px solid #eaeaea"},"& .policy-row:first-child":{borderTop:"1px solid #eaeaea"},"& .policy-row:last-child":{borderBottom:"0px"},paddingTop:"15px","& mark":{color:"#000000",fontWeight:500}},children:t.map(((e,t)=>{const r=e.Effect,o="Allow"===r;return(0,h.jsxs)(a.azJ,{className:"policy-row",sx:{display:"grid",gridTemplateColumns:"1fr",gap:"15px",fontSize:"14px",padding:"10px 0 10px 0","& .label":{fontWeight:600}},children:[(0,h.jsxs)(a.azJ,{sx:f,children:[(0,h.jsx)(a.azJ,{className:"label",children:"Effect:"}),(0,h.jsxs)(a.azJ,{sx:{display:"flex",alignItems:"center","& .min-icon":{marginRight:"5px",fill:o?x.Ez.GREEN:x.Ez.RED,height:"14px",width:"14px"}},children:[o?(0,h.jsx)(a.xhy,{}):(0,h.jsx)(a.aaC,{}),r]})]}),(0,h.jsxs)(a.xA9,{container:!0,sx:{gap:15},children:[(0,h.jsxs)(a.xA9,{item:!0,xs:12,sm:6,sx:f,children:[(0,h.jsx)(a.azJ,{className:"label",children:"Actions:"}),(0,h.jsx)(a.azJ,{children:e.Action&&e.Action.map(((e,r)=>(0,h.jsx)("div",{children:(0,h.jsx)(y,{search:n,children:e})},"".concat(t,"-r-").concat(r))))})]}),(0,h.jsxs)(a.xA9,{item:!0,xs:12,sm:6,sx:f,children:[(0,h.jsx)(a.azJ,{className:"label",children:"Resources:"}),(0,h.jsx)(a.azJ,{children:e.Resource&&e.Resource.map(((e,r)=>(0,h.jsxs)("div",{children:[" ",(0,h.jsx)(y,{search:n,children:e})]},"".concat(t,"-r-").concat(r))))})]})]})]},"".concat(t))}))})]})};var b=n(56483),g=n(64159),j=n(46537),v=n(20554),C=n(6681),w=n(48793),A=n(56629),P=n(55968);const O=(0,p.A)(r.lazy((()=>n.e(4676).then(n.bind(n,4676))))),S=()=>{const e=(0,v.jL)(),t=(0,i.Zp)(),n=(0,i.g)(),p=(0,o.d4)(j.s$),[x,f]=(0,r.useState)(null),[y,S]=(0,r.useState)([]),[_,E]=(0,r.useState)([]),[R,k]=(0,r.useState)([]),[D,M]=(0,r.useState)(!1),T=(0,b.x6)(n.policyName||""),[F,z]=(0,r.useState)(""),[N,I]=(0,r.useState)(!0),[B,U]=(0,r.useState)(""),[J,L]=(0,r.useState)(!0),[G,$]=(0,r.useState)(""),[H,W]=(0,r.useState)(!0),[Z,V]=(0,r.useState)(!1),[Y,K]=(0,r.useState)("summary"),Q=p&&p.includes("ldap-idp")||!1,X=(0,d._)(l.Ms,l.qA,!0),q=(0,d._)(l.Ms,l.Oh,!0),ee=(0,d._)(l.Ms,l.x6,!0),te=(0,d._)(l.Ms,l.Ld,!0),ne=(0,d._)(l.Ms,l.yv,!0),re=(0,d._)(l.Ms,l.uA,!0),oe=(0,d._)(l.Ms,l.nr,!0);(0,r.useEffect)((()=>{N&&(N&&(ne?A.F.policy.policyInfo((0,b.nf)(T)).then((e=>{if(e.data){var t,n;f(e.data),z(e?JSON.stringify(JSON.parse(null===(t=e.data)||void 0===t?void 0:t.policy),null,4):"");const r=JSON.parse(null===(n=e.data)||void 0===n?void 0:n.policy);S(r.Statement)}I(!1)})).catch((t=>{e((0,g.C9)(t)),I(!1)})):I(!1)),J&&(ee&&!Q?A.F.policies.listUsersForPolicy((0,b.nf)(T)).then((e=>{var t;E(null!==(t=e.data)&&void 0!==t?t:[]),L(!1)})).catch((t=>{e((0,g.C9)(t)),L(!1)})):L(!1)),H&&(X&&!Q?A.F.policies.listGroupsForPolicy((0,b.nf)(T)).then((e=>{var t;k(null!==(t=e.data)&&void 0!==t?t:[]),W(!1)})).catch((t=>{e((0,g.C9)(t)),W(!1)})):W(!1)))}),[T,N,J,H,E,k,z,f,L,W,ee,X,ne,Q,e]);const ie=""!==T.trim(),ae=[{type:"view",onClick:e=>{t("".concat(l.zZ.USERS,"/").concat((0,b.nf)(e)))},disableButtonFunction:()=>!te}],se=_.filter((e=>e.includes(B))),ce=[{type:"view",onClick:e=>{t("".concat(l.zZ.GROUPS,"/").concat((0,b.nf)(e)))},disableButtonFunction:()=>!q}],le=R.filter((e=>e.includes(G))),de=()=>{L(!0),W(!0),I(!0)};return(0,r.useEffect)((()=>{e((0,g.ph)("policy_details_summary"))}),[]),(0,h.jsxs)(r.Fragment,{children:[Z&&(0,h.jsx)(O,{deleteOpen:Z,selectedPolicy:T,closeDeleteModalAndRefresh:e=>{V(!1),t(l.zZ.POLICIES)}}),(0,h.jsx)(w.A,{label:(0,h.jsx)(r.Fragment,{children:(0,h.jsx)(a.EGL,{label:"Policy",onClick:()=>t(l.zZ.POLICIES)})}),actions:(0,h.jsx)(P.A,{})}),(0,h.jsxs)(a.Mxu,{children:[(0,h.jsx)(a.lcx,{icon:(0,h.jsx)(a.n$X,{width:40}),title:T,subTitle:(0,h.jsx)(r.Fragment,{children:"IAM Policy"}),actions:(0,h.jsxs)(r.Fragment,{children:[(0,h.jsx)(d.R,{scopes:[l.OV.ADMIN_DELETE_POLICY],resource:l.Ms,errorProps:{disabled:!0},children:(0,h.jsx)(C.A,{tooltip:re?"":(0,l.vj)(l.uA,"delete Policies"),children:(0,h.jsx)(a.$nd,{id:"delete-policy",label:"Delete Policy",variant:"secondary",icon:(0,h.jsx)(a.ucK,{}),onClick:()=>{V(!0)},disabled:!re})})}),(0,h.jsx)(C.A,{tooltip:"Refresh",children:(0,h.jsx)(a.$nd,{id:"refresh-policy",label:"Refresh",variant:"regular",icon:(0,h.jsx)(a.fNY,{}),onClick:()=>{de()}})})]}),sx:{marginBottom:15}}),(0,h.jsx)(a.azJ,{children:(0,h.jsx)(a.tUM,{options:[{tabConfig:{label:"Summary",disabled:!ne,id:"summary"},content:(0,h.jsx)(r.Fragment,{children:(0,h.jsxs)(a.xA9,{onMouseMove:()=>e((0,g.ph)("policy_details_summary")),children:[(0,h.jsx)(a._xt,{separator:!0,sx:{marginBottom:15},children:"Policy Summary"}),(0,h.jsx)(a.azJ,{withBorders:!0,children:(0,h.jsx)(m,{policyStatements:y})})]})})},{tabConfig:{label:"Users",disabled:!ee||Q,id:"users"},content:(0,h.jsx)(r.Fragment,{children:(0,h.jsxs)(a.xA9,{onMouseMove:()=>e((0,g.ph)("policy_details_users")),children:[(0,h.jsx)(a._xt,{separator:!0,sx:{marginBottom:15},children:"Users"}),(0,h.jsxs)(a.xA9,{container:!0,children:[_.length>0&&(0,h.jsx)(a.xA9,{item:!0,xs:12,sx:{...s._0.actionsTray,marginBottom:15},children:(0,h.jsx)(u.A,{value:B,placeholder:"Search Users",id:"search-resource",onChange:e=>{U(e)}})}),(0,h.jsx)(a.bQt,{itemActions:ae,columns:[{label:"Name",elementKey:"name"}],isLoading:J,records:se,entityName:"Users with this Policy associated",idField:"name",customPaperHeight:"500px"})]})]})})},{tabConfig:{label:"Groups",disabled:!X||Q,id:"groups"},content:(0,h.jsx)(r.Fragment,{children:(0,h.jsxs)(a.xA9,{onMouseMove:()=>e((0,g.ph)("policy_details_groups")),children:[(0,h.jsx)(a._xt,{separator:!0,sx:{marginBottom:15},children:"Groups"}),(0,h.jsxs)(a.xA9,{container:!0,children:[R.length>0&&(0,h.jsx)(a.xA9,{item:!0,xs:12,sx:{...s._0.actionsTray,marginBottom:15},children:(0,h.jsx)(u.A,{value:B,placeholder:"Search Groups",id:"search-resource",onChange:e=>{$(e)}})}),(0,h.jsx)(a.bQt,{itemActions:ce,columns:[{label:"Name",elementKey:"name"}],isLoading:H,records:le,entityName:"Groups with this Policy associated",idField:"name",customPaperHeight:"500px"})]})]})})},{tabConfig:{label:"Raw Policy",disabled:!ne,id:"raw-policy"},content:(0,h.jsx)(r.Fragment,{children:(0,h.jsxs)(a.xA9,{onMouseMove:()=>e((0,g.ph)("policy_details_policy")),children:[(0,h.jsx)(a.V7x,{content:(0,h.jsx)(r.Fragment,{children:(0,h.jsx)("a",{target:"blank",href:"https://min.io/docs/minio/kubernetes/upstream/administration/identity-access-management/policy-based-access-control.html#policy-document-structure",children:"Guide to access policy structure"})}),placement:"right",children:(0,h.jsx)(a._xt,{children:"Raw Policy"})}),(0,h.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:t=>{t.preventDefault(),D||(M(!0),oe?A.F.policies.addPolicy({name:T,policy:F}).then((t=>{M(!1),e((0,g.Hk)("Policy successfully updated")),de()})).catch((t=>{M(!1),e((0,g.C9)({errorMessage:"There was an error updating the Policy ",detailedError:"There was an error updating the Policy: "+(t.error.detailedMessage||"")+". Please check Policy syntax."}))})):M(!1))},children:(0,h.jsxs)(a.xA9,{container:!0,children:[(0,h.jsx)(a.xA9,{item:!0,xs:12,children:(0,h.jsx)(c.A,{value:F,onChange:e=>{oe&&z(e)},editorHeight:"350px",helptip:(0,h.jsx)(r.Fragment,{children:(0,h.jsx)("a",{target:"blank",href:"https://min.io/docs/minio/kubernetes/upstream/administration/identity-access-management/policy-based-access-control.html#policy-document-structure",children:"Guide to access policy structure"})})})}),(0,h.jsxs)(a.xA9,{item:!0,xs:12,sx:{display:"flex",justifyContent:"flex-end",paddingTop:16,gap:8},children:[!x&&(0,h.jsx)(a.$nd,{type:"button",variant:"regular",id:"clear-policy",onClick:()=>{z("{}")},children:"Clear"}),(0,h.jsx)(d.R,{scopes:[l.OV.ADMIN_CREATE_POLICY],resource:l.Ms,errorProps:{disabled:!0},children:(0,h.jsx)(C.A,{tooltip:oe?"":(0,l.vj)(l.nr,"edit a Policy"),children:(0,h.jsx)(a.$nd,{id:"save",type:"submit",variant:"callAction",color:"primary",disabled:D||!ie||!oe,label:"Save"})})})]}),D&&(0,h.jsx)(a.xA9,{item:!0,xs:12,children:(0,h.jsx)(a.z21,{})})]})})]})})}],currentTabOrPath:Y,onTabClick:e=>K(e)})})]})]})}},75270:(e,t,n)=>{"use strict";var r=n(40139),o={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,i,a,s,c,l,d=!1;t||(t={}),n=t.debug||!1;try{if(a=r(),s=document.createRange(),c=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),"undefined"===typeof r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=o[t.format]||o.default;window.clipboardData.setData(i,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(l),s.selectNodeContents(l),c.addRange(s),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");d=!0}catch(p){n&&console.error("unable to copy using execCommand: ",p),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),d=!0}catch(p){n&&console.error("unable to copy using clipboardData: ",p),n&&console.error("falling back to prompt"),i=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(i,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(s):c.removeAllRanges()),l&&document.body.removeChild(l),a()}return d}},24480:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.CopyToClipboard=void 0;var o=s(n(65043)),i=s(n(75270)),a=["text","onCopy","options","children"];function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){y(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function d(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function x(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=f(e);if(t){var i=f(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}(this,n)}}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var m=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}(c,e);var t,n,r,s=x(c);function c(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return y(h(e=s.call.apply(s,[this].concat(n))),"onClick",(function(t){var n=e.props,r=n.text,a=n.onCopy,s=n.children,c=n.options,l=o.default.Children.only(s),d=(0,i.default)(r,c);a&&a(r,d),l&&l.props&&"function"===typeof l.props.onClick&&l.props.onClick(t)})),e}return t=c,(n=[{key:"render",value:function(){var e=this.props,t=(e.text,e.onCopy,e.options,e.children),n=d(e,a),r=o.default.Children.only(t);return o.default.cloneElement(r,l(l({},n),{},{onClick:this.onClick}))}}])&&p(t.prototype,n),r&&p(t,r),Object.defineProperty(t,"prototype",{writable:!1}),c}(o.default.PureComponent);t.CopyToClipboard=m,y(m,"defaultProps",{onCopy:void 0,options:void 0})},61476:(e,t,n)=>{"use strict";var r=n(24480).CopyToClipboard;r.CopyToClipboard=r,e.exports=r},40139:e=>{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}}}}]);
     2  //# sourceMappingURL=1370.adfc1682.chunk.js.map