Files
object-browser/portal-ui/build/static/js/1191.6a8f1e3d.chunk.js
Alex 3875fb3eaa Release v0.31.0 (#2912)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
2023-06-29 12:21:34 -07:00

2 lines
16 KiB
JavaScript

(self.webpackChunkportal_ui=self.webpackChunkportal_ui||[]).push([[1191],{92217:function(e,t,n){"use strict";var r=n(72791),o=n(29945),i=n(78029),c=n.n(i),a=n(27454),s=n(80184);t.Z=function(e){var t=e.value,n=e.label,i=void 0===n?"":n,l=e.tooltip,u=void 0===l?"":l,d=e.mode,p=void 0===d?"json":d,f=e.onChange,h=e.editorHeight,y=void 0===h?250:h;return(0,s.jsx)(o.pq4,{value:t,onChange:function(e){return f(e)},mode:p,tooltip:u,editorHeight:y,label:i,helpTools:(0,s.jsx)(r.Fragment,{children:(0,s.jsx)(a.Z,{tooltip:"Copy to Clipboard",children:(0,s.jsx)(c(),{text:t,children:(0,s.jsx)(o.zxk,{type:"button",id:"copy-code-mirror",icon:(0,s.jsx)(o.TIy,{}),color:"primary",variant:"regular"})})})})})}},879:function(e,t,n){"use strict";n.d(t,{D_:function(){return c},Et:function(){return o},GJ:function(){return i},yh:function(){return r}});var r={RED:"#C83B51",GREEN:"#4CCB92",YELLOW:"#E7A219"},o=function(e,t){return e<=t/2?r.RED:2!==t&&e===t/2+1?r.YELLOW:e===t?r.GREEN:void 0},i=function(e){switch(e){case"offline":return r.RED;case"online":return r.GREEN;default:return r.YELLOW}},c=function(e,t){return e<=t/2?r.RED:e===t/2+1?r.YELLOW:e===t?r.GREEN:void 0}},1191:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return F}});var r=n(1413),o=n(29439),i=n(72791),c=n(78687),a=n(57689),s=n(29945),l=n(23814),u=n(40986),d=n(92217),p=n(56087),f=n(38442),h=n(75578),y=n(59114),x=n(879),m=n(72455),j=n(80184),b=(0,m.Z)((function(e){return{searchField:(0,r.Z)((0,r.Z)({},l.qg.searchField),{},{maxWidth:380})}})),g={display:"grid",gridTemplateColumns:"70px 1fr",gap:15},v=function(e){var t=e.search,n=void 0===t?"":t,r=e.children,o=void 0===r?"":r,i=new RegExp("(".concat(function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}(n),")"),"i"),c=String(o).split(i);return n?c.map((function(e,t){return i.test(e)?(0,j.jsx)("mark",{children:e},t):e})):o},C=function(e){var t=e.policyStatements,n=b(),r=(0,i.useState)(""),c=(0,o.Z)(r,2),a=c[0],l=c[1];return(0,j.jsxs)(s.rjZ,{container:!0,children:[(0,j.jsx)(s.rjZ,{item:!0,xs:12,children:(0,j.jsxs)(s.rjZ,{container:!0,sx:{display:"flex",alignItems:"center"},children:[(0,j.jsx)(s.rjZ,{item:!0,xs:12,sm:6,sx:{fontWeight:"bold"},children:"Statements"}),(0,j.jsx)(s.rjZ,{item:!0,xs:12,sm:6,sx:{display:"flex",justifyContent:"flex-end"},children:(0,j.jsx)(y.Z,{placeholder:"Search",onChange:l,overrideClass:n.searchField,value:a})})]})}),!t&&(0,j.jsx)(i.Fragment,{children:"Policy has no statements"}),t&&(0,j.jsx)(s.rjZ,{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((function(e,t){var n=e.Effect,r="Allow"===n;return(0,j.jsxs)(s.xuv,{className:"policy-row",sx:{display:"grid",gridTemplateColumns:"1fr",gap:"15px",fontSize:"14px",padding:"10px 0 10px 0","& .label":{fontWeight:600}},children:[(0,j.jsxs)(s.xuv,{sx:g,children:[(0,j.jsx)(s.xuv,{className:"label",children:"Effect:"}),(0,j.jsxs)(s.xuv,{sx:{display:"flex",alignItems:"center","& .min-icon":{marginRight:"5px",fill:r?x.yh.GREEN:x.yh.RED,height:"14px",width:"14px"}},children:[r?(0,j.jsx)(s.E31,{}):(0,j.jsx)(s.dRf,{}),n]})]}),(0,j.jsxs)(s.rjZ,{container:!0,sx:{gap:15},children:[(0,j.jsxs)(s.rjZ,{item:!0,xs:12,sm:6,sx:g,children:[(0,j.jsx)(s.xuv,{className:"label",children:"Actions:"}),(0,j.jsx)(s.xuv,{children:e.Action&&e.Action.map((function(e,n){return(0,j.jsx)("div",{children:(0,j.jsx)(v,{search:a,children:e})},"".concat(t,"-r-").concat(n))}))})]}),(0,j.jsxs)(s.rjZ,{item:!0,xs:12,sm:6,sx:g,children:[(0,j.jsx)(s.xuv,{className:"label",children:"Resources:"}),(0,j.jsx)(s.xuv,{children:e.Resource&&e.Resource.map((function(e,n){return(0,j.jsxs)("div",{children:[" ",(0,j.jsx)(v,{search:a,children:e})]},"".concat(t,"-r-").concat(n))}))})]})]})]},"".concat(t))}))})]})},w=n(45248),Z=n(87995),O=n(46078),S=n(81551),E=n(27454),P=n(47974),R=n(31776),D=n(99670),k=(0,h.Z)(i.lazy((function(){return n.e(312).then(n.bind(n,312))}))),F=function(){var e=(0,S.TL)(),t=(0,a.s0)(),n=(0,a.UO)(),h=(0,c.v9)(O.$4),x=(0,i.useState)(null),m=(0,o.Z)(x,2),b=m[0],g=m[1],v=(0,i.useState)([]),F=(0,o.Z)(v,2),_=F[0],T=F[1],L=(0,i.useState)([]),N=(0,o.Z)(L,2),A=N[0],I=N[1],M=(0,i.useState)([]),B=(0,o.Z)(M,2),U=B[0],G=B[1],z=(0,i.useState)(!1),H=(0,o.Z)(z,2),W=H[0],K=H[1],Y=(0,w.IO)(n.policyName||""),J=(0,i.useState)(""),X=(0,o.Z)(J,2),Q=X[0],$=X[1],q=(0,i.useState)(!0),V=(0,o.Z)(q,2),ee=V[0],te=V[1],ne=(0,i.useState)(""),re=(0,o.Z)(ne,2),oe=re[0],ie=re[1],ce=(0,i.useState)(!0),ae=(0,o.Z)(ce,2),se=ae[0],le=ae[1],ue=(0,i.useState)(""),de=(0,o.Z)(ue,2),pe=de[0],fe=de[1],he=(0,i.useState)(!0),ye=(0,o.Z)(he,2),xe=ye[0],me=ye[1],je=(0,i.useState)(!1),be=(0,o.Z)(je,2),ge=be[0],ve=be[1],Ce=(0,i.useState)("summary"),we=(0,o.Z)(Ce,2),Ze=we[0],Oe=we[1],Se=h&&h.includes("ldap-idp")||!1,Ee=(0,f.F)(p.C3,p.K6,!0),Pe=(0,f.F)(p.C3,p.k_,!0),Re=(0,f.F)(p.C3,p.Rs,!0),De=(0,f.F)(p.C3,p.iw,!0),ke=(0,f.F)(p.C3,p.GD,!0),Fe=(0,f.F)(p.C3,p.bE,!0),_e=(0,f.F)(p.C3,p.XM,!0);(0,i.useEffect)((function(){ee&&(ee&&(ke?R.h.policy.policyInfo((0,w.LL)(Y)).then((function(e){if(e.data){var t,n;g(e.data),$(e?JSON.stringify(JSON.parse(null===(t=e.data)||void 0===t?void 0:t.policy),null,4):"");var r=JSON.parse(null===(n=e.data)||void 0===n?void 0:n.policy);T(r.Statement)}te(!1)})).catch((function(t){e((0,Z.Ih)(t)),te(!1)})):te(!1)),se&&(Re&&!Se?R.h.policies.listUsersForPolicy((0,w.LL)(Y)).then((function(e){var t;I(null!==(t=e.data)&&void 0!==t?t:[]),le(!1)})).catch((function(t){e((0,Z.Ih)(t)),le(!1)})):le(!1)),xe&&(Ee&&!Se?R.h.policies.listGroupsForPolicy((0,w.LL)(Y)).then((function(e){var t;G(null!==(t=e.data)&&void 0!==t?t:[]),me(!1)})).catch((function(t){e((0,Z.Ih)(t)),me(!1)})):me(!1)))}),[Y,ee,se,xe,I,G,$,g,le,me,Re,Ee,ke,Se,e]);var Te=""!==Y.trim(),Le=[{type:"view",onClick:function(e){t("".concat(p.gA.USERS,"/").concat((0,w.LL)(e)))},disableButtonFunction:function(){return!De}}],Ne=A.filter((function(e){return e.includes(oe)})),Ae=[{type:"view",onClick:function(e){t("".concat(p.gA.GROUPS,"/").concat((0,w.LL)(e)))},disableButtonFunction:function(){return!Pe}}],Ie=U.filter((function(e){return e.includes(pe)})),Me=function(){le(!0),me(!0),te(!0)};return(0,i.useEffect)((function(){e((0,Z.Sc)("policy_details_summary"))}),[]),(0,j.jsxs)(i.Fragment,{children:[ge&&(0,j.jsx)(k,{deleteOpen:ge,selectedPolicy:Y,closeDeleteModalAndRefresh:function(e){ve(!1),t(p.gA.POLICIES)}}),(0,j.jsx)(P.Z,{label:(0,j.jsx)(i.Fragment,{children:(0,j.jsx)(s.hbI,{label:"Policy",onClick:function(){return t(p.gA.POLICIES)}})}),actions:(0,j.jsx)(D.Z,{})}),(0,j.jsxs)(s.Xgh,{children:[(0,j.jsx)(s.UHn,{icon:(0,j.jsx)(s.v42,{width:40}),title:Y,subTitle:(0,j.jsx)(i.Fragment,{children:"IAM Policy"}),actions:(0,j.jsxs)(i.Fragment,{children:[(0,j.jsx)(f.s,{scopes:[p.Ft.ADMIN_DELETE_POLICY],resource:p.C3,errorProps:{disabled:!0},children:(0,j.jsx)(E.Z,{tooltip:Fe?"":(0,p.MK)(p.bE,"delete Policies"),children:(0,j.jsx)(s.zxk,{id:"delete-policy",label:"Delete Policy",variant:"secondary",icon:(0,j.jsx)(s.XHJ,{}),onClick:function(){ve(!0)},disabled:!Fe})})}),(0,j.jsx)(E.Z,{tooltip:"Refresh",children:(0,j.jsx)(s.zxk,{id:"refresh-policy",label:"Refresh",variant:"regular",icon:(0,j.jsx)(s.DuK,{}),onClick:function(){Me()}})})]}),sx:{marginBottom:15}}),(0,j.jsx)(s.xuv,{children:(0,j.jsx)(s.mQc,{options:[{tabConfig:{label:"Summary",disabled:!ke,id:"summary"},content:(0,j.jsx)(i.Fragment,{children:(0,j.jsxs)(s.rjZ,{onMouseMove:function(){return e((0,Z.Sc)("policy_details_summary"))},children:[(0,j.jsx)(s.NZf,{separator:!0,sx:{marginBottom:15},children:"Policy Summary"}),(0,j.jsx)(s.xuv,{withBorders:!0,children:(0,j.jsx)(C,{policyStatements:_})})]})})},{tabConfig:{label:"Users",disabled:!Re||Se,id:"users"},content:(0,j.jsx)(i.Fragment,{children:(0,j.jsxs)(s.rjZ,{onMouseMove:function(){return e((0,Z.Sc)("policy_details_users"))},children:[(0,j.jsx)(s.NZf,{separator:!0,sx:{marginBottom:15},children:"Users"}),(0,j.jsxs)(s.rjZ,{container:!0,children:[A.length>0&&(0,j.jsx)(s.rjZ,{item:!0,xs:12,sx:(0,r.Z)((0,r.Z)({},l.OR.actionsTray),{},{marginBottom:15}),children:(0,j.jsx)(y.Z,{value:oe,placeholder:"Search Users",id:"search-resource",onChange:function(e){ie(e)}})}),(0,j.jsx)(s.wQF,{itemActions:Le,columns:[{label:"Name",elementKey:"name"}],isLoading:se,records:Ne,entityName:"Users with this Policy associated",idField:"name",customPaperHeight:"500px"})]})]})})},{tabConfig:{label:"Groups",disabled:!Ee||Se,id:"groups"},content:(0,j.jsx)(i.Fragment,{children:(0,j.jsxs)(s.rjZ,{onMouseMove:function(){return e((0,Z.Sc)("policy_details_groups"))},children:[(0,j.jsx)(s.NZf,{separator:!0,sx:{marginBottom:15},children:"Groups"}),(0,j.jsxs)(s.rjZ,{container:!0,children:[U.length>0&&(0,j.jsx)(s.rjZ,{item:!0,xs:12,sx:(0,r.Z)((0,r.Z)({},l.OR.actionsTray),{},{marginBottom:15}),children:(0,j.jsx)(y.Z,{value:oe,placeholder:"Search Groups",id:"search-resource",onChange:function(e){fe(e)}})}),(0,j.jsx)(s.wQF,{itemActions:Ae,columns:[{label:"Name",elementKey:"name"}],isLoading:xe,records:Ie,entityName:"Groups with this Policy associated",idField:"name",customPaperHeight:"500px"})]})]})})},{tabConfig:{label:"Raw Policy",disabled:!ke,id:"raw-policy"},content:(0,j.jsx)(i.Fragment,{children:(0,j.jsxs)(s.rjZ,{onMouseMove:function(){return e((0,Z.Sc)("policy_details_policy"))},children:[(0,j.jsx)(s.NZf,{separator:!0,sx:{marginBottom:15},children:"Raw Policy"}),(0,j.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:function(t){t.preventDefault(),W||(K(!0),_e?R.h.policies.addPolicy({name:Y,policy:Q}).then((function(t){K(!1),e((0,Z.y1)("Policy successfully updated")),Me()})).catch((function(t){K(!1),e((0,Z.Ih)({errorMessage:"There was an error updating the Policy ",detailedError:"There was an error updating the Policy: "+(t.error.detailedMessage||"")+". Please check Policy syntax."}))})):K(!1))},children:(0,j.jsxs)(s.rjZ,{container:!0,children:[(0,j.jsx)(s.rjZ,{item:!0,xs:12,children:(0,j.jsx)(d.Z,{value:Q,onChange:function(e){_e&&$(e)},editorHeight:"350px"})}),(0,j.jsxs)(s.rjZ,{item:!0,xs:12,sx:{display:"flex",justifyContent:"flex-end",paddingTop:16,gap:8},children:[!b&&(0,j.jsx)(s.zxk,{type:"button",variant:"regular",id:"clear-policy",onClick:function(){$("{}")},children:"Clear"}),(0,j.jsx)(f.s,{scopes:[p.Ft.ADMIN_CREATE_POLICY],resource:p.C3,errorProps:{disabled:!0},children:(0,j.jsx)(E.Z,{tooltip:_e?"":(0,p.MK)(p.XM,"edit a Policy"),children:(0,j.jsx)(s.zxk,{id:"save",type:"submit",variant:"callAction",color:"primary",disabled:W||!Te||!_e,label:"Save"})})})]}),W&&(0,j.jsx)(s.rjZ,{item:!0,xs:12,children:(0,j.jsx)(u.Z,{})})]})})]})})}],currentTabOrPath:Ze,onTabClick:function(e){return Oe(e)}})})]})]})}},76998:function(e,t,n){"use strict";var r=n(42458),o={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,i,c,a,s,l,u=!1;t||(t={}),n=t.debug||!1;try{if(c=r(),a=document.createRange(),s=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),a.selectNodeContents(l),s.addRange(a),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(d){n&&console.error("unable to copy using execCommand: ",d),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(d){n&&console.error("unable to copy using clipboardData: ",d),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{s&&("function"==typeof s.removeRange?s.removeRange(a):s.removeAllRanges()),l&&document.body.removeChild(l),c()}return u}},568:function(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=a(n(72791)),i=a(n(76998)),c=["text","onCopy","options","children"];function a(e){return e&&e.__esModule?e:{default:e}}function s(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?s(Object(n),!0).forEach((function(t){x(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function u(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 d(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 p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function f(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=y(e);if(t){var i=y(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 y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function x(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&&p(e,t)}(s,e);var t,n,r,a=f(s);function s(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return x(h(e=a.call.apply(a,[this].concat(n))),"onClick",(function(t){var n=e.props,r=n.text,c=n.onCopy,a=n.children,s=n.options,l=o.default.Children.only(a),u=(0,i.default)(r,s);c&&c(r,u),l&&l.props&&"function"===typeof l.props.onClick&&l.props.onClick(t)})),e}return t=s,(n=[{key:"render",value:function(){var e=this.props,t=(e.text,e.onCopy,e.options,e.children),n=u(e,c),r=o.default.Children.only(t);return o.default.cloneElement(r,l(l({},n),{},{onClick:this.onClick}))}}])&&d(t.prototype,n),r&&d(t,r),Object.defineProperty(t,"prototype",{writable:!1}),s}(o.default.PureComponent);t.CopyToClipboard=m,x(m,"defaultProps",{onCopy:void 0,options:void 0})},78029:function(e,t,n){"use strict";var r=n(568).CopyToClipboard;r.CopyToClipboard=r,e.exports=r},42458:function(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()}}}}]);
//# sourceMappingURL=1191.6a8f1e3d.chunk.js.map