dsql-admin/dsql-app/.local_dist/static/chunks/pages/su/console-46c6d0d0303e04b9.js
2024-11-05 12:12:42 +01:00

1 line
3.7 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1973],{71889:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/su/console",function(){return n(73794)}])},73794:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return m},default:function(){return h}});var l=n(85893),o=n(67294),s=n(85313),i=n(828),r=n(53920),a=n(47568),c=n(97582);function u(){return(u=(0,a.Z)((function(e){var t,l,o,s,i,r,a,u,d,f,m,h;return(0,c.__generator)(this,(function(c){return t=e.socket,l=n(12320).Terminal,o=n(12617).FitAddon,s=new o,i=document.getElementById("terminalWrapper"),r=document.getElementById("terminal"),a=i.clientWidth,u=Math.round(a/12),(d=new l({cols:u,rows:6})).open(r),s.fit(),t.on("console",(function(e){d.write(e)})),f=new o,m=document.getElementById("shell"),(h=new l({cols:u,rows:17})).open(m),f.fit(),t.on("shell",(function(e){h.write(e)})),h.onKey((function(e,n){t.emit("shell",e.key)})),[2,d]}))}))).apply(this,arguments)}var d=n(48531);function f(e){var t=e.socketDomain,n=(0,i.Z)(o.useState(null),2),s=n[0],a=n[1],c=(0,i.Z)(o.useState(null),2),f=c[0],m=c[1],h=(0,i.Z)(o.useState(""),2),x=(h[0],h[1]);return o.useEffect((function(){var e=t;if(console.log("Socket Domain =>",e),e){var n=(0,r.io)(e,{extraHeaders:{"X-Socket-Paradigm":"Console"}});n.on("connect",(function(){a(n),console.log("Socket Connected!")})),setInterval((function(){n.emit("get-log")}),1e3),n.on("console-log",(function(e){console.log("Fetched Log",e),x(e.replace((0,d.Z)(),"")),setTimeout((function(){var e=document.getElementById("logHistoryWrapper");e&&(e.scrollTop=e.scrollHeight)}),200)}))}}),[]),o.useEffect((function(){if(s)return function(e){return u.apply(this,arguments)}({socket:s}).then((function(e){m(e)})),function(){var e,t;null===(e=document.getElementById("terminal"))||void 0===e||e.childNodes.forEach((function(e){var t;null===(t=e.parentNode)||void 0===t||t.removeChild(e)})),null===(t=document.getElementById("shell"))||void 0===t||t.childNodes.forEach((function(e){var t;null===(t=e.parentNode)||void 0===t||t.removeChild(e)})),null===f||void 0===f||f.dispose()}}),[s]),(0,l.jsxs)(o.Fragment,{children:[(0,l.jsxs)("div",{className:"w-full justify-between",children:[(0,l.jsx)("h2",{className:"text-2xl m-0",children:"Console"}),(0,l.jsx)("button",{onClick:function(e){s&&s.emit("log","Logging to the console")},children:"Log console"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-6 w-full items-stretch",children:[(0,l.jsx)("section",{className:"paper bg-slate-900",id:"terminalWrapper",children:(0,l.jsx)("div",{className:"flex flex-col w-full gap-10 items-start justify-start terminal",children:(0,l.jsxs)("div",{className:"flex flex-col items-start w-full",children:[(0,l.jsx)("h2",{className:"m-0 text-white text-base",children:"Shell"}),(0,l.jsx)("hr",{className:"opacity-20"}),(0,l.jsx)("div",{id:"shell",className:"relative grow z-50 overflow-hidden w-full h-[340px]"})]})})}),(0,l.jsx)("section",{className:"paper bg-slate-500",id:"terminalWrapper",children:(0,l.jsx)("div",{className:"flex flex-col w-full gap-10 items-start justify-start terminal",children:(0,l.jsxs)("div",{className:"flex flex-col items-start w-full",children:[(0,l.jsx)("h2",{className:"m-0 text-white text-base",children:"Server Log"}),(0,l.jsx)("hr",{className:"opacity-20"}),(0,l.jsx)("div",{id:"terminal",className:"relative grow z-50 overflow-hidden w-full h-[150px]"})]})})})]})]})}n(56500);var m=!0;function h(e){var t=e.user,n=(e.data,e.socketDomain),o=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("title",{children:"Console | Datasquirel"}),(0,l.jsx)("meta",{name:"description",content:"Databases Console"})]});return(0,l.jsx)(s.Z,{head:o,user:t,children:(0,l.jsx)(f,{socketDomain:n})})}}},function(e){e.O(0,[6142,493,5313,9774,2888,179],(function(){return t=71889,e(e.s=t);var t}));var t=e.O();_N_E=t}]);