websoft9/cockpit/myapps/build/static/js/145.13333720.chunk.js
2023-06-03 17:08:03 +08:00

2 lines
44 KiB
JavaScript

"use strict";(self.webpackChunkapps=self.webpackChunkapps||[]).push([[145],{6239:function(e,n,a){a.r(n),a.d(n,{default:function(){return Ne}});var t=a(4165),r=a(5861),s=a(9439),i=a(1413),o=a(4358),l=a(3971),c=a(1694),d=a.n(c),u=a(7346),p=a.n(u),m=a(2791),h=a(2025),x=a(3360),f=a(2469),j=a(9743),g=a(2677),Z=a(42),v=a(7689),b=a(1087),y=a.p+"static/media/default.50b14dd03b88a6d9022a.png",N=a(5987),w=a(9410),k=a(5313),C=a(184),_=["label","type","name","value","readOnly","placeholder","register","errors","className","labelClassName","containerClass","refCallback","children"],S=function(e){var n=e.name,a=e.placeholder,t=e.refCallback,r=e.errors,o=e.register,l=e.className,c=e.value,u=e.readOnly,p=(0,m.useState)(!1),h=(0,s.Z)(p,2),x=h[0],f=h[1];return(0,C.jsx)(C.Fragment,{children:(0,C.jsxs)(w.Z,{className:"mb-0",children:[(0,C.jsx)(k.Z.Control,(0,i.Z)((0,i.Z)({type:x?"text":"password",placeholder:a,name:n,id:n,as:"input",ref:function(e){t&&t(e)},className:l,isInvalid:!(!r||!r[n])},o?o(n):{}),{},{autoComplete:n,defaultValue:c,readOnly:u})),(0,C.jsx)("div",{className:d()("input-group-text","input-group-password",{"show-password":x}),"data-password":x?"true":"false",children:(0,C.jsx)("span",{className:"password-eye",onClick:function(){f(!x)}})})]})})},E=function(e){var n=e.label,a=e.type,t=e.name,r=e.value,s=e.readOnly,o=e.placeholder,l=e.register,c=e.errors,d=e.className,u=e.labelClassName,p=e.containerClass,m=e.refCallback,h=e.children,x=(0,N.Z)(e,_),f="textarea"===a?"textarea":"select"===a?"select":"input";return(0,C.jsx)(C.Fragment,{children:"hidden"===a?(0,C.jsx)("input",(0,i.Z)((0,i.Z)({type:a,name:t},l?l(t):{}),x)):(0,C.jsx)(C.Fragment,{children:"password"===a?(0,C.jsx)(C.Fragment,{children:(0,C.jsxs)(k.Z.Group,{className:p,children:[n?(0,C.jsxs)(C.Fragment,{children:[" ",(0,C.jsx)(k.Z.Label,{className:u,children:n})," ",h," "]}):null,(0,C.jsx)(S,{name:t,placeholder:o,refCallback:m,errors:c,register:l,className:d,value:r,readOnly:s}),c&&c[t]?(0,C.jsx)(k.Z.Control.Feedback,{type:"invalid",className:"d-block",children:c[t].message}):null]})}):(0,C.jsx)(C.Fragment,{children:"select"===a?(0,C.jsx)(C.Fragment,{children:(0,C.jsxs)(k.Z.Group,{className:p,children:[n?(0,C.jsx)(k.Z.Label,{className:u,children:n}):null,(0,C.jsx)(k.Z.Select,(0,i.Z)((0,i.Z)((0,i.Z)({type:a,label:n,name:t,id:t,ref:function(e){m&&m(e)},comp:f,className:d,isInvalid:!(!c||!c[t])},l?l(t):{}),x),{},{children:h})),c&&c[t]?(0,C.jsx)(k.Z.Control.Feedback,{type:"invalid",children:c[t].message}):null]})}):(0,C.jsx)(C.Fragment,{children:"checkbox"===a||"radio"===a?(0,C.jsx)(C.Fragment,{children:(0,C.jsxs)(k.Z.Group,{className:p,children:[(0,C.jsx)(k.Z.Check,(0,i.Z)((0,i.Z)({type:a,label:n,name:t,id:t,ref:function(e){m&&m(e)},className:d,isInvalid:!(!c||!c[t])},l?l(t):{}),x)),c&&c[t]?(0,C.jsx)(k.Z.Control.Feedback,{type:"invalid",children:c[t].message}):null]})}):(0,C.jsxs)(k.Z.Group,{className:p,children:[n?(0,C.jsx)(k.Z.Label,{className:u,children:n}):null,(0,C.jsx)(k.Z.Control,(0,i.Z)((0,i.Z)((0,i.Z)({type:a,placeholder:o,value:r,name:t,id:t,as:f,ref:function(e){m&&m(e)},className:d,isInvalid:!(!c||!c[t])},l?l(t):{}),x),{},{autoComplete:t,children:h||null})),c&&c[t]?(0,C.jsx)(k.Z.Control.Feedback,{type:"invalid",children:c[t].message}):null]})})})})})},A=a(4942),D=function(e){var n=e.children||null,a=e.tag||"div",t=e.color||"secondary",r=e.size||"";return(0,C.jsx)(a,{role:"status",className:d()({"spinner-border":"bordered"===e.type,"spinner-grow":"grow"===e.type},["text-".concat(t)],(0,A.Z)({},"avatar-".concat(r),r),e.className),children:n})};D.defaultProps={tag:"div",type:"bordered"};var P,R=D,F=a(3144),I=a(5671),M=a(1243);function B(){return T.apply(this,arguments)}function T(){return(T=(0,r.Z)((0,t.Z)().mark((function e(){var n,a,r,s;return(0,t.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(P){e.next=10;break}return e.next=3,fetch("./config.json");case 3:return n=e.sent,e.next=6,n.json();case 6:a=e.sent,r=a.APPMANAGE.APPMANAGE_USERNAME,s=a.APPMANAGE.APPMANAGE_PASSWORD,P=btoa(r+":"+s);case 10:return e.abrupt("return",P);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}M.Z.defaults.headers.post["Content-Type"]="application/json",M.Z.defaults.headers.get["Content-Type"]="application/json",M.Z.defaults.headers.common["Cache-Control"]="no-cache",M.Z.defaults.headers.common.Pragma="no-cache",M.Z.defaults.headers.common.Expires="0",M.Z.interceptors.response.use((function(e){return e}),(function(e){var n;if(e&&e.response&&404===e.response.status)v.Fg;else{if(!e||!e.response||500!==e.response.status)return n=e.response&&e.response.data?e.response.data.message:e.message||e,Promise.reject(n);v.Fg}}));var H=(0,F.Z)((function e(){(0,I.Z)(this,e),this.get=function(){var e=(0,r.Z)((0,t.Z)().mark((function e(n,a){var r,s;return(0,t.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B();case 2:return e.t0=e.sent,M.Z.defaults.headers.common.Authorization="Basic "+e.t0,a?(s=a?Object.keys(a).map((function(e){return e+"="+a[e]})).join("&"):"",r=M.Z.get("".concat(n,"?").concat(s),a)):r=M.Z.get("".concat(n),a),e.abrupt("return",r);case 6:case"end":return e.stop()}}),e)})));return function(n,a){return e.apply(this,arguments)}}(),this.create=function(){var e=(0,r.Z)((0,t.Z)().mark((function e(n,a){return(0,t.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B();case 2:return e.t0=e.sent,M.Z.defaults.headers.common.Authorization="Basic "+e.t0,e.abrupt("return",M.Z.post(n,a));case 5:case"end":return e.stop()}}),e)})));return function(n,a){return e.apply(this,arguments)}}()})),O=new H;function z(e){return O.get("".concat("/AppManage/AppList"),e)}function U(e){return O.get("".concat("/AppManage/AppUninstall"),e)}function V(e){return O.get("".concat("/AppManage/AppStop"),e)}function W(e){return O.get("".concat("/AppManage/AppStart"),e)}function G(e){return O.get("".concat("/AppManage/AppRestart"),e)}function L(e){return O.get("".concat("/AppManage/AppDomainAdd"),e)}var $=a(7798),J=a(2576),K=a(1752),q=a(4533),Q=a(3433),X=a(1131),Y=a(1473),ee=a(3721),ne=a(5818),ae=a(1123),te=a(9627),re=a(5736),se=p().gettext,ie=m.forwardRef((function(e,n){return(0,C.jsx)(o.Z,(0,i.Z)({elevation:6,ref:n,variant:"filled"},e))})),oe=function(e){var n=(0,v.s0)(),a=(0,m.useState)(!1),i=(0,s.Z)(a,2),o=i[0],l=i[1],c=(0,m.useState)(!1),u=(0,s.Z)(c,2),p=u[0],j=u[1],g=(0,m.useState)(""),Z=(0,s.Z)(g,2),b=Z[0],y=Z[1];return(0,C.jsxs)(h.Z,{show:e.showConform,onHide:e.onClose,size:"lg",scrollable:"true",backdrop:"static",style:{backgroundColor:"rgba(0,0,0,0.8)"},children:[(0,C.jsx)(h.Z.Header,{onHide:e.onClose,className:d()("modal-colored-header","bg-warning"),children:(0,C.jsx)("h4",{children:se("Delete domain binding")})}),(0,C.jsxs)(h.Z.Body,{className:"row",children:[(0,C.jsxs)("span",{style:{margin:"10px 0px"},children:[se("Are you sure you want to delete the domain for:")," ",e.deleteRowData.domainValue," ? "]}),(0,C.jsx)("div",{children:p&&(0,C.jsx)(f.Z,{variant:"danger",className:"my-2",children:b})})]}),(0,C.jsxs)(h.Z.Footer,{children:[(0,C.jsx)(x.Z,{variant:"light",onClick:e.onClose,children:se("Close")})," ",(0,C.jsxs)(x.Z,{disabled:o,variant:"warning",onClick:(0,r.Z)((0,t.Z)().mark((function a(){var r;return(0,t.Z)().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,l(!0),a.next=4,t={app_id:e.deleteRowData.app_id,domain:e.deleteRowData.domainValue},O.get("".concat("/AppManage/AppDomainDelete"),t);case 4:(r=a.sent).data.Error?(j(!0),y(r.data.Error.Message)):(l(!1),e.onClose(),e.onDataChange()),a.next=11;break;case 8:a.prev=8,a.t0=a.catch(0),n("/error-500");case 11:return a.prev=11,l(!1),a.finish(11);case 14:case"end":return a.stop()}var t}),a,null,[[0,8,11,14]])}))),children:[o&&(0,C.jsx)(R,{className:"spinner-border-sm me-1",tag:"span",color:"white"})," ",se("Delete")]})]})]})},le=function(e){var n,a,i,o,c,d,u,p,h,f,Z,b,y,N,w,_,S,A,D,P,R,F,I,M,B,T,H,z,U,V=(0,v.s0)(),W=(0,m.useState)([]),G=(0,s.Z)(W,2),$=G[0],J=G[1],K=(0,m.useState)(!1),q=(0,s.Z)(K,2),le=q[0],ce=q[1],de=(0,m.useState)(!1),ue=(0,s.Z)(de,2),pe=ue[0],me=ue[1],he=(0,m.useState)(""),xe=(0,s.Z)(he,2),fe=xe[0],je=xe[1],ge=(0,m.useState)(""),Ze=(0,s.Z)(ge,2),ve=Ze[0],be=Ze[1],ye=(0,m.useState)(!1),Ne=(0,s.Z)(ye,2),we=Ne[0],ke=Ne[1],Ce=(0,m.useState)(null),_e=(0,s.Z)(Ce,2),Se=_e[0],Ee=_e[1],Ae=(0,m.useState)(""),De=(0,s.Z)(Ae,2),Pe=(De[0],De[1],m.useState(!0)),Re=(0,s.Z)(Pe,2),Fe=Re[0],Ie=Re[1],Me=m.useState(!0),Be=(0,s.Z)(Me,2),Te=Be[0],He=Be[1],Oe=m.useState(!1),ze=(0,s.Z)(Oe,2),Ue=ze[0],Ve=ze[1],We=function(){var n=(0,r.Z)((0,t.Z)().mark((function n(){var a,r,s,i;return(0,t.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,t={app_id:e.data.app_id},O.get("".concat("/AppManage/AppDomainList"),t);case 3:(a=n.sent).data.Error?(me(!0),be("error"),je(a.data.Error.Message)):(r=a.data.ResponseData.Domain_set,s=r.default_domain,(i=r.domains.map((function(n){return{app_id:e.data.app_id,domainValue:n,newDomainValue:n,isEditable:!1,isFromAPI:!0,isDefaultDomain:n===s}}))).sort((function(e,n){return n.isDefaultDomain-e.isDefaultDomain})),J(i)),n.next=10;break;case 7:n.prev=7,n.t0=n.catch(0),V("/error-500");case 10:case"end":return n.stop()}var t}),n,null,[[0,7]])})));return function(){return n.apply(this,arguments)}}();(0,m.useEffect)((function(){We()}),[]);var Ge=function(){var e=(0,r.Z)((0,t.Z)().mark((function e(n,a){var r;return(0,t.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n.isFromAPI?(ke(!0),Ee(n)):((r=(0,Q.Z)($)).splice(a,1),J(r));case 1:case"end":return e.stop()}}),e)})));return function(n,a){return e.apply(this,arguments)}}(),Le=function(){var n=(0,r.Z)((0,t.Z)().mark((function n(a){var r,s;return(0,t.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=$[a].newDomainValue,ce(!0),n.prev=2,n.next=5,t={app_id:e.data.app_id,domain:r},O.get("".concat("/AppManage/AppDomainSet"),t);case 5:(s=n.sent).data.Error?(me(!0),be("error"),je(s.data.Error.Message)):(me(!0),be("success"),je("\u8bbe\u7f6e\u6210\u529f!"),We()),n.next=12;break;case 9:n.prev=9,n.t0=n.catch(2),V("/error-500");case 12:return n.prev=12,ce(!1),n.finish(12);case 15:case"end":return n.stop()}var t}),n,null,[[2,9,12,15]])})));return function(e){return n.apply(this,arguments)}}(),$e=function(){var n=(0,r.Z)((0,t.Z)().mark((function n(a,r){var s,i,o,l,c,d;return(0,t.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(s=document.getElementsByName("domain-".concat(r))[0],i=s.value,o=/^(?!https?:\/\/)([\da-z\.-]+\.)*([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/,!i){n.next=49;break}if(!o.test(i)){n.next=44;break}if(!a.isFromAPI){n.next=28;break}if(a.domainValue==a.newDomainValue){n.next=23;break}return ce(!0),n.prev=8,n.next=11,t={app_id:e.data.app_id,domain_old:a.domainValue,domain_new:i},O.get("".concat("/AppManage/AppDomainUpdate"),t);case 11:(l=n.sent).data.Error?(me(!0),be("error"),je(l.data.Error.Message)):(me(!0),be("success"),je("Success"),We()),n.next=18;break;case 15:n.prev=15,n.t0=n.catch(8),V("/error-500");case 18:return n.prev=18,ce(!1),n.finish(18);case 21:n.next=26;break;case 23:(c=(0,Q.Z)($))[r].isEditable=!c[r].isEditable,J(c);case 26:n.next=42;break;case 28:return n.prev=28,ce(!0),n.next=32,L({app_id:e.data.app_id,domains:i});case 32:(d=n.sent).data.Error?(me(!0),be("error"),je(d.data.Error.Message)):(me(!0),be("success"),je("Success"),We()),n.next=39;break;case 36:n.prev=36,n.t1=n.catch(28),V("/error-500");case 39:return n.prev=39,ce(!1),n.finish(39);case 42:n.next=47;break;case 44:me(!0),be("error"),je(se("Please enter the correct domain name and cannot start with http or https!"));case 47:n.next=52;break;case 49:me(!0),be("error"),je(se("Domain name cannot be empty"));case 52:case"end":return n.stop()}var t}),n,null,[[8,15,18,21],[28,36,39,42]])})));return function(e,a){return n.apply(this,arguments)}}();var Je=function(e,n){"clickaway"!==n&&(me(!1),je(""))},Ke=(0,m.useState)(!1),qe=(0,s.Z)(Ke,2);qe[0],qe[1];return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(te.Z,{children:[le&&(0,C.jsx)("div",{className:"card-disabled",style:{zIndex:999},children:(0,C.jsx)("div",{className:"card-portlets-loader"})}),(0,C.jsxs)(te.Z.Body,{children:[(0,C.jsxs)(Y.Z,{defaultExpanded:!0,onChange:function(e,n){Ie(n)},className:"mb-2",children:[(0,C.jsx)(ne.Z,{expandIcon:(0,C.jsx)(X.Z,{}),"aria-controls":"panel1a-content",id:"panel1a-header",children:(0,C.jsxs)(ae.Z,{children:[(0,C.jsx)("label",{className:"me-2 fs-5 d-block",children:se("Domain Access")}),(0,C.jsxs)("span",{className:"me-2 fs-6",style:{display:Fe?"inline":"none"},children:[se("Domain access for better application performance. HTTPS and custom configurations available"),(0,C.jsx)("a",{href:"/nginx",target:"_parent",children:se("More")})]})]})}),(0,C.jsx)(ee.Z,{children:(0,C.jsx)(ae.Z,{children:(0,C.jsxs)(te.Z,{children:[(0,C.jsx)(te.Z.Header,{children:(0,C.jsx)(j.Z,{className:"mb-2 align-items-center",children:(0,C.jsxs)(g.Z,{xs:12,md:12,className:"d-flex justify-content-end",children:[(0,C.jsx)(x.Z,{variant:"primary",size:"sm",className:"me-2",onClick:function(){$.length<10&&J([].concat((0,Q.Z)($),[{app_id:e.data.app_id,domainValue:"",newDomainValue:"",isEditable:!0,isFromAPI:!1,isDefaultDomain:!1}]))},children:se("Add Domain")}),(null===(n=e.data)||void 0===n||null===(a=n.config)||void 0===a?void 0:a.admin_domain_url)&&(0,C.jsx)("a",{href:null===(i=e.data)||void 0===i||null===(o=i.config)||void 0===o?void 0:o.admin_domain_url,target:"_blank",className:"me-2",children:(0,C.jsx)(x.Z,{variant:"primary",size:"sm",children:se("Admin Page")})}),(0,C.jsxs)(x.Z,{size:"sm",className:"me-2",variant:"primary",onClick:(0,r.Z)((0,t.Z)().mark((function e(){return(0,t.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ce(!0),e.next=3,We();case 3:ce(!1);case 4:case"end":return e.stop()}}),e)}))),children:[" ",se("Refresh")]})]})})}),(0,C.jsx)(te.Z.Body,{children:$.map((function(e,n){return(0,C.jsx)(j.Z,{className:"mb-2",children:(0,C.jsxs)(g.Z,{xs:12,className:"d-flex justify-content-between",children:[(0,C.jsx)(g.Z,{children:(0,C.jsx)(E,{className:"mb-2 mb-md-0",type:"text",name:"domain-".concat(n),value:e.newDomainValue,disabled:!e.isEditable,onChange:function(e){return function(e,n){var a=(0,Q.Z)($);a[e].newDomainValue=n.target.value,J(a)}(n,e)}})}),(0,C.jsxs)(g.Z,{className:"col-auto ms-auto",children:[(0,C.jsx)(x.Z,{variant:"link text-danger",style:{padding:"5px"},onClick:function(){return Ge(e,n)},children:se("delete")}),e.isEditable&&e.isFromAPI&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(x.Z,{variant:"link text-success",style:{padding:"5px"},onClick:function(){return $e(e,n)},children:se("save")}),(0,C.jsx)(x.Z,{variant:"link text-success",style:{padding:"5px"},onClick:function(){return function(e){var n=(0,Q.Z)($);n[e].newDomainValue=n[e].domainValue,n[e].isEditable=!n[e].isEditable,J(n)}(n)},children:se("cancel")})]}),e.isEditable&&!e.isFromAPI&&(0,C.jsx)(x.Z,{variant:"link text-success",style:{padding:"5px"},onClick:function(){return $e(e,n)},children:se("save")}),!e.isEditable&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(x.Z,{variant:"link text-primary",style:{padding:"5px"},onClick:function(){return function(e){var n=(0,Q.Z)($);n[e].isEditable=!n[e].isEditable,J(n)}(n)},children:se("edit")}),(0,C.jsx)("a",{href:"http://"+e.domainValue,target:"_blank",children:(0,C.jsx)(x.Z,{variant:"link text-primary",style:{padding:"5px"},children:se("access")})}),e.isDefaultDomain?(0,C.jsxs)(re.Z,{className:"ms-2 bg-success",children:[" ",se("default")," "]}):(0,C.jsx)(x.Z,{variant:"link text-primary",onClick:function(){return Le(n)},children:se("set as default")})]})]})]})},n)}))})]})})})]}),(null===(c=e.data)||void 0===c||null===(d=c.config)||void 0===d?void 0:d.url)&&((null===(u=e.data)||void 0===u||null===(p=u.config)||void 0===p?void 0:p.default_domain)&&!(null!==(h=e.data)&&void 0!==h&&h.app_replace_url)||!(null!==(f=e.data)&&void 0!==f&&null!==(Z=f.config)&&void 0!==Z&&Z.default_domain))&&(0,C.jsxs)(Y.Z,{defaultExpanded:!0,onChange:function(e,n){He(n)},className:"mb-2",children:[(0,C.jsx)(ne.Z,{expandIcon:(0,C.jsx)(X.Z,{}),"aria-controls":"panel2a-content",id:"panel2a-header",children:(0,C.jsxs)(ae.Z,{children:[(0,C.jsx)("label",{className:"me-2 fs-5 d-block",children:"\u65e0\u57df\u540d\u8bbf\u95ee"}),(0,C.jsx)("span",{className:"me-2 fs-6",style:{display:Te?"inline":"none"},children:"\u6ca1\u6709\u57df\u540d\u53ef\u4ee5\u901a\u8fc7IP+\u7aef\u53e3\u7684\u65b9\u5f0f\u4e34\u65f6\u8bbf\u95ee\u5e94\u7528"})]})}),(0,C.jsx)(ee.Z,{children:(0,C.jsx)(ae.Z,{children:(0,C.jsx)(te.Z,{children:(0,C.jsxs)(te.Z.Body,{children:[(null===(b=e.data)||void 0===b||null===(y=b.config)||void 0===y?void 0:y.url)&&(0,C.jsxs)("div",{children:[(0,C.jsx)("label",{className:"me-2 fs-5",children:"\u524d\u53f0:"}),(0,C.jsx)("a",{href:null===(N=e.data)||void 0===N||null===(w=N.config)||void 0===w?void 0:w.url,target:"_blank",className:"me-2",children:null===(_=e.data)||void 0===_||null===(S=_.config)||void 0===S?void 0:S.url})]}),(null===(A=e.data)||void 0===A||null===(D=A.config)||void 0===D?void 0:D.admin_url)&&(0,C.jsxs)("div",{children:[(0,C.jsx)("label",{className:"me-2 fs-5",children:"\u540e\u53f0:"}),(0,C.jsx)("a",{href:null===(P=e.data)||void 0===P||null===(R=P.config)||void 0===R?void 0:R.admin_url,target:"_blank",className:"me-2",children:null===(F=e.data)||void 0===F||null===(I=F.config)||void 0===I?void 0:I.admin_url})]})]})})})})]}),(null===(M=e.data)||void 0===M||null===(B=M.config)||void 0===B?void 0:B.admin_username)&&(0,C.jsxs)(Y.Z,{className:"mb-2",onChange:function(e,n){Ve(n)},children:[(0,C.jsx)(ne.Z,{expandIcon:(0,C.jsx)(X.Z,{}),"aria-controls":"panel3a-content",id:"panel3a-header",children:(0,C.jsxs)(ae.Z,{children:[(0,C.jsx)("label",{className:"me-2 fs-5 d-block",children:"\u521d\u59cb\u8d26\u53f7"}),(0,C.jsx)("span",{className:"me-2 fs-6",style:{display:Ue?"inline":"none"},children:"\u6b64\u5e94\u7528\u7a0b\u5e8f\u662f\u4f7f\u7528\u7ba1\u7406\u5458\u5e10\u6237\u9884\u5148\u8bbe\u7f6e\u7684\uff0c\u8bf7\u7acb\u5373\u66f4\u6539\u7ba1\u7406\u5458\u5bc6\u7801\u3002\u521d\u59cb\u51ed\u636e\u4e3a\uff1a"})]})}),(0,C.jsx)(ee.Z,{children:(0,C.jsx)(ae.Z,{children:(0,C.jsx)(te.Z,{children:(0,C.jsxs)(te.Z.Body,{children:[(0,C.jsxs)(k.Z.Group,{as:j.Z,className:"mb-3",children:[(0,C.jsx)(k.Z.Label,{htmlFor:"username",column:!0,md:2,className:"fs-5",children:"UserName"}),(0,C.jsx)(g.Z,{md:4,children:(0,C.jsx)(k.Z.Control,{type:"text",name:"username",id:"username",defaultValue:null===(T=e.data)||void 0===T||null===(H=T.config)||void 0===H?void 0:H.admin_username,readOnly:!0})})]}),(0,C.jsxs)(k.Z.Group,{as:j.Z,className:"mb-3",children:[(0,C.jsx)(k.Z.Label,{htmlFor:"password",column:!0,md:2,className:"fs-5",children:"Password"}),(0,C.jsx)(g.Z,{md:4,children:(0,C.jsx)(E,{type:"password",name:"password",containerClass:"mb-3",value:null===(z=e.data)||void 0===z||null===(U=z.config)||void 0===U?void 0:U.admin_password,readOnly:!0})})]})]})})})})]})]})]}),we&&(0,C.jsx)(oe,{showConform:we,onClose:function(){ke(!1)},deleteRowData:Se,onDataChange:We}),pe&&(0,C.jsx)(l.Z,{open:pe,autoHideDuration:5e3,onClose:Je,anchorOrigin:{vertical:"top",horizontal:"center"},children:(0,C.jsx)(ie,{onClose:Je,severity:ve,sx:{width:"100%"},children:fe})})]})},ce=a(2591),de=p().gettext,ue=function(e){(0,v.s0)();var n=(0,m.useState)([]),a=(0,s.Z)(n,2),i=a[0],o=a[1],l=e.data.customer_name,c=(0,m.useState)(null),d=(0,s.Z)(c,2),u=d[0],p=d[1],h=function(){var e=(0,r.Z)((0,t.Z)().mark((function e(){var n,a,r,s,i,c,d,u,m,h,x,f;return(0,t.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=window.localStorage.getItem("portainer.JWT2"),a=null,null!==n){e.next=17;break}return e.next=6,M.Z.get("./config.json");case 6:if(200!==(r=e.sent).status){e.next=16;break}return s=r.data.PORTAINER,i=s.PORTAINER_USERNAME,c=s.PORTAINER_PASSWORD,d=s.PORTAINER_AUTH_URL,s.PORTAINER_HOME_PAGE,e.next=12,M.Z.post(d,{username:i,password:c});case 12:200===(u=e.sent).status?(n='"'+u.data.jwt+'"',window.localStorage.setItem("portainer.JWT2",n)):console.error("Error:",u),e.next=17;break;case 16:console.error("Error:",r);case 17:return e.next=19,M.Z.get("/portainer/api/endpoints",{headers:{Authorization:"Bearer "+n.replace(/"/g,"")}});case 19:if(200!==(m=e.sent).status){e.next=36;break}if(0!=m.data.length){e.next=28;break}return e.next=24,M.Z.post("/portainer/api/endpoints",{},{params:{Name:"websoft9-local",EndpointCreationType:1},headers:{Authorization:"Bearer "+n.replace(/"/g,"")}});case 24:200===(h=e.sent).status?(a=null===(x=h.data)||void 0===x?void 0:x.Id,p(a)):console.error("Error:",h),e.next=30;break;case 28:a=m.data.find((function(e){return e.URL.includes("/var/run/docker.sock")})).Id,p(a);case 30:return e.next=32,M.Z.get("/portainer/api/endpoints/".concat(a,"/docker/containers/json"),{headers:{Authorization:"Bearer "+n.replace(/"/g,"")},params:{all:!0,filters:JSON.stringify({label:["com.docker.compose.project=".concat(l)]})}});case 32:200===(f=e.sent).status?o(f.data):console.error("Error:",f),e.next=37;break;case 36:console.error("Error:",m);case 37:e.next=42;break;case 39:e.prev=39,e.t0=e.catch(0),console.error("Error:",e.t0);case 42:case"end":return e.stop()}}),e,null,[[0,39]])})));return function(){return e.apply(this,arguments)}}();return(0,m.useEffect)((function(){h()}),[]),(0,C.jsx)(j.Z,{children:(0,C.jsx)(g.Z,{xs:12,children:(0,C.jsxs)(te.Z,{children:[(0,C.jsx)(te.Z.Header,{children:(0,C.jsxs)(j.Z,{className:"align-items-center",children:[(0,C.jsxs)(g.Z,{xs:12,md:10,children:[(0,C.jsx)("label",{className:"me-2 fs-5 d-block",children:de("Container")}),(0,C.jsxs)("span",{className:"me-2 fs-6",children:["\u672c\u5e94\u7528\u7531\u5982\u4e0b\u5bb9\u5668\u7ec4\u6210\uff0c\u540d\u79f0\u4e3a ",l," \u7684\u4e3a\u4e3b\u5bb9\u5668 "]})]}),(0,C.jsx)(g.Z,{xs:12,md:2,children:(0,C.jsx)("a",{href:"/portainer/#!/".concat(u,"/docker/stacks/").concat(l,"?type=2&regular=false&external=true&orphaned=false"),target:"_blank",className:"me-2",children:(0,C.jsx)(x.Z,{variant:"primary",size:"sm",className:"float-end",children:de("More")})})})]})}),(0,C.jsx)(te.Z.Body,{children:(0,C.jsxs)(ce.Z,{className:"mb-0",children:[(0,C.jsx)("thead",{children:(0,C.jsxs)("tr",{children:[(0,C.jsx)("th",{children:"Name"}),(0,C.jsx)("th",{children:"State"}),(0,C.jsx)("th",{style:{textAlign:"center"},children:"Actions"}),(0,C.jsx)("th",{children:"Image"}),(0,C.jsx)("th",{children:"Created"}),(0,C.jsx)("th",{children:"Ip Address"}),(0,C.jsx)("th",{children:"Published Ports"})]})}),(0,C.jsx)("tbody",{children:i.map((function(e,n){var a,t,r,s;return(0,C.jsxs)("tr",{children:[(0,C.jsx)("td",{children:null===(a=e.Names)||void 0===a||null===(t=a[0])||void 0===t?void 0:t.replace(/^\/|\/$/g,"")}),(0,C.jsx)("td",{children:(0,C.jsx)(re.Z,{className:"".concat("running"===e.State?"bg-success":"exited"===e.State?"bg-danger":"info"),children:e.State})}),(0,C.jsxs)("td",{style:{textAlign:"center"},children:[(0,C.jsxs)("a",{href:"/portainer/#!/".concat(u,"/docker/containers/").concat(e.Id,"/logs"),target:"_blank",title:"Logs",children:[(0,C.jsx)("i",{className:"dripicons-document-remove noti-icon"})," "]}),"running"===e.State&&(0,C.jsxs)("a",{href:"/portainer/#!/".concat(u,"/docker/containers/").concat(e.Id,"/stats"),target:"_blank",title:"Stats",children:[(0,C.jsx)("i",{className:"dripicons-pulse noti-icon"})," "]})]}),(0,C.jsx)("td",{children:e.Image}),(0,C.jsx)("td",{children:new Date(1e3*e.Created).toLocaleString()}),(0,C.jsx)("td",{children:e.NetworkSettings.Networks[e.HostConfig.NetworkMode].IPAddress}),(0,C.jsxs)("td",{children:[null===(r=e.Ports.find((function(e){return e.IP&&/^(\d{1,3}\.){3}\d{1,3}$/.test(e.IP)})))||void 0===r?void 0:r.PublicPort,":",null===(s=e.Ports.find((function(e){return e.IP&&/^(\d{1,3}\.){3}\d{1,3}$/.test(e.IP)})))||void 0===s?void 0:s.PrivatePort]})]},n)}))})]})})]})})})},pe=p().gettext,me=function(e){var n,a,t,r,s,i,o;return(0,C.jsx)(j.Z,{children:(0,C.jsx)(g.Z,{xs:12,children:(0,C.jsxs)(te.Z,{children:[(0,C.jsx)(te.Z.Header,{children:(0,C.jsx)("label",{className:"me-2 fs-5 d-block",children:pe("App Overview")})}),(0,C.jsx)(te.Z.Body,{children:(0,C.jsx)(ce.Z,{responsive:!0,className:"mb-0",bordered:!1,style:{display:"flex"},children:(0,C.jsxs)("tbody",{children:[(0,C.jsxs)("tr",{children:[(0,C.jsxs)("td",{style:{fontWeight:"bold"},children:[pe("App Name"),":"]}),(0,C.jsx)("td",{children:null===(n=e.data)||void 0===n?void 0:n.app_name})]}),(0,C.jsxs)("tr",{children:[(0,C.jsxs)("td",{style:{fontWeight:"bold"},children:[pe("App Version"),":"]}),(0,C.jsx)("td",{children:null===(a=e.data)||void 0===a?void 0:a.app_version})]}),(0,C.jsxs)("tr",{children:[(0,C.jsxs)("td",{style:{fontWeight:"bold"},children:[pe("App Port"),":"]}),(0,C.jsx)("td",{children:null===(t=e.data)||void 0===t||null===(r=t.config)||void 0===r?void 0:r.port})]}),(0,C.jsxs)("tr",{children:[(0,C.jsxs)("td",{style:{fontWeight:"bold"},children:[pe("Created Time"),":"]}),(0,C.jsx)("td",{children:null===(s=e.data)||void 0===s?void 0:s.create_time})]}),(0,C.jsxs)("tr",{children:[(0,C.jsxs)("td",{style:{fontWeight:"bold"},children:[pe("Config Path"),":"]}),(0,C.jsx)("td",{children:null===(i=e.data)||void 0===i?void 0:i.config_path})]}),(0,C.jsxs)("tr",{children:[(0,C.jsxs)("td",{style:{fontWeight:"bold"},children:[pe("Data Path"),":"]}),(0,C.jsx)("td",{children:null===(o=e.data)||void 0===o?void 0:o.volume_data})]})]})})})]})})})},he=p().gettext,xe=function(e){var n=(0,v.s0)(),a=(0,m.useState)(!1),i=(0,s.Z)(a,2),o=i[0],l=i[1],c=(0,m.useState)(!1),u=(0,s.Z)(c,2),p=u[0],j=u[1],g=(0,m.useState)(""),Z=(0,s.Z)(g,2),b=Z[0],y=Z[1];return(0,C.jsxs)(h.Z,{show:e.showConform,onHide:e.onClose,size:"lg",scrollable:"true",backdrop:"static",style:{backgroundColor:"rgba(0,0,0,0.8)"},children:[(0,C.jsx)(h.Z.Header,{onHide:e.onClose,closeButton:!0,className:d()("modal-colored-header","bg-warning"),children:(0,C.jsxs)("h4",{children:[he("Uninstall")," ",e.app.customer_name]})}),(0,C.jsxs)(h.Z.Body,{className:"row",children:[(0,C.jsxs)("span",{style:{margin:"10px 0px"},children:[he("This will immediately uninstall")," ",e.app.customer_name," ",he("and remove all its data.")]}),(0,C.jsx)("div",{children:p&&(0,C.jsx)(f.Z,{variant:"danger",className:"my-2",children:b})})]}),(0,C.jsxs)(h.Z.Footer,{children:[(0,C.jsx)(x.Z,{variant:"light",onClick:e.onClose,children:he("Close")})," ",(0,C.jsxs)(x.Z,{disabled:o,variant:"warning",onClick:(0,r.Z)((0,t.Z)().mark((function a(){var r;return(0,t.Z)().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,l(!0),a.next=4,U({app_id:e.app.app_id});case 4:(r=a.sent).data.Error?(j(!0),y(r.data.Error.Message)):(e.onClose(),e.onCloseFatherModal(),e.onDataChange()),a.next=11;break;case 8:a.prev=8,a.t0=a.catch(0),n("/error-500");case 11:case"end":return a.stop()}}),a,null,[[0,8]])}))),children:[o&&(0,C.jsx)(R,{className:"spinner-border-sm me-1",tag:"span",color:"white"})," ",he("Uninstall")]})]})]})},fe=(0,m.forwardRef)((function(e,n){var a=(0,m.useState)(!1),i=(0,s.Z)(a,2),o=i[0],l=i[1],c=(0,m.useState)(!1),d=(0,s.Z)(c,2),u=d[0],p=d[1],h=(0,v.s0)(),f=function(){p(!0)},Z=function(){p(!1)};return(0,m.useImperativeHandle)(n,(function(){return{setButtonDisable:f,setButtonEnable:Z}})),(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(j.Z,{className:"mb-2",children:(0,C.jsxs)(g.Z,{sm:12,children:[(0,C.jsx)("label",{className:"me-1",style:{fontWeight:"bolder",marginBottom:"5px"},children:he("Start / Stop")}),(0,C.jsx)("p",{children:he("Apps can be stopped to conserve server resources instead of uninstalling.")}),"running"===e.data.status?(0,C.jsxs)(x.Z,{variant:"secondary",className:"float-end",disabled:u,onClick:(0,r.Z)((0,t.Z)().mark((function n(){return(0,t.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,e.disabledButton(),p(!0),n.next=5,V({app_id:e.data.app_id});case 5:n.sent.data.Error?h("/error"):e.onDataChange(e.data.app_id),n.next=12;break;case 9:n.prev=9,n.t0=n.catch(0),h("/error-500");case 12:return n.prev=12,p(!1),e.enableButton(),n.finish(12);case 16:case"end":return n.stop()}}),n,null,[[0,9,12,16]])}))),children:[u&&(0,C.jsx)(R,{className:"spinner-border-sm me-1",tag:"span",color:"white"})," ",he("Stop")]}):(0,C.jsxs)(x.Z,{variant:"primary",className:"float-end",disabled:u,onClick:(0,r.Z)((0,t.Z)().mark((function n(){return(0,t.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e.disabledButton(),p(!0),n.prev=2,n.next=5,W({app_id:e.data.app_id});case 5:n.sent.data.Error?h("/error"):e.onDataChange(e.data.app_id),n.next=12;break;case 9:n.prev=9,n.t0=n.catch(2),h("/error-500");case 12:return n.prev=12,e.enableButton(),p(!1),n.finish(12);case 16:case"end":return n.stop()}}),n,null,[[2,9,12,16]])}))),children:[u&&(0,C.jsx)(R,{className:"spinner-border-sm me-1",tag:"span",color:"white"})," ",he("Start")]})]})}),(0,C.jsx)("hr",{}),(0,C.jsx)(j.Z,{className:"mb-2",children:(0,C.jsxs)(g.Z,{sm:12,children:[(0,C.jsx)("label",{className:"me-1",style:{fontWeight:"bolder",marginBottom:"5px"},children:he("Uninstall")}),(0,C.jsx)("p",{children:he("This will uninstall the app immediately and remove all its data.The app will be inaccessible.")}),(0,C.jsx)(x.Z,{variant:"warning",className:"float-end",onClick:function(){l(!0)},children:he("Uninstall")})]})}),o&&(0,C.jsx)(xe,{showConform:o,onClose:function(){l(!1)},app:e.data,onDataChange:e.onDataChange,onCloseFatherModal:e.onCloseFatherModal})]})})),je=p().gettext,ge=function(e){var n=(0,m.useState)(!1),a=(0,s.Z)(n,2),i=a[0],o=a[1],l=(0,m.useState)(!1),c=(0,s.Z)(l,2),u=c[0],p=c[1],f=(0,m.useState)(e.current_app),Z=(0,s.Z)(f,2),N=Z[0],w=Z[1],k=(0,m.useState)(!1),_=(0,s.Z)(k,2),S=_[0],E=_[1],A=(0,m.useState)(!1),D=(0,s.Z)(A,2),P=D[0],F=D[1],I=(0,m.useState)(!1),M=(0,s.Z)(I,2),B=M[0],T=M[1],H=(0,v.s0)(),O=(0,m.useRef)(),z=function(){O.current.setButtonDisable()},U=function(){O.current.setButtonEnable()};(0,m.useEffect)((function(){w(e.current_app)}),[e.current_app]);var L=[{id:"1",title:je("Overview"),icon:"mdi dripicons-home",text:(0,C.jsx)(me,{data:N})},{id:"2",title:je("Access"),icon:"mdi dripicons-web",text:(0,C.jsx)(le,{data:N})},{id:"3",title:je("Container"),icon:"mdi dripicons-stack",text:(0,C.jsx)(ue,{data:N})},{id:"4",title:je("Uninstall"),icon:"mdi mdi-cog-outline",text:(0,C.jsx)(fe,{data:N,ref:O,disabledButton:function(){p(!0),o(!0)},enableButton:function(){p(!1),o(!1)},onDataChange:e.onDataChange,onCloseFatherModal:e.onClose})}];return N&&(0,C.jsxs)(h.Z,{show:e.showFlag,backdrop:"static",onHide:e.onClose,size:"lg",scrollable:"true",dialogClassName:"modal-full-width",children:[(0,C.jsx)(h.Z.Header,{onHide:e.onClose,closeButton:!0,children:(0,C.jsxs)("div",{style:{padding:"10px",display:"flex",width:"100%",alignItems:"center"},children:[(0,C.jsx)("div",{className:"appstore-item-content-icon col-same-height",children:(0,C.jsx)("img",{src:N.image_url,alt:"",className:"app-icon",onError:function(e){return e.target.src=y}})}),(0,C.jsxs)("div",{className:"col-same-height",children:[(0,C.jsx)("h4",{className:"appstore-item-content-title",style:{marginTop:"5px"},children:N.customer_name}),(0,C.jsx)("h5",{className:"appstore-item-content-title",style:{marginTop:"5px"},children:N.status})]}),(0,C.jsxs)("div",{className:"col-same-height",style:{flexGrow:1,display:"flex",justifyContent:"flex-end",alignItems:"center"},children:["exited"===N.status&&(0,C.jsx)($.Z,{placement:"bottom",overlay:(0,C.jsx)(J.Z,{id:"tooltip-bottom",children:je("Start App")}),children:(0,C.jsx)(x.Z,{variant:"primary",disabled:u,style:{padding:"5px 10px",borderRadius:"3px",marginRight:"10px"},onClick:(0,r.Z)((0,t.Z)().mark((function n(){return(0,t.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return z(),E(!0),o(!0),n.prev=3,n.next=6,W({app_id:N.app_id});case 6:n.sent.data.Error?H("/error"):e.onDataChange(),n.next=13;break;case 10:n.prev=10,n.t0=n.catch(3),H("/error-500");case 13:return n.prev=13,U(),E(!1),o(!1),n.finish(13);case 18:case"end":return n.stop()}}),n,null,[[3,10,13,18]])}))),children:S?(0,C.jsx)(R,{className:"spinner-border-sm noti-icon",color:"light"}):(0,C.jsx)("i",{className:"dripicons-media-play noti-icon"})})},"bottom1"),"running"===N.status&&(0,C.jsx)($.Z,{placement:"bottom",overlay:(0,C.jsx)(J.Z,{id:"tooltip-bottom",children:je("Stop App")}),children:(0,C.jsx)(x.Z,{variant:"primary",disabled:u,style:{padding:"5px 10px",borderRadius:"3px",marginRight:"10px"},onClick:(0,r.Z)((0,t.Z)().mark((function n(){return(0,t.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return z(),F(!0),o(!0),n.prev=3,n.next=6,V({app_id:N.app_id});case 6:n.sent.data.Error?H("/error"):e.onDataChange(),n.next=13;break;case 10:n.prev=10,n.t0=n.catch(3),H("/error-500");case 13:return n.prev=13,U(),F(!1),o(!1),n.finish(13);case 18:case"end":return n.stop()}}),n,null,[[3,10,13,18]])}))),children:P?(0,C.jsx)(R,{className:"spinner-border-sm noti-icon",color:"light"}):(0,C.jsx)("i",{className:"dripicons-power noti-icon"})})},"bottom2"),(0,C.jsx)($.Z,{placement:"bottom",overlay:(0,C.jsx)(J.Z,{id:"tooltip-bottom",children:je("Restart App")}),children:(0,C.jsx)(x.Z,{disabled:i,style:{padding:"5px 10px",borderRadius:"3px",marginRight:"10px"},onClick:(0,r.Z)((0,t.Z)().mark((function n(){return(0,t.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,z(),T(!0),p(!0),n.next=6,G({app_id:N.app_id});case 6:n.sent.data.Error?H("/error"):e.onDataChange(),n.next=13;break;case 10:n.prev=10,n.t0=n.catch(0),H("/error-500");case 13:return n.prev=13,U(),T(!1),p(!1),n.finish(13);case 18:case"end":return n.stop()}}),n,null,[[0,10,13,18]])}))),children:B?(0,C.jsx)(R,{className:"spinner-border-sm noti-icon",color:"light"}):(0,C.jsx)("i",{className:"dripicons-clockwise noti-icon"})})},"bottom3"),"running"===N.status&&(0,C.jsx)($.Z,{placement:"bottom",overlay:(0,C.jsx)(J.Z,{id:"tooltip-bottom",children:je("Terminal")}),children:(0,C.jsxs)(b.rU,{to:{pathname:"/terminal",search:"?id=".concat(N.customer_name)},style:{color:"#fff",backgroundColor:"#727cf5",padding:"5px 10px",borderRadius:"3px",borderColor:"#727cf5",marginRight:"10px"},target:"_blank",children:[(0,C.jsx)("i",{className:"dripicons-code noti-icon"})," "]})},"bottom4"),(0,C.jsx)($.Z,{placement:"bottom",overlay:(0,C.jsx)(J.Z,{id:"tooltip-bottom",children:je("Documentation")}),children:(0,C.jsxs)("a",{href:"https://support.websoft9.com/docs/"+N.app_name,style:{color:"#fff",backgroundColor:"#727cf5",padding:"5px 10px",borderRadius:"3px",borderColor:"#727cf5",marginRight:"10px"},target:"_blank",children:[(0,C.jsx)("i",{className:"dripicons-document noti-icon"})," "]})},"bottom5")]})]})}),(0,C.jsx)(h.Z.Body,{className:"row",children:(0,C.jsxs)(K.Z.Container,{defaultActiveKey:je("Overview"),children:[(0,C.jsx)(g.Z,{sm:2,className:"mb-2 mb-sm-0",children:(0,C.jsx)(q.Z,{variant:"pills",className:"flex-column",children:L.map((function(e,n){var a=function(){return(0,C.jsx)(q.Z.Item,{children:(0,C.jsxs)(q.Z.Link,{as:b.rU,to:"#",eventKey:e.title,children:[(0,C.jsx)("i",{className:d()(e.icon,"d-md-none","d-block","me-1")}),(0,C.jsx)("span",{className:"d-none d-md-block",children:e.title})]})},n)};return"Terminal"!==e.title||"running"===N.status?a():void 0}))})}),(0,C.jsx)(g.Z,{sm:10,children:(0,C.jsx)(K.Z.Content,{style:{height:"100%"},children:L.map((function(e,n){return(0,C.jsx)(K.Z.Pane,{eventKey:e.title,id:e.id,style:{height:"100%"},children:(0,C.jsx)(j.Z,{style:{height:"100%"},children:(0,C.jsx)(g.Z,{sm:"12",style:{height:"Terminal"===e.title?"600px":""},children:e.text})})},n)}))})})]})})]})},Ze=p().gettext,ve=m.forwardRef((function(e,n){return(0,C.jsx)(o.Z,(0,i.Z)({elevation:6,ref:n,variant:"filled"},e))})),be=function(e){return(0,C.jsxs)(h.Z,{show:e.showConform,onHide:e.onClose,size:"lg",scrollable:"true",backdrop:"static",children:[(0,C.jsx)(h.Z.Header,{onHide:e.onClose,closeButton:!0,className:d()("modal-colored-header","bg-danger"),children:(0,C.jsxs)("h4",{children:[Ze("This is the error message for")," ",e.app.customer_name]})}),(0,C.jsx)(h.Z.Body,{className:"row",children:e.app.status_reason&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)("span",{style:{margin:"10px 0px"},children:[" ",(0,C.jsx)("b",{children:Ze("Code: ")}),e.app.status_reason.Code," "]}),(0,C.jsxs)("span",{style:{margin:"10px 0px"},children:[" ",(0,C.jsx)("b",{children:Ze("Message: ")}),e.app.status_reason.Message," "]}),(0,C.jsxs)("span",{style:{margin:"10px 0px"},children:[" ",(0,C.jsx)("b",{children:Ze("Detail: ")}),e.app.status_reason.Detail," "]})]})}),(0,C.jsxs)(h.Z.Footer,{children:[(0,C.jsx)(x.Z,{variant:"light",onClick:e.onClose,children:Ze("Close")}),(0,C.jsx)(x.Z,{variant:"light",onClick:function(){return window.open("https://www.websoft9.com/ticket","_blank")},children:Ze("Support")})]})]})},ye=function(e){var n=(0,v.s0)(),a=(0,m.useState)(!1),i=(0,s.Z)(a,2),o=i[0],l=i[1],c=(0,m.useState)(!1),u=(0,s.Z)(c,2),p=u[0],j=u[1],g=(0,m.useState)(""),Z=(0,s.Z)(g,2),b=Z[0],y=Z[1];return(0,C.jsxs)(h.Z,{show:e.showConform,onHide:e.onClose,size:"lg",scrollable:"true",backdrop:"static",children:[(0,C.jsx)(h.Z.Header,{onHide:e.onClose,className:d()("modal-colored-header","bg-warning"),children:(0,C.jsxs)("h4",{children:[Ze("Remove")," ",e.app.customer_name]})}),(0,C.jsxs)(h.Z.Body,{className:"row",children:[(0,C.jsxs)("span",{style:{margin:"10px 0px"},children:[Ze("This will immediately remove")," ",e.app.customer_name," ",Ze("and remove all its data.")]}),(0,C.jsx)("div",{children:p&&(0,C.jsx)(f.Z,{variant:"danger",className:"my-2",children:b})})]}),(0,C.jsxs)(h.Z.Footer,{children:[(0,C.jsx)(x.Z,{variant:"light",onClick:e.onClose,children:Ze("Close")})," ",(0,C.jsxs)(x.Z,{disabled:o,variant:"warning",onClick:(0,r.Z)((0,t.Z)().mark((function a(){var r;return(0,t.Z)().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,l(!0),a.next=4,U({app_id:e.app.app_id});case 4:(r=a.sent).data.Error?(j(!0),y(r.data.Error.Message)):(e.onClose(),e.onDataChange()),a.next=11;break;case 8:a.prev=8,a.t0=a.catch(0),n("/error-500");case 11:case"end":return a.stop()}}),a,null,[[0,8]])}))),children:[o&&(0,C.jsx)(R,{className:"spinner-border-sm me-1",tag:"span",color:"white"})," ",Ze("Remove")]})]})]})},Ne=function(){var e,n=(0,m.useState)(!1),a=(0,s.Z)(n,2),i=a[0],o=a[1],c=(0,m.useState)(!1),u=(0,s.Z)(c,2),p=u[0],h=u[1],f=(0,m.useState)(!1),N=(0,s.Z)(f,2),w=N[0],k=N[1],_=(0,m.useState)(!1),S=(0,s.Z)(_,2),A=(S[0],S[1],(0,m.useState)(!1)),D=(0,s.Z)(A,2),P=D[0],F=D[1],I=(0,m.useState)(!1),M=(0,s.Z)(I,2),B=M[0],T=M[1],H=(0,m.useState)(""),O=(0,s.Z)(H,2),L=O[0],$=O[1],J=(0,m.useState)(""),K=(0,s.Z)(J,2),q=K[0],Q=K[1],X=(0,m.useState)(null),Y=(0,s.Z)(X,2),ee=Y[0],ne=Y[1],ae=(0,m.useState)([]),te=(0,s.Z)(ae,2),re=te[0],se=te[1],ie=(0,m.useState)([]),oe=(0,s.Z)(ie,2),le=(oe[0],oe[1],(0,m.useState)("")),ce=(0,s.Z)(le,2),de=ce[0],ue=ce[1],pe=(0,m.useState)("all"),me=(0,s.Z)(pe,2),he=me[0],xe=me[1],fe=(0,m.useState)([]),je=(0,s.Z)(fe,2),Ne=(je[0],je[1],(0,m.useRef)(ee)),we=(0,v.s0)(),ke=(0,m.useState)(0),Ce=(0,s.Z)(ke,2),_e=Ce[0],Se=Ce[1],Ee=(0,m.useState)(null),Ae=(0,s.Z)(Ee,2),De=Ae[0],Pe=Ae[1],Re=(0,m.useState)(null),Fe=(0,s.Z)(Re,2),Ie=(Fe[0],Fe[1]),Me=(0,m.useState)(!1),Be=(0,s.Z)(Me,2),Te=Be[0],He=Be[1],Oe=function(){z().then((function(e){if(e.data.Error)Se(e.data.Error.Code),Pe(e.data.Error.Message),Ie(e.data.Error.Details);else{var n=e.data.ResponseData;if(se(n),Ne.current){var a=n.find((function(e){return e.app_id===Ne.current.app_id}));ne(a)}}He(!1)})).catch((function(e){v.Fg}))};if((0,m.useEffect)((function(){Oe()}),[]),(0,m.useEffect)((function(){He(!0),e=setInterval((function(){z().then((function(e){if(e.data.Error)Se(e.data.Error.Code),Pe(e.data.Error.Message),Ie(e.data.Error.Details);else{var n=e.data.ResponseData;if(se(n),Ne.current){var a=n.find((function(e){return e.app_id===Ne.current.app_id}));ne(a)}}He(!1)})).catch((function(e){v.Fg}))}),5e3)}),[]),(0,m.useEffect)((function(){Ne.current=ee}),[ee]),(0,m.useEffect)((function(){return function(){return clearInterval(e)}}),[]),Te)return(0,C.jsx)(R,{className:"dis_mid"});if(_e)return(0,C.jsxs)("p",{children:["Code : $",_e," "]});if(De)return(0,C.jsxs)("p",{children:["Error : $",De," "]});var ze=function(e,n){"clickaway"!==n&&(T(!1),$(""))},Ue=function(){Oe()},Ve={Stop:{api:V},Start:{api:W},Restart:{api:G},Uninstall:{api:U}},We=function(){var e=(0,r.Z)((0,t.Z)().mark((function e(n,a){var r;return(0,t.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("Uninstall"!==n){e.next=4;break}return ne(a),h(!0),e.abrupt("return");case 4:return F(!0),e.prev=5,e.next=8,Ve[n].api({app_id:a.app_id});case 8:(r=e.sent).data.Error?(T(!0),Q("error"),$(r.data.Error.Message)):(T(!0),Q("success"),$("\u6267\u884c\u6210\u529f"),Ue()),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(5),we("/error-500");case 15:return e.prev=15,F(!1),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[5,12,15,18]])})));return function(n,a){return e.apply(this,arguments)}}();return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(j.Z,{className:"mb-2 align-items-center",children:[(0,C.jsx)(g.Z,{xs:12,sm:6,md:3,lg:2,children:(0,C.jsx)("span",{style:{fontSize:"28px"},children:Ze("My Apps")})}),(0,C.jsx)(g.Z,{xs:12,sm:6,md:3,lg:2,children:(0,C.jsxs)(E,{value:he,name:"select",type:"select",className:"form-select",onChange:function(e){return function(e){xe(e)}(e.target.value)},children:[(0,C.jsx)("option",{value:"all",children:Ze("All States")}),(0,C.jsx)("option",{value:"installing",children:"installing"}),(0,C.jsx)("option",{value:"running",children:"running"}),(0,C.jsx)("option",{value:"exited",children:"exited"}),(0,C.jsx)("option",{value:"restarting",children:"restarting"}),(0,C.jsx)("option",{value:"failed",children:"failed"})]},"select")}),(0,C.jsx)(g.Z,{xs:12,sm:12,md:6,lg:7,children:(0,C.jsx)(E,{type:"text",name:"search",placeholder:Ze("Search for apps like WordPress, Dropbox, Slack, Trello, \u2026"),onChange:function(e){return function(e){ue(e)}(e.target.value)}})}),(0,C.jsx)(g.Z,{xs:12,sm:12,md:12,lg:1,children:(0,C.jsx)(x.Z,{variant:"primary",className:"float-end",onClick:function(){window.location.reload(!1)},children:Ze("Refresh")})})]}),[!0,!1].map((function(e){var n=re.filter((function(e){return"all"===he||e.status===he})).filter((function(n){return n.official_app===e})).filter((function(e){return e.customer_name.includes(de)}));return n.length>0?(0,C.jsxs)(j.Z,{children:[(0,C.jsx)("h4",{style:e?{}:{paddingTop:"10px"},children:Ze(e?"Websoft9's Apps":"Other Apps")}),n.map((function(n,a){return(0,C.jsx)(g.Z,{xxl:2,md:3,className:"appstore-item",children:(0,C.jsxs)("div",{className:"appstore-item-content highlight text-align-center",children:[!e&&("running"===n.status||"exited"===n.status)&&(0,C.jsxs)(Z.Z,{className:"float-end",children:[(0,C.jsx)(Z.Z.Toggle,{as:b.rU,to:"#",className:"arrow-none card-drop",children:P?(0,C.jsx)(R,{className:"spinner-border-sm noti-icon"}):(0,C.jsx)("i",{className:"dripicons-gear noti-icon"})}),(0,C.jsx)(Z.Z.Menu,{align:"end",children:(t=n.status,[{label:"Stop",icon:"dripicons-power noti-icon",condition:"running"===t},{label:"Start",icon:"dripicons-media-play noti-icon",condition:"exited"===t},{label:"Restart",icon:"dripicons-clockwise noti-icon",condition:"running"===t||"exited"===t},{label:"Uninstall",icon:"dripicons-trash noti-icon",variant:"text-danger",hasDivider:!0,condition:!0}]||[]).map((function(e,a){return(0,C.jsxs)(m.Fragment,{children:[e.condition&&e.hasDivider&&(0,C.jsx)(Z.Z.Divider,{as:"div"}),e.condition&&(0,C.jsxs)(Z.Z.Item,{className:d()(e.variant?e.variant:""),onClick:function(){return We(e.label,n)},children:[e.icon&&(0,C.jsx)("i",{className:d()(e.icon,"me-1")}),e.label]})]},a)}))})]}),e&&("running"===n.status||"exited"===n.status)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("div",{className:"float-end arrow-none card-drop p-0",onClick:function(){!function(e){ne(e),o(!0)}(n)},children:(0,C.jsx)("i",{className:"dripicons-gear noti-icon"})}),(0,C.jsx)("div",{className:"clearfix"})]}),e&&"installing"===n.status&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("div",{className:"float-end arrow-none card-drop p-0",children:(0,C.jsx)("i",{className:"dripicons-empty noti-icon"})}),(0,C.jsx)("div",{className:"clearfix"})]}),"failed"===n.status&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)("div",{className:"float-end arrow-none card-drop p-0",children:[(0,C.jsx)("i",{className:"dripicons-information noti-icon",style:{paddingRight:"10px"},onClick:function(){!function(e){ne(e),k(!0)}(n)}}),(0,C.jsx)("i",{className:"dripicons-trash noti-icon",onClick:function(){!function(e){ne(e),h(!0)}(n)}})]}),(0,C.jsx)("div",{className:"clearfix"})]}),(0,C.jsx)("div",{children:(0,C.jsx)("img",{src:n.image_url,alt:n.app_name,className:"app-icon",style:{margin:"20px 10px 20px 10px"},onError:function(e){return e.target.src=y}})}),(0,C.jsxs)("div",{children:[(0,C.jsx)("h3",{className:"appstore-item-content-title",style:{color:"#2196f3"},children:n.customer_name}),(0,C.jsxs)("div",{style:{color:"failed"===n.status?"red":"inherit",display:"flex",alignItems:"center",justifyContent:"center"},children:[n.status&&"installing"===n.status&&(0,C.jsx)(R,{className:"spinner-border-sm m-2"})," ",(0,C.jsx)("div",{className:"m-2",children:n.status})]})]})]})},n.app_id+a);var t}))]}):null})),i&&(0,C.jsx)(ge,{current_app:ee,showFlag:i,onClose:function(){o(!1),ne(null)},onDataChange:Ue}),p&&(0,C.jsx)(ye,{showConform:p,onClose:function(){h(!1)},app:ee,onDataChange:Ue}),w&&(0,C.jsx)(be,{showConform:w,onClose:function(){k(!1)},app:ee}),B&&(0,C.jsx)(l.Z,{open:B,autoHideDuration:5e3,onClose:ze,anchorOrigin:{vertical:"top",horizontal:"center"},children:(0,C.jsx)(ve,{onClose:ze,severity:q,sx:{width:"100%"},children:L})})]})}}}]);
//# sourceMappingURL=145.13333720.chunk.js.map