1 line
5.0 KiB
JavaScript
1 line
5.0 KiB
JavaScript
"use strict";(self.webpackChunkmaingate_console=self.webpackChunkmaingate_console||[]).push([[348],{83348:function(e,n,r){r.r(n),r.d(n,{default:function(){return k}});var s=r(74165),c=r(1413),t=r(15861),i=r(70885),a=r(47313),o=r(27998),l=r(22370),u=r(33471),p=["512 512","<path fill='var(--ci-primary-color, currentColor)' d='M345.994,42.019,179.531,208.481A646.3,646.3,0,0,0,25.325,456.521a24.845,24.845,0,0,0,6,25.708l.087.087a24.84,24.84,0,0,0,17.611,7.342,25.172,25.172,0,0,0,8.1-1.344,646.283,646.283,0,0,0,248.04-154.207L471.62,167.646A88.831,88.831,0,0,0,345.994,42.019ZM282.531,311.48A614.445,614.445,0,0,1,60.419,453.221,614.435,614.435,0,0,1,202.158,231.108l99.162-99.161,80.372,80.372ZM448.993,145.019l-44.674,44.673L323.947,109.32l44.674-44.674a56.832,56.832,0,1,1,80.372,80.373Z' class='ci-primary'/>"],d=r(34491),h=(r(88282),r(86480)),x=r(58467),f=r(85554),v=r(21963),j=r(30657),m=r(62721),N=r(46417);function k(){var e=(0,x.s0)(),n=(0,f.I0)(),r=(0,f.v9)((function(e){return e.accessToken})),k=(0,v.Bw)(r),b=(0,j.Fp)(),Z=b.instance,g=b.accounts,C=(0,a.useState)(!1),S=(0,i.Z)(C,2),w=S[0],y=S[1],T=(0,a.useState)([]),A=(0,i.Z)(T,2),O=A[0],I=A[1];(0,a.useEffect)((function(){!function(){L.apply(this,arguments)}()}),[]);var B=function(n){return function(r){r.preventDefault(),e("/services/update?name=".concat(n.ServiceName))}};function D(){return E.apply(this,arguments)}function E(){return(E=(0,t.Z)((0,s.Z)().mark((function e(){var t;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!k){e.next=6;break}return e.next=3,Z.acquireTokenSilent((0,c.Z)((0,c.Z)({},m.Q),{},{account:g[0]}));case 3:return t=e.sent,n({type:"set",accessToken:t.accessToken}),e.abrupt("return",t.accessToken);case 6:return e.abrupt("return",r);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function L(){return(L=(0,t.Z)((0,s.Z)().mark((function e(){var n,r,t,i;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return y(!0),e.next=3,D();case 3:return n=e.sent,e.prev=4,e.next=7,h.ZP.get("".concat("","/api/service"),{headers:{Authorization:"Bearer ".concat(n)}});case 7:200===(r=e.sent).status?(t=[],Object.keys(r.data).forEach((function(e){t.push(r.data[e])})),i=[],r.headers&&r.headers["mg-x-service-editable"]&&(i=r.headers["mg-x-service-editable"].split(", ")),t=t.map((function(e){return(0,c.Z)((0,c.Z)({},e),{},{Editable:i.includes(e.ServiceName)})})),I(t)):d.Am.error("\uc11c\ube44\uc2a4 \uc870\ud68c\ub97c \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ".concat(r.statusText)),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),d.Am.error("\uc11c\ube44\uc2a4 \uc870\ud68c\ub97c \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ".concat(e.t0.message));case 14:y(!1);case 15:case"end":return e.stop()}}),e,null,[[4,11]])})))).apply(this,arguments)}return(0,N.jsxs)(o.rb,{children:[(0,N.jsx)(o.b7,{xs:12,children:(0,N.jsxs)(o.xH,{className:"mb-4",children:[(0,N.jsx)(o.bn,{children:(0,N.jsx)("strong",{children:"\uc11c\ube44\uc2a4 \ubaa9\ub85d"})}),(0,N.jsxs)(o.sl,{children:[(0,N.jsxs)(o.u5,{className:"mb-3",color:"info",onClick:function(){e("/services/add")},children:[(0,N.jsx)(l.Z,{icon:u.q,className:"me-2"}),"\ucd94\uac00"]}),(0,N.jsxs)(o.Sx,{striped:!0,hover:!0,children:[(0,N.jsx)(o.V,{children:(0,N.jsxs)(o.T6,{children:[(0,N.jsx)(o.is,{scope:"col",children:"ID"}),(0,N.jsx)(o.is,{scope:"col",children:"Service Name"}),(0,N.jsx)(o.is,{scope:"col",children:"Service Code"}),(0,N.jsx)(o.is,{scope:"col",children:"Use Whitelist"}),(0,N.jsx)(o.is,{scope:"col",children:"Closed"}),(0,N.jsx)(o.is,{scope:"col",children:"Server API Tokens"}),(0,N.jsx)(o.is,{scope:"col",children:"Action"})]})}),(0,N.jsxs)(o.NR,{children:[w&&(0,N.jsx)(o.LQ,{}),!w&&O&&O.map((function(e){return(0,N.jsxs)(o.T6,{children:[(0,N.jsx)(o.is,{scope:"row",children:e.Id}),(0,N.jsx)(o.NN,{children:e.ServiceName}),(0,N.jsx)(o.NN,{children:e.ServiceCode}),(0,N.jsx)(o.NN,{children:e.UseWhitelist?"Y":"N"}),(0,N.jsx)(o.NN,{children:e.Closed?"Y":"N"}),(0,N.jsx)(o.NN,{children:e.ServerApiTokens}),(0,N.jsx)(o.NN,{children:e.Editable&&(0,N.jsxs)(o.u5,{size:"sm",color:"success",onClick:B(e),children:[(0,N.jsx)(l.Z,{icon:p}),"\uc218\uc815"]})})]},e.Id)}))]})]})]})]})}),(0,N.jsx)(d.Ix,{position:"top-right",autoClose:5e3,hideProgressBar:!1,newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!1,draggable:!0,pauseOnHover:!0})]})}},33471:function(e,n,r){r.d(n,{q:function(){return s}});var s=["512 512","<polygon fill='var(--ci-primary-color, currentColor)' points='440 240 272 240 272 72 240 72 240 240 72 240 72 272 240 272 240 440 272 440 272 272 440 272 440 240' class='ci-primary'/>"]},21963:function(e,n,r){r.d(n,{Bw:function(){return c}});r(47313);function s(e){try{if(3!==e.split(".").length||"string"!==typeof e)return null;var n=e.split(".")[1],r="=".repeat((4-n.length%4)%4),s=n.replace("-","+").replace("_","/")+r,c=decodeURIComponent(window.atob(s).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""));return JSON.parse(c)}catch(t){return null}}function c(e){var n=s(e),r=!0;if(n&&n.exp){var c=new Date(0);c.setUTCSeconds(n.exp),r=c.valueOf()<(new Date).valueOf()}return r}}}]); |