harperdb 4.6.2 → 4.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/harperdb.js +32 -32
- package/bin/lite.js +30 -30
- package/launchServiceScripts/launchNatsIngestService.js +30 -30
- package/launchServiceScripts/launchNatsReplyService.js +30 -30
- package/launchServiceScripts/launchUpdateNodes4-0-0.js +30 -30
- package/npm-shrinkwrap.json +67 -67
- package/package.json +2 -2
- package/resources/Table.d.ts +1 -2
- package/server/Server.d.ts +5 -1
- package/server/jobs/jobProcess.js +30 -30
- package/server/threads/threadServer.js +30 -30
- package/utility/hdbTerms.d.ts +0 -1
- package/utility/scripts/restartHdb.js +30 -30
- package/studio/build-local/asset-manifest.json +0 -55
- package/studio/build-local/index.html +0 -1
- package/studio/build-local/static/css/main.34b26890.css +0 -13
- package/studio/build-local/static/js/164.a89f3fc2.chunk.js +0 -1
- package/studio/build-local/static/js/23.3b9f7144.chunk.js +0 -1
- package/studio/build-local/static/js/239.183c6cbc.chunk.js +0 -2
- package/studio/build-local/static/js/239.183c6cbc.chunk.js.LICENSE.txt +0 -5
- package/studio/build-local/static/js/279.7dfac9c5.chunk.js +0 -1
- package/studio/build-local/static/js/43.73dc432d.chunk.js +0 -2
- package/studio/build-local/static/js/43.73dc432d.chunk.js.LICENSE.txt +0 -1
- package/studio/build-local/static/js/545.046f5738.chunk.js +0 -1
- package/studio/build-local/static/js/759.7c5150cd.chunk.js +0 -2
- package/studio/build-local/static/js/759.7c5150cd.chunk.js.LICENSE.txt +0 -8
- package/studio/build-local/static/js/805.6aab06e2.chunk.js +0 -1
- package/studio/build-local/static/js/833.fbb1857f.chunk.js +0 -1
- package/studio/build-local/static/js/845.79392583.chunk.js +0 -2
- package/studio/build-local/static/js/845.79392583.chunk.js.LICENSE.txt +0 -5
- package/studio/build-local/static/js/851.4c6536d6.chunk.js +0 -1
- package/studio/build-local/static/js/860.727e7fc8.chunk.js +0 -1
- package/studio/build-local/static/js/browse-csvupload.2a02693a.chunk.js +0 -1
- package/studio/build-local/static/js/browse-datatable.6944e1d5.chunk.js +0 -1
- package/studio/build-local/static/js/browse-entitymanager.78d9f3cf.chunk.js +0 -1
- package/studio/build-local/static/js/browse-jsonviewer.b9b13d1d.chunk.js +0 -1
- package/studio/build-local/static/js/custom-functions.5e20728d.chunk.js +0 -1
- package/studio/build-local/static/js/instance-cluster.7fa04087.chunk.js +0 -1
- package/studio/build-local/static/js/instance-config.cab20f8e.chunk.js +0 -1
- package/studio/build-local/static/js/instance-logs.c590cea3.chunk.js +0 -1
- package/studio/build-local/static/js/instance-roles.02c01413.chunk.js +0 -1
- package/studio/build-local/static/js/instance-status.872064e6.chunk.js +0 -1
- package/studio/build-local/static/js/instance-users-datatable.eaa7f9f0.chunk.js +0 -1
- package/studio/build-local/static/js/instance-users-edit.b3009a22.chunk.js +0 -1
- package/studio/build-local/static/js/instance-users.d4c9a21b.chunk.js +0 -1
- package/studio/build-local/static/js/instance.ac2d8e63.chunk.js +0 -1
- package/studio/build-local/static/js/instances.e177eb54.chunk.js +0 -1
- package/studio/build-local/static/js/main.447848b8.js +0 -2
- package/studio/build-local/static/js/main.447848b8.js.LICENSE.txt +0 -39
- package/studio/build-local/static/js/offline-app.e75335f8.chunk.js +0 -1
- package/studio/build-local/static/js/online-app.161383cc.chunk.js +0 -1
- package/studio/build-local/static/js/organization-billing.8a6543c9.chunk.js +0 -1
- package/studio/build-local/static/js/organization-users.28a7fddd.chunk.js +0 -1
- package/studio/build-local/static/js/organization.7e6de94f.chunk.js +0 -1
- package/studio/build-local/static/js/organizations.a35fef39.chunk.js +0 -1
- package/studio/build-local/static/js/profile.ec638faf.chunk.js +0 -1
- package/studio/build-local/static/js/resetPassword.c64684e3.chunk.js +0 -1
- package/studio/build-local/static/js/roles-jsonviewer.28347efe.chunk.js +0 -1
- package/studio/build-local/static/js/signIn.95abea6a.chunk.js +0 -1
- package/studio/build-local/static/js/signUp.a095114b.chunk.js +0 -1
- package/studio/build-local/static/js/structure-reloader.89712250.chunk.js +0 -1
- package/studio/build-local/static/js/topnav.6ac108a6.chunk.js +0 -1
- package/studio/build-local/static/js/updatePassword.839328e6.chunk.js +0 -1
- package/studio/build-local/static/media/PPRadioGrotesk-Bold.31436818ea74a78b55af.woff +0 -0
- package/studio/build-local/static/media/checkmark.3d7d209874703a9cd0cc.svg +0 -3
- package/studio/build-local/static/media/logo_harper_db_studio.81490e70fa4af6879c2e.png +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[302],{4298:(e,t,n)=>{n.r(t),n.d(t,{default:()=>gt});var a=n(9950),s=n(6713),r=n(135),l=n(5269),o=n(7176),i=n(6114),c=n(4084),u=n(8156),d=n(4492),p=n(9435),m=n(5488),h=n(3452),f=n(9163),g=n.n(f);var x=n(127);const j=async e=>{let{auth:t,url:n}=e;return(0,x.A)({operation:{operation:"custom_functions_status"},auth:t,url:n,timeout:5e3})},v=async e=>{let{auth:t,url:n}=e;return(0,x.A)({operation:{operation:"get_custom_functions"},auth:t,url:n})};function b(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e&&e.entries){var s,r,l;if(t===n)e.path=n,e.key=null!==(s=null===(r=(l=crypto).randomUUID)||void 0===r?void 0:r.call(l))&&void 0!==s?s:Math.random().toString().slice(2);for(const s of e.entries){var o,i,c;const e=`${t}/${s.name}`,[,r]=e.split("/");s.project=r,s.path=e,s.key=null!==(o=null===(i=(c=crypto).randomUUID)||void 0===i?void 0:i.call(c))&&void 0!==o?o:Math.random().toString().slice(2),s.readOnly=a||!!s.package,b(s,e,n,s.readOnly)}}}const y=async e=>{let{auth:t,url:n}=e;const a=await(0,x.A)({operation:{operation:"get_components"},auth:t,url:n});return b(a,a.name,a.name,!1),a},N=async e=>{let{auth:t,url:n}=e;const{is_enabled:a,port:s,directory:r,error:o,message:i}=await j({auth:t,url:n}),c=await y({auth:t,url:n}),u={is_enabled:a,port:s,endpoints:a?await v({auth:t,url:n}):{},directory:r,error:o,message:i,fileTree:c};return l.A.update((e=>{e.custom_functions=u})),{custom_functions:u}};var A=n(4414);const k=function(){const e=(0,s.O$)(l.A,(e=>e.auth)),t=(0,s.O$)(l.A,(e=>e.url)),n=(0,s.O$)(l.A,(e=>e.is_local)),r=(0,s.O$)(l.A,(e=>{var t;return null===(t=e.custom_functions)||void 0===t?void 0:t.port})),[d,p]=(0,a.useState)({}),[f,j]=(0,a.useState)({port:r||9926});return g()((async()=>{const{submitted:n}=d;if(n){const{port:n}=f;if(n)if(a=n,Number.isNaN(parseFloat(a))||!Number.isFinite(parseFloat(a)))p({error:"port must be a valid number"});else{const a=await(async e=>{let{auth:t,url:n,port:a}=e;return(0,x.A)({operation:{operation:"configure_cluster",CUSTOM_FUNCTIONS_PORT:parseInt(a,10)},auth:t,url:n})})({auth:e,url:t,port:n});a.error?p({error:a.message}):N({auth:e,url:t})}else p({error:"All fields are required"})}var a}),[d]),g()((()=>{d.submitted||p({})}),[f]),n&&!r?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("div",{className:"text-nowrap mb-3",children:"Custom Functions Port"}),(0,A.jsx)(m.A,{id:"custom_api_port",onChange:e=>j({...f,port:e.target.value}),className:"mb-3 "+(d.error&&!f.port?"error":""),type:"number",title:"custom api port",placeholder:"9926",value:f.port}),(0,A.jsx)(h.A,{color:"success",block:!0,onClick:()=>p({submitted:!0}),children:"Set Custom API Port"}),!!d.error&&(0,A.jsx)(c.A,{className:"mt-3 error",children:(0,A.jsx)(u.A,{children:d.error})})]}):(0,A.jsxs)(o.A,{children:[(0,A.jsxs)(i.A,{xs:"10",children:["Custom Functions Port ",n?r:"Set"]}),(0,A.jsx)(i.A,{xs:"2",className:"text-end",children:(0,A.jsx)("i",{className:"fa fa-check-circle fa-lg text-success"})})]})};var C=n(4834),w=n(2010),_=n(6177);const S=function(e){let{setConfiguring:t}=e;const{compute_stack_id:n}=(0,d.g)(),r=(0,s.O$)(l.A,(e=>e.auth),[n]),o=(0,s.O$)(l.A,(e=>e.url),[n]),i=(0,s.O$)(l.A,(e=>{var t;return parseFloat(null===(t=e.registration)||void 0===t?void 0:t.version)>=4?"nats":"socketcluster"}),[n]),[c,u]=(0,a.useState)({});return g()((async()=>{if(c.submitted){if("nats"===i)await(0,C.A)({auth:r,url:o,customFunctions_enabled:!0});else{const e=await(0,_.A)({auth:r,url:o});await(0,C.A)({auth:r,url:o,operation:"configure_cluster",CUSTOM_FUNCTIONS:!0,CLUSTERING:Boolean(null===e||void 0===e?void 0:e.config_cluster_user),CLUSTERING_PORT:null===e||void 0===e?void 0:e.config_cluster_port,CLUSTERING_USER:null===e||void 0===e?void 0:e.config_cluster_user,NODE_NAME:null===e||void 0===e?void 0:e.nodeName})}window._kmq&&window._kmq.push(["record","enabled custom functions"]),(0,w.A)({auth:r,url:o}),setTimeout((()=>t(!0)),0)}}),[c.submitted]),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("hr",{className:"my-3"}),(0,A.jsx)(h.A,{color:"success",disabled:c.submitted,block:!0,onClick:()=>u({submitted:!0}),children:c.submitted?(0,A.jsx)("i",{className:"fa fa-spinner fa-spin text-white"}):"Enable Custom Functions"})]})};var F=n(6165),O=n(3150),P=n(3628);const $=function(e){let{setConfiguring:t}=e;const{compute_stack_id:n}=(0,d.g)(),a=(0,s.O$)(l.A,(e=>{var t;return null===(t=e.custom_functions)||void 0===t?void 0:t.port}),[n]);return(0,A.jsxs)(o.A,{id:"functions",children:[(0,A.jsxs)(i.A,{xl:"3",lg:"4",md:"5",xs:"12",children:[(0,A.jsx)("span",{className:"floating-card-header",children:"enable custom functions"}),(0,A.jsx)(c.A,{className:"my-3",children:(0,A.jsx)(u.A,{children:(0,A.jsxs)(p.tH,{onError:(e,t)=>(0,P.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:O.A,children:[(0,A.jsx)(k,{}),!!a&&(0,A.jsx)(S,{setConfiguring:t})]})})})]}),(0,A.jsx)(i.A,{xl:"9",lg:"8",md:"7",xs:"12",children:a?(0,A.jsx)(F.A,{headline:"Enable Custom Functions",description:"Click the button at left to enable Custom Functions. NOTE: We'll restart the instance when you click this button.",icon:(0,A.jsx)("i",{className:"fa fa-thumbs-up text-success"})}):(0,A.jsx)(F.A,{headline:"Set Your Custom Functions Server Port",description:"If your instance is behind a firewall, you'll need to ensure this port is accessible by other instances if you want to access the API.",icon:(0,A.jsx)("i",{className:"fa fa-thumbs-up text-success"})})})]})};var E=n(7348),D=n(5553);const I=async e=>{let{auth:t,url:n,project:a,file:s}=e;return(0,x.A)({operation:{operation:"get_component_file",project:a,file:s},auth:t,url:n})},T=async e=>{let{auth:t,url:n,project:a,file:s,payload:r}=e;return(0,x.A)({operation:{operation:"set_component_file",project:a,file:s,payload:r},auth:t,url:n})},R=async e=>{let{auth:t,url:n,project:a,file:s}=e;return(0,x.A)({operation:{operation:"drop_component",project:a,file:s},auth:t,url:n})},z=async e=>{let{auth:t,url:n,project:a,packageUrl:s,payload:r}=e;return r?(0,x.A)({auth:t,url:n,operation:{operation:"deploy_component",project:a,payload:r}}):(0,x.A)({auth:t,url:n,operation:{operation:"deploy_component",project:a,package:s}})};var U=n(1534),L=n(4319);const W=(0,n(6997).A)("editorCache");var M=n(8738),q=n.n(M);function H(){return(0,A.jsx)(c.A,{className:"file-browser-scroll-container",children:(0,A.jsx)(u.A,{children:(0,A.jsxs)("div",{className:"p-4",children:["You have no Harper applications yet. ",(0,A.jsx)("br",{}),(0,A.jsx)("br",{}),'Click "',(0,A.jsx)("i",{className:"fas fa-plus"}),' app" above to create one!',(0,A.jsx)("br",{}),(0,A.jsx)("br",{}),"See the"," ",(0,A.jsx)("a",{className:"docs-link",href:"https://docs.harperdb.io",target:"_blank",rel:"noreferrer",children:"documentation"})," ","for more info on Harper Applications."]})})})}function G(e,t){const n=+Boolean(e.entries),a=+Boolean(t.entries);return n===a?e.name.localeCompare(t.name):a-n}function B(){return(0,A.jsx)("i",{className:q()("package-icon fas fa-cube")})}function V(e){let{name:t,url:n,onPackageSelect:s,selectedPackage:r}=e;const[l,o]=(0,a.useState)(Boolean(r)&&t===(null===r||void 0===r?void 0:r.name));return(0,a.useEffect)((()=>{o(r&&r.name===t)}),[r,t]),(0,A.jsxs)("button",{type:"button",onClick:e=>{s(l?null:{name:t,url:n,event:e}),o(!l)},className:q()("package",{"package-selected":l}),onKeyDown:()=>{},children:[(0,A.jsx)(B,{}),(0,A.jsx)("span",{className:"package-text",children:t})]})}function K(e){let{directoryEntry:t,selectedFile:n,selectedFolder:a,onFileSelect:s,onFolderSelect:r,Icon:l}=e;const o=Boolean(t.entries);const i=t.path===n,c=t.path===(null===a||void 0===a?void 0:a.path);return(0,A.jsxs)("button",{type:"button",onClick:function(e){const n=e.target.classList.contains("rename-file")||e.target.classList.contains("deploy-project");o?c&&n||r(c?null:t):s(i?null:t)},className:q()("file",{"file-selected":i,"folder-selected":c}),onKeyDown:function(){},children:[(0,A.jsx)(l,{className:"filename-icon"}),(0,A.jsx)("span",{className:"filename-text",children:t.name})]})}function Z(e){let{directoryEntry:t,userOnSelect:n,onFolderSelect:s,onDeployProject:r,onFileSelect:l,onPackageSelect:o,onFileRename:i,selectedFile:c,selectedFolder:u,selectedPackage:d}=e;const[p,m]=(0,a.useState)(!0),h=[...t.entries||[]].sort(G),f=(g=t.name)&&[...g].includes(".")?g.split(".").slice(-1)[0]:null;var g;let x;return x=2===t.path.split("/").length?()=>function(e){let{toggleClosed:t,isOpen:n}=e;return(0,A.jsx)("i",{onClick:t,onKeyDown:t,className:q()("project-icon fas fa-file-code"),tabIndex:0,"aria-expanded":n,"aria-controls":"folder","aria-label":n?"close project":"open project",role:"button"})}({isOpen:p,toggleClosed:()=>m(!p)}):t.entries?()=>function(e){let{toggleClosed:t,isOpen:n}=e;return(0,A.jsx)("i",{onClick:t,onKeyDown:t,className:q()("folder-icon fas "+(n?"fa-folder-open":"fa-folder")),tabIndex:0,"aria-expanded":n,"aria-controls":"folder","aria-label":n?"close folder":"open folder",role:"button"})}({isOpen:p,toggleClosed:()=>m(!p)}):()=>function(e){let{extension:t}=e;switch(t){case"js":return(0,A.jsx)("i",{className:q()("file-icon filetype-js fab fa-js")});case"yaml":return(0,A.jsx)("i",{className:q()("file-icon filetype-yaml fas fa-cog")});default:return(0,A.jsx)("i",{className:q()("file-icon filetype-unknown far fa-file-alt")})}}({extension:f}),(0,A.jsxs)(A.Fragment,{children:["components"!==t.name?(0,A.jsx)("li",{className:q()(`${t.entries?"folder-container":"file-container"} ${p?"folder-open":"folder-closed"}`),children:t.package?(0,A.jsx)(V,{selectedPackage:d,onPackageSelect:o,name:t.name,url:t.package}):(0,A.jsx)(K,{Icon:x,selectedFile:c,selectedFolder:u,selectedPackage:d,directoryEntry:t,onDeployProject:r,onFileRename:()=>{i(t)},onFileSelect:l,onFolderSelect:s,userOnSelect:n})},t.key):null,h.map((e=>(0,A.jsx)("li",{children:(0,A.jsx)("ul",{className:q()("folder",{"folder-contents-open":!0,"folder-contents-closed":!1}),children:(0,A.jsx)(Z,{selectedFile:c,selectedFolder:u,selectedPackage:d,directoryEntry:e,onFileSelect:l,onDeployProject:r,onFileRename:i,onFolderSelect:s,onPackageSelect:o,userOnSelect:n})})},e.key)))]})}const Y=function(e){var t;let{files:n,userOnSelect:a,onFileSelect:s,onPackageSelect:r,onDeployProject:l,onFileRename:o,onFolderSelect:i,selectedFile:d,selectedFolder:p,selectedPackage:m}=e;return null!==n&&void 0!==n&&null!==(t=n.entries)&&void 0!==t&&t.length?(0,A.jsx)(c.A,{className:"file-browser-scroll-container",children:(0,A.jsx)(u.A,{children:(0,A.jsx)("ul",{className:"file-browser",children:(0,A.jsx)(Z,{selectedFile:d,selectedFolder:p,selectedPackage:m,onFileSelect:s,onFileRename:o,onFolderSelect:i,onDeployProject:l,onPackageSelect:r,userOnSelect:a,directoryEntry:n})})})}):(0,A.jsx)(H,{})};var J=n(5023);J.wG.init().then((e=>{e.editor.defineTheme("hdb",{base:"vs-dark",inherit:!0,rules:[],colors:{"editor.background":"#111111"}})}));const Q={js:"javascript",yaml:"yaml",ts:"typescript",json:"json",md:"markdown",html:"html",css:"css",graphql:"graphql",mjs:"javascript"};const X=function(e){let{active:t,file:n,onFileChange:s}=e;const[r,l]=(0,a.useState)("javascript");return(0,a.useEffect)((()=>{const e=function(e){var t;const n=null===(t=e||"")||void 0===t?void 0:t.split(".");return n.length>1?n.slice(-1)[0]:""}(null===n||void 0===n?void 0:n.name);l(Q[e]||"plaintext")}),[n]),t?(0,A.jsx)(J.Ay,{height:"100%",language:r,value:(null===n||void 0===n?void 0:n.content)||"",theme:"hdb",onChange:s,options:{readOnly:null===n||void 0===n?void 0:n.readOnly,automaticLayout:!0,minimap:{enabled:!1}}}):null};function ee(e){let{onClick:t,disabled:n=!1,text:a="",extraClasses:s=""}=e;return(0,A.jsxs)("button",{type:"button",disabled:n,onClick:t,className:s,title:"Create a new app",children:[(0,A.jsx)("i",{className:"fas fa-plus"}),a&&(0,A.jsxs)("span",{className:"ms-1",children:[" ",a]})]})}function te(e){let{onClick:t,disabled:n=!1,text:a="",extraClasses:s=""}=e;return(0,A.jsxs)("button",{type:"button",disabled:n,onClick:t,className:s,title:"Add a folder",children:[(0,A.jsx)("i",{className:"fas fa-plus"}),a&&(0,A.jsx)("span",{className:"ms-1 d-none d-lg-inline-block",children:a})]})}function ne(e){let{onClick:t,disabled:n=!1,text:a="",extraClasses:s=""}=e;return(0,A.jsxs)("button",{type:"button",onClick:t,disabled:n,className:s,title:"Delete selected app or folder",children:[(0,A.jsx)("i",{className:"fas fa-minus"}),a&&(0,A.jsx)("span",{className:"ms-1 d-none d-lg-inline-block",children:a})]})}function ae(e){let{onClick:t,disabled:n,text:a="",extraClasses:s=""}=e;return(0,A.jsxs)("button",{type:"button",disabled:n,onClick:t,className:s,title:"Add a new file",children:[(0,A.jsx)("i",{className:"fas fa-plus"}),a&&(0,A.jsxs)("span",{className:"ms-1 d-none d-lg-inline-block",children:[" ",a]})]})}function se(e){let{onClick:t,disabled:n,text:a="",extraClasses:s=""}=e;return(0,A.jsxs)("button",{type:"button",onClick:t,disabled:n,className:s,title:"Delete selected file",children:[(0,A.jsx)("i",{className:"fas fa-minus"}),a&&(0,A.jsxs)("span",{className:"ms-1 d-none d-lg-inline-block",children:[" ",a]})]})}const re=function(e){let{children:t}=e;return(0,A.jsx)("ul",{className:"file-menu text-nowrap",children:t.map((e=>{var t,n,a;return e&&(0,A.jsx)("li",{className:"file-menu-item",children:e},null!==(t=null===(n=(a=crypto).randomUUID)||void 0===n?void 0:n.call(a))&&void 0!==t?t:Math.random().toString().slice(2))}))})};function le(e){let{onClick:t,disabled:n=!1,text:a="",extraClasses:s=""}=e;return(0,A.jsxs)("button",{type:"button",disabled:n,onClick:t,className:s,title:"Import external component or application",children:[(0,A.jsx)("i",{className:"fas fa-share-alt"}),a&&(0,A.jsx)("span",{className:"ms-2 d-none d-lg-inline-block",children:a})]})}function oe(e){let{onClick:t,savingFile:n,disabled:a=!1,text:s="",extraClasses:r=""}=e;return(0,A.jsxs)("button",{type:"button",onClick:t,disabled:a,className:r,title:"save file to instance",children:[(0,A.jsx)("i",{className:q()("fas",{"fa-save":!n,"fa-spinner":n,"fa-spin":n})}),s&&(0,A.jsx)("span",{className:"ms-2 d-none d-lg-inline-block",children:s})]})}function ie(e){let{onClick:t,restarting:n,disabled:a=!1,text:s="",extraClasses:r=""}=e;return(0,A.jsxs)("button",{type:"button",onClick:t,disabled:a,className:r,title:"Click to restart your instance",children:[(0,A.jsx)("i",{className:q()("fas",{"fa-sync":!n,"fa-spinner":n,"fa-spin":n})}),s&&(0,A.jsx)("span",{className:"ms-2 d-none d-lg-inline-block",children:s})]})}function ce(e){let{onClick:t,restartAfterSave:n,disabled:a=!1,text:s="",extraClasses:r=""}=e;return(0,A.jsxs)("button",{type:"button",onClick:t,disabled:a,className:r,title:"Toggle whether saving a file restarts the application",children:[(0,A.jsx)("i",{className:q()("fa",{"fa-toggle-on":n,"fa-toggle-off":!n})}),s&&(0,A.jsx)("span",{className:"ms-2 d-none d-lg-inline-block",children:s})]})}function ue(e){let{onClick:t,disabled:n=!1,text:a="",extraClasses:s="",loading:r}=e;return(0,A.jsxs)("button",{type:"button",disabled:n,onClick:t,className:s,title:"revert file",children:[(0,A.jsx)("i",{className:q()("revert-file fas",{disabled:n,"fa-history":!r,"fa-spinner":r,"fa-spin":r})}),a&&(0,A.jsx)("span",{className:"ms-2 d-none d-lg-inline-block",children:a})]})}function de(e){let{children:t}=e;return(0,A.jsx)("ul",{className:"editor-menu",children:t.map((e=>{var t,n,a;return e&&(0,A.jsx)("li",{className:"editor-menu-item",children:e},null!==(t=null===(n=(a=crypto).randomUUID)||void 0===n?void 0:n.call(a))&&void 0!==t?t:Math.random().toString().slice(2))}))})}function pe(e){let{active:t,AddProjectButtonClick:n,InstallPackageButtonClick:a}=e;return t?(0,A.jsxs)("div",{className:"content-window",children:[(0,A.jsx)("h4",{className:"mb-5",children:"Add A New Application"}),(0,A.jsx)(ee,{text:"Create A New Application Using The Default Template",extraClasses:"btn btn-block btn-success",onClick:n}),(0,A.jsx)(le,{text:"Import Or Deploy A Remote Application Package",extraClasses:"btn btn-block btn-outline-success mt-2",onClick:a})]}):null}function me(e){let{active:t,type:n}=e;return t?(0,A.jsxs)("div",{className:"content-window text-nowrap",children:[(0,A.jsx)("i",{className:"fa fa-exclamation-triangle mt-5 pt-5"}),"\xa0",(0,A.jsxs)("span",{children:["You have selected a ",n,". Nothing to see here!"]})]}):null}var he=n(6359);function fe(e){return/^[a-zA-Z0-9-_]+$/.test(e)}function ge(e){if(!e)return null;const t={type:null,user:null,repo:null,url:null,package:null,tag:null};if(e.url.match("://"))t.url=e.url,t.type="url";else if(e.url.match("semver:")){const[n,a,s]=e.url.split(/[/#]/);t.type="github",t.user=n,t.repo=a,t.tag=s.replace("semver:","")}else{t.type="npm";const n=e.url.split("/");if(1===n.length){const[e,a]=n[0].split("@");t.package=e,t.tag=a}else if(2===n.length){const[,e]=n,[a,s]=e.split("@");t.package=a,t.tag=s}}return t}function xe(e,t,n){var s=this,r=(0,a.useRef)(null),l=(0,a.useRef)(0),o=(0,a.useRef)(null),i=(0,a.useRef)([]),c=(0,a.useRef)(),u=(0,a.useRef)(),d=(0,a.useRef)(e),p=(0,a.useRef)(!0);d.current=e;var m="undefined"!=typeof window,h=!t&&0!==t&&m;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var f=!!(n=n||{}).leading,g=!("trailing"in n)||!!n.trailing,x="maxWait"in n,j="debounceOnServer"in n&&!!n.debounceOnServer,v=x?Math.max(+n.maxWait||0,t):null;(0,a.useEffect)((function(){return p.current=!0,function(){p.current=!1}}),[]);var b=(0,a.useMemo)((function(){var e=function(e){var t=i.current,n=c.current;return i.current=c.current=null,l.current=e,u.current=d.current.apply(n,t)},n=function(e,t){h&&cancelAnimationFrame(o.current),o.current=h?requestAnimationFrame(e):setTimeout(e,t)},a=function(e){if(!p.current)return!1;var n=e-r.current;return!r.current||n>=t||n<0||x&&e-l.current>=v},b=function(t){return o.current=null,g&&i.current?e(t):(i.current=c.current=null,u.current)},y=function e(){var s=Date.now();if(a(s))return b(s);if(p.current){var o=t-(s-r.current),i=x?Math.min(o,v-(s-l.current)):o;n(e,i)}},N=function(){if(m||j){var d=Date.now(),h=a(d);if(i.current=[].slice.call(arguments),c.current=s,r.current=d,h){if(!o.current&&p.current)return l.current=r.current,n(y,t),f?e(r.current):u.current;if(x)return n(y,t),e(r.current)}return o.current||n(y,t),u.current}};return N.cancel=function(){o.current&&(h?cancelAnimationFrame(o.current):clearTimeout(o.current)),l.current=0,i.current=r.current=c.current=o.current=null},N.isPending=function(){return!!o.current},N.flush=function(){return o.current?b(Date.now()):u.current},N}),[f,x,t,v,g,h,m,j]);return b}function je(e,t){return e===t}function ve(e,t,n){var s=n&&n.equalityFn||je,r=(0,a.useRef)(e),l=(0,a.useState)({})[1],o=xe((0,a.useCallback)((function(e){r.current=e,l({})}),[l]),t,n),i=(0,a.useRef)(e);return s(i.current,e)||(o(e),i.current=e),[r.current,o]}function be(e){let{pkg:t,setPackageSpec:n}=e;const[s,r]=(0,a.useState)((null===t||void 0===t?void 0:t.user)||""),[l]=ve(s,300),[o,i]=(0,a.useState)((null===t||void 0===t?void 0:t.repo)||""),[c]=ve(o,300),[u,d]=(0,a.useState)([]),[p,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)((null===t||void 0===t?void 0:t.tag)||""),[x,j]=(0,a.useState)(""),[,v]=(0,a.useState)(!1),[b,y]=(0,a.useState)(!1);return(0,a.useEffect)((()=>{r((null===t||void 0===t?void 0:t.user)||""),i((null===t||void 0===t?void 0:t.repo)||""),d(null!==t&&void 0!==t&&t.tag?[null===t||void 0===t?void 0:t.tag]:[]),g((null===t||void 0===t?void 0:t.tag)||"")}),[t]),(0,a.useEffect)((()=>{l&&c?(v(!0),async function(e,t){try{const n=await fetch(`https://api.github.com/repos/${e}/${t}`),a=await n.json();return n.status<400?a.name:null}catch(n){return null}}(s,c).then((e=>{e?(j(e),y(!0),async function(e,t){const n=await fetch(`https://api.github.com/repos/${e}/${t}/git/refs/tags`);if(n.status<400)return(await n.json()).map((e=>e.ref.split("/").slice(-1)[0]));return[]}(s,c).then((e=>{v(!1),h(!0),d(e)}))):(v(!1),y(!1),j(""),d([]))})).catch((()=>{v(!1)}))):(y(!1),v(!1),d([]),g(""))}),[l,c,s]),(0,a.useEffect)((()=>{if(s&&o&&x){n(f?`${s}/${o}#semver:${f}`:`${s}/${o}`)}else n("")}),[x,f,s,n,o]),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(m.A,{title:"Github Organization",className:"mt-2 form-control",valid:l.length>0&&c.length>0&&b,placeholder:"Github Organization",onChange:e=>r(e.target.value),value:s}),(0,A.jsx)(m.A,{title:"Github Repo",className:"mt-2",placeholder:"Github Repo",onChange:e=>i(e.target.value),value:o}),(null===u||void 0===u?void 0:u.length)>0&&(0,A.jsx)(he.Ay,{className:"react-select-container github-tag-select mt-2",classNamePrefix:"react-select",isDisabled:!x,isSearchable:!0,placeholder:"Choose a tag",onChange:e=>g(e.value),options:u.map((e=>({label:e,value:e})))})]})}function ye(e){let{pkg:t,setPackageSpec:n}=e;const[s,r]=(0,a.useState)(""),[l]=ve(s,300),[o,i]=(0,a.useState)(""),[c,u]=(0,a.useState)(""),[d,p]=(0,a.useState)(""),[m,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)(!1);return(0,a.useEffect)((()=>{r((null===t||void 0===t?void 0:t.package)||"")}),[t]),(0,a.useEffect)((function(){if(d){n(c?`${d}@${c}`:d)}else n("")}),[d,c,n]),(0,a.useEffect)((function(){l?(h(!0),async function(e){var t;const n=await fetch(`https://registry.npmjs.org/-/v1/search?text=${e}`),a=(await n.json()).objects.find((t=>t.package.name===e));return null===a||void 0===a||null===(t=a.package)||void 0===t?void 0:t.name}(l).then((e=>{h(!1),g(!!e),p(e),e&&async function(e){const t=await fetch(`https://registry.npmjs.org/${e}`);return(await t.json())["dist-tags"]}(e).then((e=>{i(e),u(null)})).catch((e=>{throw e}))})).catch((()=>{h(!1)}))):(p(null),i(null),u(null))}),[l]),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"input-group",children:[(0,A.jsx)("input",{className:"mt-2 form-control",title:"enter an npm package specifier",value:s,placeholder:"Enter the [@scope]/package",onChange:function(e){r(e.target.value)}}),(0,A.jsx)("div",{className:"input-group-append",children:(0,A.jsx)("i",{className:q()("input-group-text fa mt-2",{"fa-spinner fa-spin loading":m,"fa-check found":l.length>0&&f,"fa-times not-found":l.length>0&&!(m||f),"fa-check not-searching":0===l.length})})})]}),(0,A.jsx)(he.Ay,{className:"react-select-container mt-2",classNamePrefix:"react-select",isDisabled:!s,placeholder:"Choose a tag",disabled:!o,onChange:function(e){let{value:t}=e;u(t)},options:Object.entries(o||[]).map((e=>{let[t,n]=e;return{label:`${t} (${n})`,value:t}}))})]})}function Ne(e){return function(e){try{return Boolean(new URL(e))}catch(t){return!1}}(e)&&(-1!==e.indexOf(".tar")||-1!==e.indexOf(".tar.gz")||-1!==e.indexOf(".tgz"))}function Ae(e){let{pkg:t,setPackageSpec:n}=e;const[s,r]=(0,a.useState)((null===t||void 0===t?void 0:t.url)||""),[l,o]=(0,a.useState)(Ne(null===t||void 0===t?void 0:t.url));return(0,a.useEffect)((()=>{n(l?s:"")}),[s,l,n]),(0,A.jsx)(m.A,{type:"text",id:"tarball-url",title:"URL to gzipped tarball",className:q()("package-url-input mt-2",{invalid:!l}),value:s,onChange:e=>{o(0===e.target.value.length||Ne(e.target.value)),r(e.target.value)},placeholder:"URL to gzipped tarball"})}var ke=n(5996);function Ce(e){let{selectedPackage:t,onConfirm:n,onCancel:r,deployTargets:o,active:i}=e;const c=!1,[u,d]=(0,a.useState)(Boolean(t)),[p,f]=(0,a.useState)(ge(t)),[g,x]=(0,a.useState)((null===p||void 0===p?void 0:p.type)||c),[j,v]=(0,a.useState)((null===t||void 0===t?void 0:t.name)||""),[b,y]=(0,a.useState)(!0),[N,k]=(0,a.useState)(""),[C,w]=(0,a.useState)(!1),_=(0,s.O$)(l.A,(e=>e.auth)),S=(0,s.O$)(l.A,(e=>e.url)),[F,O]=(0,a.useState)([{isCurrentInstance:!0,auth:_,instance:{url:S,instance_name:"This Instance"}}]);function P(){v(""),y(!1),x(!1),O([]),r()}return(0,a.useEffect)((function(){const e=ge(t);v((null===t||void 0===t?void 0:t.name)||""),f(ge(t)),x((null===e||void 0===e?void 0:e.type)||c),d(Boolean(t))}),[t,c]),(0,a.useEffect)((function(){y(fe(j))}),[j]),i?(0,A.jsxs)("div",{className:"content-window",children:[(0,A.jsx)("h4",{className:"mb-5",children:"Import Remote App Package"}),(0,A.jsx)(m.A,{valid:b&&j.length>0,title:"enter a name for this package",value:j,placeholder:"Application Name",onChange:e=>{v(e.target.value),y(fe(e.target.value))}}),!ke.A.is_local_studio&&(0,A.jsx)(he.Ay,{className:"react-select-container package-install-deploy-targets-dropdown mt-2",classNamePrefix:"react-select",isSearchable:!0,isMulti:!0,placeholder:"Choose your deploy targets",onChange:e=>{const t=e.map((e=>e.value)),n=o.filter((e=>t.includes(e.instance.url)));O(n)},options:o.map((e=>({label:e.instance.instance_name,value:e.instance.url})))}),(0,A.jsx)(he.Ay,{className:"react-select-container mt-2",classNamePrefix:"react-select",placeholder:"How would you like to fetch this package?",onChange:function(e){let{value:t}=e;x(t)},options:[{label:"A Public GitHub Repo",value:"github"},{label:"Install a gzipped .tar file from a URL",value:"url"}]}),!b&&j.length>0&&(0,A.jsxs)("span",{className:"text-danger text-center mt-3",children:[(0,A.jsx)("i",{className:"fa fa-exclamation-triangle"}),(0,A.jsx)("br",{}),(0,A.jsx)("span",{className:"mt-2",children:"Project name limited to alphanumeric, dashes, & underscores."})]}),b&&F.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("div",{className:"mt-2"}),"npm"===g&&(0,A.jsx)(ye,{projectName:j,installed:u,pkg:p,setPackageSpec:k}),"github"===g&&(0,A.jsx)(be,{projectName:j,installed:u,pkg:p,setPackageSpec:k}),"url"===g&&(0,A.jsx)(Ae,{projectName:j,installed:u,pkg:p,setPackageSpec:k})]}),b&&F.length>0&&g?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(h.A,{onClick:async()=>{w(!0);try{await n(j,N,F)}catch(e){w(!1)}w(!1)},className:q()("btn btn-block btn-success mt-3",{loading:C}),disabled:!fe(j)||!N||!F.length,children:C?(0,A.jsx)("i",{className:"install-package-status-icon fa fa-spinner fa-spin"}):"Install Package"}),(0,A.jsx)(h.A,{onClick:P,className:"btn btn-block btn-outline-success mt-2",children:"Cancel"})]}):(0,A.jsx)(h.A,{onClick:P,className:"btn btn-block btn-outline-success mt-3",children:"Cancel"})]}):null}function we(e){let{className:t,onClick:n,disabled:s,children:r}=e;const[l,o]=(0,a.useState)(!1);return(0,A.jsx)("button",{disabled:s,type:"button",onClick:async()=>{o(!0);try{await n(),o(!1)}catch(e){o(!1)}},className:q()(`${t} button-with-loader`,{loading:l}),children:l?(0,A.jsx)("i",{className:"button-with-loader-icon fas fa-spinner fa-spin"}):r})}function _e(e){let{onCancel:t,onConfirm:n,onEnter:s,value:r,type:l,validate:o=()=>!0}=e;const[i,c]=(0,a.useState)(r||""),[u,d]=(0,a.useState)(!1);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("input",{className:q()("w-100 text-center",{invalid:i.length>0&&!u}),onChange:e=>{c(e.target.value),d(o(e.target.value))},onKeyDown:function(e){"Enter"===e.key?s(e.target.value):"Esc"===e.key&&t()},value:i,placeholder:`name for your new ${l}`,title:`name for your new ${l}`}),(0,A.jsx)("i",{title:"error: name must contain only alphanumeric characters, dashes and underscores.",className:q()("text-danger fa fa-warning",{hidden:u||0===i.length})}),(0,A.jsx)(we,{disabled:!u,className:"btn btn-success btn-block mt-3",onClick:()=>n(i),children:"OK"}),(0,A.jsx)("button",{type:"button",className:"btn btn-outline-success btn-block mt-2",onClick:t,children:"Cancel"}),i.length>0&&!u&&(0,A.jsx)("div",{className:"validation-message mt-5",children:"error: name must contain only alphanumeric characters, dashes and underscores."})]})}function Se(e){let{active:t,onConfirm:n,onCancel:a}=e;return t?(0,A.jsxs)("div",{className:"content-window",children:[(0,A.jsx)("h4",{className:"mb-5",children:"Default Template Application"}),(0,A.jsx)(_e,{type:"project",validate:fe,onEnter:n,onConfirm:n,onCancel:a})]}):null}function Fe(e){let{active:t,onConfirm:n,onCancel:a,selectedFolder:s}=e;return t?(0,A.jsxs)("div",{className:"content-window",children:[(0,A.jsxs)("h4",{className:"mb-5",children:["Add Folder To ",(0,A.jsx)("span",{className:"text-success",children:s.path.replace("components","")})]}),(0,A.jsx)(_e,{type:"folder",selectedFolder:s,onEnter:n,onConfirm:n,onCancel:a})]}):null}function Oe(e){let{active:t,onConfirm:n,onCancel:a}=e;return t?(0,A.jsxs)("div",{className:"content-window",children:[(0,A.jsx)("h4",{className:"mb-5",children:"Add A New File"}),(0,A.jsx)(_e,{type:"file",onEnter:n,onConfirm:n,onCancel:a})]}):null}function Pe(e){let{active:t,selectedFile:n,onConfirm:a,onCancel:s}=e;if(!t)return null;const{path:r}=n,l=r.split("/"),o=l.pop(),i=l.slice(1);return(0,A.jsxs)("div",{className:"content-window",children:[(0,A.jsxs)("h4",{className:"mb-5",children:["Delete ",(0,A.jsx)("span",{className:"text-danger",children:o})," File"]}),(0,A.jsx)(we,{className:"btn btn-danger btn-block delete-button mt-2",onClick:a,children:"Delete"}),(0,A.jsx)("button",{type:"button",className:"btn btn-outline-danger btn-block mt-2",onClick:s,children:"Cancel"}),(0,A.jsxs)("div",{className:"mt-5",children:["Are you sure you want to delete ",(0,A.jsx)("span",{className:"text-danger",children:o})," from"," ",(0,A.jsx)("span",{className:"text-danger",children:i.join("/")}),"?"]})]})}function $e(e){let{active:t,selectedFolder:n,onConfirm:a,onCancel:s}=e;if(!t)return null;if(!n)return null;const r=n.path.split("/"),l=2===r.length,o=l?null:r.slice(-1)[0];return(0,A.jsxs)("div",{className:"content-window",children:[(0,A.jsxs)("h4",{className:"mb-5",children:["Delete ",(0,A.jsx)("span",{className:"text-danger",children:l?null===n||void 0===n?void 0:n.project:o})," ",l?"Project":"Folder"]}),(0,A.jsx)(we,{className:"btn btn-danger btn-block delete-button mt-2",onClick:a,children:"Delete"}),(0,A.jsx)("button",{type:"button",className:"btn btn-outline-danger btn-block mt-2",onClick:s,children:"Cancel"}),(0,A.jsx)("div",{className:"mt-5",children:l?(0,A.jsxs)("div",{children:["Are you sure you want to delete project ",(0,A.jsx)("span",{className:"text-danger",children:null===n||void 0===n?void 0:n.project})," ?"]}):(0,A.jsxs)("div",{children:["Are you sure you want to delete the folder ",(0,A.jsx)("span",{className:"text-danger",children:o})," from"," ",(0,A.jsx)("span",{className:"text-danger",children:null===n||void 0===n?void 0:n.project}),"?"]})})]})}function Ee(e){let{active:t,selectedPackage:n,onConfirm:a,onCancel:s}=e;if(!t)return null;const r=n.name;return(0,A.jsxs)("div",{className:"content-window",children:[(0,A.jsxs)("h4",{className:"mb-5",children:["Delete ",(0,A.jsx)("span",{className:"text-danger",children:r})," Package"]}),(0,A.jsx)(we,{className:"btn btn-danger btn-block delete-button mt-2",onClick:a,children:"Delete"}),(0,A.jsx)("button",{type:"button",className:"btn btn-outline-danger btn-block mt-2",onClick:s,children:"Cancel"}),(0,A.jsxs)("div",{className:"mt-5",children:["Are you sure you want to delete ",(0,A.jsx)("span",{className:"text-danger",children:r}),"?"]})]})}const De="DEFAULT_WINDOW",Ie="DEFAULT_FOLDER_WINDOW",Te="CODE_EDITOR_WINDOW",Re="NAME_FILE_WINDOW",ze="NAME_PROJECT_WINDOW",Ue="NAME_PROJECT_FOLDER_WINDOW",Le="INSTALL_PACKAGE_WINDOW",We="DELETE_FILE_WINDOW",Me="DELETE_FOLDER_WINDOW",qe="DELETE_PACKAGE_WINDOW";function He(e){let{children:t}=e;return(0,A.jsx)(c.A,{className:"editor-window",children:(0,A.jsx)(u.A,{children:t})})}var Ge=n(5502);const Be=function(e){var t,n,s,r;let{deployTargets:l,fileTree:c,onFileSave:u,onAddFile:d,onRevertFile:p,onAddProjectFolder:m,onAddProject:h,onFileChange:f,onDeleteFolder:g,onDeleteFile:x,onDeletePackage:j,onDeployProject:v,onFileSelect:b,onInstallPackage:y,restartInstance:N,restartingInstance:k}=e;const[C,w]=(0,a.useState)(null),[_,S]=(0,a.useState)(null),[F,O]=(0,a.useState)(null),[P,$]=(0,a.useState)(De),[E,D]=(0,a.useState)(null),[I,T]=(0,a.useState)(!0),[R,z]=(0,a.useState)(!1),[U,L]=(0,a.useState)(!1),W=(null===c||void 0===c||null===(t=c.entries)||void 0===t?void 0:t.length)>0,M=Boolean(W&&C),q=Boolean(W&&(C||F)),H=Boolean(C);function G(e,t){$(e),D(t)}function B(){O(null),w(null),S(null)}function V(){G(De,P)}return(0,A.jsxs)(o.A,{id:"webide",children:[(0,A.jsxs)(i.A,{md:"4",xl:"3",className:"file-browser-outer-container mb-3",children:[(0,A.jsx)("div",{className:"floating-card-header-row",children:(0,A.jsxs)(re,{children:[(0,A.jsx)(ee,{onClick:()=>G(De,P),text:"app"}),(H||q)&&(0,A.jsx)("span",{className:"px-1",children:"|"}),H&&(0,A.jsx)(te,{disabled:!H,onClick:()=>G(Ue,P),text:!q&&"folder"}),q&&(0,A.jsx)(ne,{disabled:!q,onClick:()=>{F?G(qe,P):C&&G(Me,P)},text:"folder"}),(M||(null===_||void 0===_?void 0:_.path))&&(0,A.jsx)("span",{className:"px-1",children:"|"}),M&&(0,A.jsx)(ae,{onClick:()=>G(Re,P),disabled:!M,text:!(null!==_&&void 0!==_&&_.path)&&"file"}),(null===_||void 0===_?void 0:_.path)&&(0,A.jsx)(se,{disabled:!(null!==_&&void 0!==_&&_.path),onClick:()=>G(We,P),text:!M&&"file"})]})}),(0,A.jsx)(Y,{files:c,root:c.path,selectedFile:null===_||void 0===_?void 0:_.path,selectedFolder:C,selectedPackage:F,onDeployProject:v,onFolderSelect:e=>{B(),w(e),G(e?Ie:De,P)},onPackageSelect:e=>{B(),O(e),G(e?Ie:De,P)},onFileSelect:async e=>{const t=!e;if(B(),t)S(null),G(De,P);else{const t=await b(e),{content:n,cached:a}=t;S({...e,content:n,cached:a}),G(Te,P)}}})]}),(0,A.jsxs)(i.A,{md:"8",xl:"9",className:"editor-window-container",children:[(0,A.jsxs)(o.A,{className:"floating-card-header-row g-0",children:[(0,A.jsx)(i.A,{className:"text-nowrap",children:_&&(0,A.jsxs)(A.Fragment,{children:[null===_||void 0===_||null===(n=_.path)||void 0===n||null===(s=n.split("/"))||void 0===s||null===(r=s.slice(1))||void 0===r?void 0:r.join(" > ")," ",(0,A.jsxs)("span",{className:"text-grey d-none d-xl-inline-block",children:["| ",(null===_||void 0===_?void 0:_.size)||"..."," bytes |"," ",null!==_&&void 0!==_&&_.mtime?new Date(_.mtime).toLocaleTimeString():"..."]})]})}),(0,A.jsx)(i.A,{className:"text-nowrap",children:(0,A.jsxs)(de,{children:[(0,A.jsx)(oe,{savingFile:U,disabled:!(null!==_&&void 0!==_&&_.cached&&P===Te),onClick:async()=>{L(!0),await u(_,I),L(!1)},text:"save"}),(0,A.jsx)(ue,{loading:R,disabled:!(null!==_&&void 0!==_&&_.cached&&P===Te),onClick:async()=>{z(!0);try{const e=await p(_),t={..._,content:e,cached:!1};S(t)}finally{z(!1)}},text:"revert"}),(0,A.jsx)("span",{className:"px-1",children:"|"}),(0,A.jsx)(ie,{restarting:k,onClick:N,text:"restart"}),(0,A.jsx)(ce,{restartAfterSave:I,onClick:()=>T(!I),text:"auto"})]})})]}),(0,A.jsxs)(He,{children:[(0,A.jsx)(pe,{fileTree:c,active:P===De,AddProjectButtonClick:()=>G(ze,P),InstallPackageButtonClick:()=>{O(null),G(Le,P)}}),(0,A.jsx)(me,{active:P===Ie,type:F?"package":C?"folder":"nothing"}),(0,A.jsx)(Se,{active:P===ze,onConfirm:e=>{!async function(e){await h(e),G(E,P)}(e),(0,Ge.Ak)()},onCancel:V}),(0,A.jsx)(Fe,{projectName:null===C||void 0===C?void 0:C.project,active:P===Ue,selectedFolder:C,onConfirm:async function(e){await m(e,C),G(E,P)},onCancel:V}),(0,A.jsx)(Oe,{active:P===Re,onConfirm:async function(e){const t=await d(e,C);S(t),G(Te,P)},onCancel:V}),(0,A.jsx)(Ce,{active:P===Le,onConfirm:async function(e,t,n){await y(e,t,n),O(null),G(De,P)},onCancel:V,deployTargets:l,selectedPackage:F}),(0,A.jsx)(Ee,{active:P===qe,selectedPackage:F,onConfirm:async()=>{await j(F),G(De,P),B()},onCancel:V}),(0,A.jsx)($e,{active:P===Me,selectedFolder:C,onConfirm:async()=>{await g(C),G(De,P),B()},onCancel:V}),(0,A.jsx)(Pe,{active:P===We,selectedFile:_,onConfirm:async()=>{await x(_),G(De,P),B()},onCancel:V}),(0,A.jsx)(X,{active:P===Te,file:_,onFileChange:async e=>{_&&(!function(e){const t={..._,content:e};S(t)}(e),await f({path:null===_||void 0===_?void 0:_.path,content:e}),S({..._,content:e,cached:!0}))}})]})]})]})},Ve=async e=>{let{auth:t,url:n,function_content:a,project:s,type:r,file:l}=e;return(0,x.A)({operation:{operation:"set_custom_function",function_content:a,project:s,type:r,file:l},auth:t,url:n})},Ke={routes:"'use strict';\n\n/* Dependencies\n- import any packages that are listed in your projects package.json\n- for example:\nimport needle from 'needle'\n*/\n\n/* Helpers\n- import any helper methods from your project's \"helpers\" directory\n- for example:\nimport filter from '../helpers/filter.js';\n*/\n\nmodule.exports = async (server, { hdbCore, logger }) => {\n // POST route\n // with hdbCore.preValidation to process basic auth\n // uses hdbCore.requese to execute the validated request\n server.route({\n url: '/path/to/my/route',\n method: 'POST',\n preValidation: hdbCore.preValidation,\n handler: hdbCore.request,\n })\n\n // GET route\n // with custom validation\n // uses hdbCore.requestWithoutAuthentication\n server.route({\n url: '/path/to/my/route/:id',\n method: 'GET',\n preValidation: async (request, reply) => {\n const token = request.headers.authorization\n const results = hdbCore.requestWithoutAuthentication({\n body: {\n operation: 'search_by_hash',\n schema: 'auth',\n table: 'tokens',\n hash_values: [token],\n get_attributes: ['id']\n }\n })\n if (!results.length) {\n const errorString = result.body.error || 'Sorry, there was an error authenticating your request';\n logger.error(errorString);\n throw new Error(errorString);\n }\n },\n handler: async (request) => {\n const id = parseInt(request.params.id)\n request.body= {\n operation: 'sql',\n sql: `SELECT * FROM dev.dogs WHERE id = ${id}`\n };\n\n /*\n * requestWithoutAuthentication bypasses the standard HarperDB authentication.\n * YOU MUST ADD YOUR OWN preValidation method above, or this method will be available to anyone.\n */\n const result = await hdbCore.requestWithoutAuthentication(request);\n\n return result\n }\n });\n};\n",helpers:"\n/* filters the results, only returning the selected keys */\nexport default (result, keys) => {\n return result.map(r => {\n const f = {}\n keys.forEach(k => f[k] = r[k])\n return f;\n })\n}\n"};var Ze=n(9561);const Ye=function(e){let{items:t,toggleDropItem:n,toggleCreate:r,baseUrl:c,restarting:u,itemType:p,project:f}=e;const g=(0,d.Zp)(),j=(0,E.MW)(),v=(0,s.O$)(l.A,(e=>e.auth)),b=(0,s.O$)(l.A,(e=>e.url)),[y,k]=(0,a.useState)(!1),[C,w]=(0,a.useState)(!1),[_,S]=(0,a.useState)(!1),F=async e=>{e.preventDefault();let n,a=!1;if(y&&!t.includes(y)||(w(!0),a=!0),y&&!(0,Ze.A)(y)&&(w(!0),a=!0,j.error(("projects"===p?"Project":"File")+" names may only contain letters, numbers, hyphens, or underscores.")),a)return!1;if(S(!0),"projects"===p)n=await(async e=>{let{auth:t,url:n,project:a}=e;return(0,x.A)({operation:{operation:"add_custom_function_project",project:a},auth:t,url:n})})({auth:v,url:b,project:y});else{const e=(e=>Ke[e]||null)(p);n=await Ve({auth:v,url:b,project:f,type:p,file:y,function_content:e})}return n.error?(S(!1),r(!1),j.error(n.message)):setTimeout((async()=>(await(0,U.A)({auth:v,url:b,service:"custom_functions"}),await N({auth:v,url:b}),g(`${c}/${y}`))),500)};return(0,a.useEffect)((()=>{n()}),[n]),(0,a.useEffect)((()=>{y&&t.find((e=>e===y))&&g(`${c}/${y}`)}),[t]),(0,A.jsxs)(o.A,{className:"item-row form",children:[(0,A.jsx)(i.A,{className:"input-holder",children:(0,A.jsx)(m.A,{id:"name",invalid:C,onChange:e=>{w(!1),k(e.target.value)},value:y||"",disabled:_,type:"text",name:"name",placeholder:"projects"===p?"ex: api, api-v1, dogs":"routes"===p?"ex: v1, post, public":"ex: filter, auth, queries"})}),(0,A.jsx)(i.A,{className:"item-action",children:_?(0,A.jsx)(h.A,{color:"success",className:"round me-1",children:(0,A.jsx)("i",{className:"fa fa-spinner fa-spin text-white"})}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(h.A,{id:"createItem",color:"success",className:"round me-1",disabled:u,onClick:F,onKeyDown:e=>13!==e.keyCode||F(e),children:(0,A.jsx)("i",{className:"fa fa-check text-white"})}),(0,A.jsx)(h.A,{id:"toggleCreate",color:"black",className:"round",onClick:()=>r(!1),children:(0,A.jsx)("i",{className:"fa fa-times text-white"})})]})})]})},Je=async e=>{let{auth:t,url:n,project:a}=e;return(0,x.A)({operation:{operation:"drop_custom_function_project",project:a},auth:t,url:n})};const Qe=function(e){let{item:t,baseUrl:n,isActive:r,toggleDropItem:c,isDropping:u,itemType:p,restarting:m}=e;const{project:f}=(0,d.g)(),g=(0,d.Zp)(),j=(0,E.MW)(),[v,b]=(0,a.useState)(!1),[y,k]=(0,a.useState)(!1),C=(0,s.O$)(l.A,(e=>e.auth)),w=(0,s.O$)(l.A,(e=>e.url)),_=async()=>{if(!v)return!1;let e;return e="projects"===p?await Je({auth:C,url:w,project:t}):await(async e=>{let{auth:t,url:n,project:a,type:s,file:r}=e;return(0,x.A)({operation:{operation:"drop_custom_function",project:a,type:s,file:r},auth:t,url:n})})({auth:C,url:w,project:f,type:p,file:t}),e.error?(b(!1),k(!1),j.error(e.message)):(j.success(e.message),(0,U.A)({auth:C,url:w,service:"custom_functions"}),await N({auth:C,url:w}),g(n))};return(0,A.jsxs)(o.A,{title:`View${r?"ing":""} ${t}`,className:"item-row "+(r?"active":""),onClick:m?null:()=>!(r||u||v)&&g(`${n}/${t}`),tabIndex:"0",children:[(0,A.jsx)(i.A,{className:"item-label "+(v?"text-danger text-nowrap":""),children:v?`drop ${t}?`:"projects"===p?`/${t}`:t}),(0,A.jsx)(i.A,{className:"item-action",children:y?(0,A.jsx)(h.A,{tabIndex:"-1",disabled:!0,color:"purple",className:"round",children:(0,A.jsx)("i",{className:"fa fa-spinner fa-spin"})}):v?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(h.A,{id:"confirmDropItem",color:"danger",className:"round me-1",title:`confirm drop ${t}`,onClick:()=>{b(!1),k(!0),_()},children:(0,A.jsx)("i",{className:"fa fa-check text-white"})}),(0,A.jsx)(h.A,{id:"cancelDropItem",color:"black",className:"round",title:`Cancel drop ${t}`,onClick:()=>{b(!1)},children:(0,A.jsx)("i",{className:"fa fa-times text-white"})})]}):u?(0,A.jsx)(h.A,{id:"dropItem",color:"danger",className:"round",title:`Drop ${t}`,onClick:()=>{b(t),c(!1)},children:(0,A.jsx)("i",{className:"fa fa-minus text-white"})}):r?(0,A.jsx)(h.A,{tabIndex:"-1",color:"purple",className:"round",children:(0,A.jsx)("i",{className:"fa fa-chevron-right"})}):null})]},t)};const Xe=function(e){let{items:t,toggleDropItem:n,isDropping:a,toggleCreate:s,project:r,isCreating:l,restarting:c,itemType:u,showForm:d}=e;return(0,A.jsxs)(o.A,{className:"floating-card-header",children:[(0,A.jsx)(i.A,{children:"projects"===u?"projects":`/${r}/${u}`}),d&&null!==t&&void 0!==t&&t.length?(0,A.jsxs)(i.A,{className:"text-end",children:[(0,A.jsx)(h.A,{disabled:c,id:"toggleRemove",color:"link",title:"Remove Functions",className:"add-remove me-3",onClick:()=>{n(!a),s(!1)},children:(0,A.jsx)("i",{className:"fa fa-minus"})}),(0,A.jsx)(h.A,{disabled:c,id:"toggleCreate",color:"link",title:"Add Function",className:"add-remove me-1",onClick:()=>{s(!l),n(!1)},children:(0,A.jsx)("i",{className:"fa fa-plus"})})]}):null]})};const et=function(e){let{items:t,activeItem:n,baseUrl:s,restarting:r,itemType:l,project:o,showForm:i}=e;const[d,p]=(0,a.useState)(!1),[m,h]=(0,a.useState)(!1);return(0,a.useEffect)((()=>{h(),p()}),[n,t.length]),(0,A.jsxs)("div",{className:"entity-manager",children:[(0,A.jsx)(Xe,{items:t,itemType:l,isDropping:d,toggleDropItem:p,isCreating:m,toggleCreate:h,restarting:r,project:o,showForm:i}),(0,A.jsxs)(c.A,{className:"my-3",children:[t&&t.length?(0,A.jsx)(u.A,{className:"scrollable "+(m?"creating":""),children:t.map((e=>(0,A.jsx)(Qe,{item:e,baseUrl:s,isActive:n===e,isDropping:d,toggleDropItem:p,itemType:l,restarting:r},e)))}):null,i&&t&&!t.length||m?(0,A.jsx)(u.A,{children:(0,A.jsx)(Ye,{items:t,itemType:l,baseUrl:s,isDropping:d,toggleDropItem:p,isCreating:m,toggleCreate:h,restarting:r,project:o})}):!t||t.length||m?null:(0,A.jsx)(u.A,{children:(0,A.jsx)("div",{className:"py-3 text-center no-content",children:"no functions found"})})]})]})};const tt=function(){const e=(0,d.Zp)(),t=(0,E.MW)(),{customer_id:n,compute_stack_id:r,project:p,type:m,file:f}=(0,d.g)(),g=(0,s.O$)(l.A,(e=>e.auth)),j=(0,s.O$)(l.A,(e=>e.url)),[v,b]=(0,a.useState)(""),[y,N]=(0,a.useState)(""),k=(0,a.useCallback)((async()=>{if(p&&m&&f&&"undefined"!==f){const e=await(async e=>{let{auth:t,url:n,project:a,type:s,file:r}=e;return(0,x.A)({operation:{operation:"get_custom_function",project:a,type:s,file:r},auth:t,url:n})})({auth:g,url:j,project:p,type:m,file:f});b(null===e||void 0===e?void 0:e.message),N(null===e||void 0===e?void 0:e.message)}else b("")}),[g,j,p,m,f,b]);return(0,a.useEffect)((()=>{k()}),[p,f,k,r]),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(o.A,{className:"floating-card-header",children:[(0,A.jsxs)(i.A,{children:["edit >\xa0",(0,A.jsxs)("i",{children:["/",p,f&&"undefined"!==f&&`/${m}/${f}.js`]})]}),(0,A.jsxs)(i.A,{className:"text-end",children:[(0,A.jsxs)(h.A,{onClick:k,color:"link",className:"me-2",children:[(0,A.jsx)("span",{className:"me-2",children:"reload"}),(0,A.jsx)("i",{title:"Reload File",className:"fa fa-sync-alt"})]}),(0,A.jsx)("span",{className:"mx-3 text",children:"|"}),(0,A.jsxs)(h.A,{onClick:()=>e(`/o/${n}/i/${r}/functions/deploy/${p}`),color:"link",className:"me-2",children:[(0,A.jsx)("span",{className:"me-2",children:"deploy"}),(0,A.jsx)("i",{title:"Deploy Project",className:"fa fa-share"})]})]})]}),(0,A.jsx)(c.A,{className:"my-3",children:v?(0,A.jsxs)(u.A,{children:[(0,A.jsx)("div",{className:"code-editor-holder",children:(0,A.jsx)(J.Ay,{height:"100%",defaultLanguage:"javascript",value:v,theme:"vs-dark",onChange:b})}),(0,A.jsxs)(o.A,{children:[(0,A.jsx)(i.A,{md:"6",className:"mt-2",children:(0,A.jsx)(h.A,{block:!0,color:"grey",title:"Revert Code to Last Saved State",disabled:v===y,onClick:k,id:"reset",children:(0,A.jsx)("i",{className:"fa fa-undo"})})}),(0,A.jsx)(i.A,{md:"6",className:"mt-2",children:(0,A.jsx)(h.A,{block:!0,title:"Save Code to Instance",color:"success",id:"addEditItem",onClick:async()=>{const e=await Ve({auth:g,url:j,function_content:v,project:p,type:m,file:f});e.error?t.error(e.message):(setTimeout((()=>(0,U.A)({auth:g,url:j,service:"custom_functions"})),500),t.success(e.message)),k()},children:(0,A.jsx)("i",{className:"fa fa-save"})})})]})]}):(0,A.jsx)(u.A,{children:(0,A.jsxs)("div",{className:"empty-prompt narrow",children:[(0,A.jsx)("div",{className:"mt-3 text-bold",children:"This project does not yet have any routes or helpers"}),(0,A.jsx)("div",{className:"mt-3",children:"Add some using the form fields at left."})]})})})]})};var nt=n(4343);const at=e=>{let{initializing:t,loading:n,handleClick:a}=e;return[{Header:"instance name",accessor:"instance_name"},{Header:"instance url",accessor:"url"},{Header:"cf capable",id:"hdb-narrow-cfcapable",Cell:e=>{let{row:{original:{custom_functions_status:t}}}=e;return t.error?"no":"yes"}},{Header:"cf enabled",id:"hdb-narrow-cfenabled",Cell:e=>{let{row:{original:{custom_functions_status:t}}}=e;return t.is_enabled?"yes":"no"}},{Header:"has project",id:"hdb-narrow-cfhasproject",Cell:e=>{let{row:{original:{has_current_project:t}}}=e;return t?"yes":"no"}},{Header:"deploy",id:"hdb-narrow-deploy",Cell:e=>{let{row:{original:{compute_stack_id:s,custom_functions_status:r,has_auth:l}}}=e;return r.is_enabled&&l?(0,A.jsx)(h.A,{color:"success",block:!0,size:"sm",disabled:t||n[s],onClick:()=>a(s,"deploy"),children:(0,A.jsx)("i",{className:"fa "+("deploy"===n[s]?"fa-spinner fa-spin":"fa-share")})}):null}},{Header:"remove",id:"hdb-narrow-remove",Cell:e=>{let{row:{original:{compute_stack_id:t,custom_functions_status:s,has_current_project:r,has_auth:l}}}=e;return s.is_enabled&&r&&l?(0,A.jsx)(h.A,{color:"danger",block:!0,size:"sm",disabled:n[t],onClick:()=>a(t,"drop"),children:(0,A.jsx)("i",{className:"fa "+("drop"===n[t]?"fa-spinner fa-spin":"fa-trash")})}):null}}]},st={filtered:[],sorted:[],page:0,totalPages:1,pageSize:20,autoRefresh:!1,showFilter:!1,lastUpdate:!1};const rt=function(){const{customer_id:e,compute_stack_id:t,project:n}=(0,d.g)(),r=(0,d.Zp)(),[p]=(0,L.A)({}),m=(0,s.O$)(l.A,(e=>e.auth)),f=(0,s.O$)(l.A,(e=>e.url)),b=(0,s.O$)(l.A,(e=>{var t;return null===(t=e.registration)||void 0===t?void 0:t.version})),[{payload:y,file:N},k]=(0,a.useState)([]),C=`/o/${e}/i/${t}/functions/edit/${n}`,w=(0,s.O$)(D.A,(e=>e.instances.filter((e=>e.compute_stack_id!==t)))),[_,S]=b.split("."),F=_>=3&&(_>3||S>=3),[O,P]=(0,a.useState)([]),[$,E]=(0,a.useState)(F),[I,T]=(0,a.useReducer)(((e,t)=>({...e,...t})),{}),[R,z]=(0,a.useState)(st),W=(0,a.useCallback)((()=>r(C)),[r,C]),M=(0,a.useCallback)((async(e,t)=>{const a=O.find((t=>t.compute_stack_id===e)),s=p[e];if(a&&s){T({[e]:t});let r=!1;const l=await j({auth:s,url:a.url});if(!l.error){const e=await v({auth:s,url:a.url});r=Object.keys(e).includes(n)}const o=O.map((t=>(t.compute_stack_id===e&&(t.custom_functions_status=l,t.has_current_project=r),t)));P(o),T({[e]:null})}}),[p,n,O]),q=(0,a.useCallback)((async(e,t)=>{const a=O.find((t=>t.compute_stack_id===e)),s=p[e];a&&s&&(T({[e]:t}),"deploy"===t?(await(async e=>{let{auth:t,url:n,project:a,payload:s,file:r}=e;return(0,x.A)({operation:{operation:"deploy_custom_function_project",project:a,payload:s,file:r},auth:t,url:n})})({auth:s,url:a.url,payload:y,project:n,file:N}),$&&await(async e=>{let{auth:t,url:n,projects:a,dry_run:s=!1}=e;return(0,x.A)({operation:{operation:"install_node_modules",projects:a,dry_run:s},auth:t,url:n})})({auth:s,url:a.url,projects:[n]}),await(0,U.A)({auth:s,url:a.url,service:"custom_functions"})):await Je({auth:s,url:a.url,project:n}),setTimeout((()=>{T({[e]:!1}),M(e,t)}),1e3))}),[N,p,y,n,O,M,$]);return g()((async()=>{if(m&&f&&n){k(!1);const e=await(async e=>{let{auth:t,url:n,project:a,skip_node_modules:s}=e;return(0,x.A)({operation:{operation:"package_custom_function_project",project:a,skip_node_modules:s},auth:t,url:n})})({auth:m,url:f,project:n,skip_node_modules:$});k(e)}}),[m,f,n,$]),g()((async()=>{if(w){const e=await Promise.all(w.map((async e=>{const t=p[e.compute_stack_id];let a={};if(t){const s=await j({auth:t,url:e.url});return s.error||(a=await v({auth:t,url:e.url})),{...e,custom_functions_status:s,has_auth:!0,has_current_project:Object.keys(a).includes(n)}}return{...e,custom_functions_status:!1}})));P(e)}}),[w,n]),(0,a.useEffect)((()=>{z({...R,totalPages:Math.ceil((O.length||R.pageSize)/R.pageSize)})}),[z,R.pageSize]),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(o.A,{className:"floating-card-header",children:[(0,A.jsxs)(i.A,{children:["deploy ",n&&`> ${n}`]}),(0,A.jsxs)(i.A,{className:"text-end",children:[F&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(h.A,{color:"link",title:"Turn on autofresh",onClick:()=>E(!$),children:[(0,A.jsx)("span",{className:"me-2",children:"install dependencies at destination"}),(0,A.jsx)("i",{className:"fa fa-lg fa-toggle-"+($?"on":"off")})]}),(0,A.jsx)("span",{className:"mx-3 text",children:"|"})]}),(0,A.jsxs)(h.A,{onClick:W,color:"link",className:"me-2",children:[(0,A.jsx)("span",{className:"me-2",children:"back to edit"}),(0,A.jsx)("i",{title:"Edit Project",className:"fa fa-edit"})]})]})]}),(0,A.jsx)(c.A,{className:"my-3",children:(0,A.jsx)(u.A,{className:"react-table-holder",children:O.length?(0,A.jsx)(nt.A,{columns:at({initializing:!y,loading:I,handleClick:q}),data:O,page:R.page,pageSize:R.pageSize,totalPages:R.totalPages,showFilter:R.showFilter,sorted:R.sorted,onFilteredChange:e=>z({...R,filtered:e}),onSortedChange:e=>z({...R,sorted:e}),onPageChange:e=>z({...R,pageSize:e}),onPageSizeChange:e=>z({...R,page:0,pageSize:e})}):(0,A.jsx)("div",{className:"empty-prompt",children:"Please register at least one Custom Function-enabled instance to deploy to"})})})]})};const lt=function(e){let{loading:t,refreshCustomFunctions:n,restarting:a}=e;const r=(0,s.O$)(l.A,(e=>e.auth)),o=(0,s.O$)(l.A,(e=>e.url));return(0,A.jsxs)("span",{className:"structure-reloader d-block text-center mb-4",children:[(0,A.jsxs)(h.A,{disabled:t,color:"link",onClick:n,children:[(0,A.jsx)("span",{className:"me-2",children:"refresh projects"}),(0,A.jsx)("i",{title:"Refresh Endpoint Files",className:"fa "+(t?"fa-spinner fa-spin":"fa-sync-alt")})]}),(0,A.jsx)("span",{className:"mx-3 text",children:"|"}),(0,A.jsxs)(h.A,{disabled:a,color:"link",onClick:()=>(0,U.A)({auth:r,url:o,service:"custom_functions"}),className:"me-2",children:[(0,A.jsx)("span",{className:"me-2",children:"restart server"}),(0,A.jsx)("i",{title:"Refresh Endpoint Files",className:"fa "+(a?"fa-spinner fa-spin":"fa-stop-circle")})]}),(0,A.jsx)("hr",{className:"d-block d-md-none mt-4"})]})};const ot=function(e){let{url:t,project:n,fileCount:a}=e;return(0,A.jsxs)("div",{className:"entity-manager",children:[(0,A.jsxs)("div",{className:"floating-card-header",children:["/",n,"/static"]}),(0,A.jsx)(c.A,{className:"my-3",children:(0,A.jsx)(u.A,{children:(0,A.jsxs)(o.A,{className:"item-row",children:[(0,A.jsx)(i.A,{className:"item-label",children:a?"enabled":'"static" subfolder not found'}),(0,A.jsxs)(i.A,{className:"item-action",children:[(0,A.jsx)(h.A,{tabIndex:"-1",color:a?"success":"danger",disabled:!a,className:"round me-1",children:a}),(0,A.jsx)(h.A,{tabIndex:"-1",color:"purple",className:"round",disabled:!a,href:`${t}/${n}/static`,target:"_blank",rel:"noopener noreferrer",children:(0,A.jsx)("i",{title:"View UI",className:"fa fa-share"})})]})]})})})]})};var it=n(7666);const ct=function(e){var t,n,c;let{refreshCustomFunctions:u,loading:m}=e;const{customer_id:h,compute_stack_id:f,action:g="edit",project:x,file:j}=(0,d.g)(),v=(0,d.Zp)(),b=(0,s.O$)(l.A,(e=>e.custom_functions)),y=(0,s.O$)(l.A,(e=>e.registration)),[N,k]=((null===y||void 0===y?void 0:y.version)||"").split("."),C=parseFloat(`${N}.${k}`)<4.1,w=(0,s.O$)(l.A,(e=>"custom_functions"===e.restarting_service)),_=(0,s.O$)(l.A,(e=>{var t;return e.custom_functions_url||`${e.url.split(":").slice(0,-1).join(":")}:${null===(t=e.custom_functions)||void 0===t?void 0:t.port}`})),S=`/o/${h}/i/${f}/functions/${g}`;return(0,a.useEffect)((()=>{const e=(null===b||void 0===b?void 0:b.endpoints)&&Object.keys(null===b||void 0===b?void 0:b.endpoints).length,t=(null===b||void 0===b?void 0:b.endpoints)&&Object.keys(null===b||void 0===b?void 0:b.endpoints).includes(x);if(e&&x&&!t){const e=x&&Object.keys(null===b||void 0===b?void 0:b.endpoints)[0];v(`${S}/${e}`)}else if(e&&x&&!j){var n,a;const e=x&&(null===b||void 0===b||null===(n=b.endpoints[x])||void 0===n?void 0:n.routes[0]),t=x&&(null===b||void 0===b||null===(a=b.endpoints[x])||void 0===a?void 0:a.helpers[0]);v(`${S}/${x}/${e?"routes":"helpers"}/${e||t}`)}else if(e&&!x){const e=Object.keys(null===b||void 0===b?void 0:b.endpoints)[0];v(`${S}/${e}`)}else e||v(S)}),[null===b||void 0===b?void 0:b.endpoints,h,f,v,g,x,j,S]),(0,r.A)((async()=>{if(_&&w)try{await fetch(_),l.A.update((e=>{e.restarting_service=!1}))}catch(e){console.log(e)}}),1e3),(0,A.jsxs)(o.A,{id:"functions",children:[(0,A.jsx)(i.A,{xl:"3",lg:"4",md:"6",xs:"12",children:(0,A.jsxs)(p.tH,{onError:(e,t)=>(0,P.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:O.A,children:[(0,A.jsx)(et,{itemType:"projects",items:Object.keys(null===b||void 0===b?void 0:b.endpoints)||[],activeItem:x,baseUrl:S,restarting:w,showForm:"edit"===g}),x&&"edit"===g&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(et,{itemType:"routes",items:x&&(null===b||void 0===b||null===(t=b.endpoints[x])||void 0===t?void 0:t.routes)||[],project:x,activeItem:j,baseUrl:`${S}/${x}/routes`,restarting:w,showForm:"edit"===g}),(0,A.jsx)(et,{itemType:"helpers",items:x&&(null===b||void 0===b||null===(n=b.endpoints[x])||void 0===n?void 0:n.helpers)||[],project:x,activeItem:j,baseUrl:`${S}/${x}/helpers`,restarting:w,showForm:"edit"===g}),C&&(0,A.jsx)(ot,{url:_,project:x,fileCount:x&&(null===b||void 0===b||null===(c=b.endpoints[x])||void 0===c?void 0:c.static)||0})]}),(0,A.jsx)("hr",{className:"mt-0"}),(0,A.jsxs)("div",{className:"entity-manager-footer",children:[(0,A.jsx)("div",{className:"text-bold mb-1",children:"Root File Directory"}),(0,A.jsx)(it.A,{text:b.directory}),(0,A.jsx)("div",{className:"text-bold mb-1 mt-3",children:"Custom Functions Server URL"}),(0,A.jsx)(it.A,{text:_})]}),(0,A.jsx)("hr",{}),(0,A.jsx)(lt,{refreshCustomFunctions:u,loading:m,restarting:w})]})}),(0,A.jsx)(i.A,{xl:"9",lg:"8",md:"6",xs:"12",children:"deploy"===g?(0,A.jsx)(rt,{}):x?(0,A.jsx)(tt,{}):(0,A.jsx)(F.A,{refreshCustomFunctions:u,headline:`Please ${null!==b&&void 0!==b&&b.endpoints.length?"choose":"create"} a project at left.`})})]})};function ut(e){return e.split("/").slice(2).join("/")}function dt(e,t,n,a){return e.reduce(((e,s)=>{const r=s.compute_stack_id,l=t[r];if(null===l||void 0===l||!l.version)return e;const[o,i]=(null===l||void 0===l?void 0:l.version.split("."))||[];return parseInt(o,10)>=4&&parseInt(i,10)>=2&&e.push({isCurrentInstance:r===n,auth:a,instance:s}),e}),[])}const pt=function(e){let{refreshCustomFunctions:t,loading:n}=e;const{compute_stack_id:r}=(0,d.g)(),o=(0,s.O$)(l.A,(e=>e.registration)),{fileTree:i}=(0,s.O$)(l.A,(e=>e.custom_functions)),c=(0,s.O$)(l.A,(e=>e.auth)),u=(0,s.O$)(l.A,(e=>e.url)),[p,m]=((null===o||void 0===o?void 0:o.version)||"").split(".")||[],h=parseFloat(`${p}.${m}`)>=4.2,f=(0,s.O$)(D.A,(e=>e.instances)),[g]=(0,L.A)({}),[j,v]=W({}),[b,y]=(0,a.useState)(!1),N=(0,E.MW)();function k(e){let{path:t}=e;const n={...j},a=`${r}_${t}`;a in n&&delete n[a],v({...n})}async function C(e){let{auth:t,url:n}=e;y(!0),setTimeout((async()=>{await(0,U.A)({auth:t,url:n,service:"http_workers"}),y(!1)}),100)}return h?(0,A.jsx)(Be,{fileTree:i,deployTargets:dt(f,g,r,c),onRevertFile:async function(e){k({path:e.path});const{error:n,message:a}=await I({auth:c,url:u,project:e.project,file:ut(e.path)});return n?N.error(a):(await t(),a)},onFileChange:async function(e){const{path:t,content:n}=e,a=`${r}_${t}`;v({...j,[a]:n})},onFileSave:async function(e,n){const a=e.path.split("/").slice(2).join("/"),s={auth:c,url:u,project:e.project,file:a,payload:e.content},{error:r,message:l}=await T(s);r&&N.error(l),n&&await C({auth:c,url:u}),k({path:e.path}),e.cached=!1,await t()},onUpdate:t,onAddFile:async function(e,n){const{path:a,project:s}=n,r=ut(a),l=r?`${r}/${e}`:e;return await T({auth:c,url:u,project:s,file:l,payload:""}),await t(),{content:"",path:[n.path,e].join("/"),project:s}},onAddProject:async function(e){const{error:n,message:a}=await(async e=>{let{auth:t,url:n,project:a}=e;return(0,x.A)({operation:{operation:"add_component",project:a},auth:t,url:n})})({auth:c,url:u,project:e});n&&N.error(a),await(0,U.A)({auth:c,url:u,service:"http_workers"}),await t()},onAddProjectFolder:async function(e,n){const{path:a,project:s}=n,r=ut(a),l=r?`${r}/${e}`:e,{error:o,message:i}=await T({auth:c,url:u,project:s,file:l});o&&N.error(i),await t()},onInstallPackage:async function(e,n,a){const s=a.map((async t=>{const{error:a,message:s}=await z({auth:t.auth,url:t.instance.url,project:e,packageUrl:n});a&&N.error(s),await(0,U.A)({auth:t.auth,url:t.instance.url,service:"http_workers"})}));await Promise.all(s),await t()},onDeployProject:async function(e){let{project:n,deployTarget:a}=e;const{auth:s,instance:r}=a,{payload:l}=await(async e=>{let{auth:t,url:n,project:a,skip_node_modules:s=!0}=e;return(0,x.A)({auth:t,url:n,operation:{operation:"package_component",project:a,skip_node_modules:s}})})({auth:c,url:u,project:n.name});await z({auth:s,url:r.url,project:n.name,payload:l}),await(0,U.A)({auth:s,url:r.url,service:"http_workers"}),await(0,U.A)({auth:c,url:u,service:"http_workers"}),await t()},onDeleteFile:async function(e){const{error:n,message:a}=await R({auth:c,url:u,project:e.project,file:ut(e.path)});n&&N.error(a),await t()},onDeleteFolder:async function(e){let{path:n,project:a}=e;const s=ut(n);if(s.length>0){const{error:e,message:t}=await R({auth:c,url:u,project:a,file:s});e&&N.error(t)}else{const{error:e,message:t}=await R({auth:c,url:u,project:a});e&&N.error(t)}await t()},onDeletePackage:async function(e){let{name:n}=e;const{error:a,message:s}=await R({auth:c,url:u,project:n});a?N.error(s):(await(0,U.A)({auth:c,url:u,service:"http_workers"}),await t())},onFileSelect:async function(e){const{path:t,project:n,name:a}=e,s=ut(t),l=`${r}_${t}`,o=j[l],i=l in j;if(i)return{cached:i,content:o,path:t,project:n,name:a};const{error:d,message:p}=await I({auth:c,url:u,project:n,file:s});return d?(N.error(p),{content:"",path:t,project:n,name:a,cached:!1}):{cached:i,content:p,path:t,project:n,name:a}},onFileRename:async function(e,n){const{path:a,content:s,project:r}=n,l=ut(a).split("/").slice(0,-1).join("/"),o=l?`${l}/${e}`:e;await R({auth:c,url:u,project:r,file:ut(a)}),await T({auth:c,url:u,project:r,file:o,payload:s}),t()},refreshingCustomFunctions:n,restartInstance:async()=>C({auth:c,url:u}),restartingInstance:b}):(0,A.jsx)(ct,{refreshCustomFunctions:t,loading:n})};const mt=function(){return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("div",{className:"floating-card-header text-end",children:"\xa0"}),(0,A.jsx)(c.A,{className:"my-3",children:(0,A.jsx)(u.A,{children:(0,A.jsxs)("div",{className:"empty-prompt narrow",children:[(0,A.jsx)("i",{className:"fa fa-bullhorn fa-3x text-success"}),(0,A.jsx)("div",{className:"mt-3 text-bold",children:"Coming Soon: Custom Functions!"}),(0,A.jsx)("div",{className:"mt-3",children:(0,A.jsxs)("ul",{children:[(0,A.jsx)("li",{children:"Add your own API endpoints to a standalone API server inside Harper"}),(0,A.jsx)("li",{children:"Use Harper Core methods to interact with your data at lightning speed"}),(0,A.jsx)("li",{children:"Custom Functions are powered by Fastify, so they're extremely flexible"}),(0,A.jsx)("li",{children:"Manage in Harper Studio, or use your own IDE and Version Management System"}),(0,A.jsx)("li",{children:"Distribute your Custom Functions to all your Harper instances with a single click"})]})})]})})})]})};var ht=n(4979),ft=n(2914);const gt=function(){const e=(0,s.O$)(l.A,(e=>e.auth)),t=(0,s.O$)(l.A,(e=>e.url)),n=(0,s.O$)(l.A,(e=>e.custom_functions)),o=(0,s.O$)(l.A,(e=>e.registration)),i=(0,ft.A)({version:null===o||void 0===o?void 0:o.version}),c=(0,s.O$)(l.A,(e=>e.restarting)),[u,d]=(0,a.useState)(!1),[p,m]=(0,a.useState)(!0),[h,f]=(0,a.useState)(!1),g=(0,a.useCallback)((async()=>{e&&t&&!c&&(m(!0),await N({auth:e,url:t}),m(!1))}),[e,t,c]);return(0,a.useEffect)((()=>{g()}),[g]),(0,a.useEffect)((()=>{const e=(null===n||void 0===n?void 0:n.is_enabled)&&(null===n||void 0===n?void 0:n.port)||i;d(e),e&&f(!1)}),[n,i]),(0,r.A)((()=>{h&&g()}),2e3),n?n.error?(0,A.jsx)(mt,{}):h?(0,A.jsx)(F.A,{description:"Configuring Custom Functions",icon:(0,A.jsx)("i",{className:"fa fa-spinner fa-spin"})}):u?(0,A.jsx)(pt,{refreshCustomFunctions:g,loading:p}):(0,A.jsx)($,{setConfiguring:f}):(0,A.jsx)(ht.A,{header:"loading custom functions",spinner:!0})}},7666:(e,t,n)=>{n.d(t,{A:()=>c});var a=n(9950),s=n(7176),r=n(6114),l=n(3452),o=n(7348),i=n(4414);const c=function(e){let{text:t,beforeText:n,afterText:c,obscure:u=!1}=e;const d=(0,o.MW)(),p=navigator.clipboard,m=(0,a.useCallback)((async e=>{e.stopPropagation(),await navigator.clipboard.writeText(t),d.success("Text copied to clipboard")}),[d,t]);return(0,i.jsxs)(s.A,{className:"copyable-text-holder g-0",children:[p&&t&&(0,i.jsx)(r.A,{className:"copy-icon",children:(0,i.jsx)(l.A,{title:"Copy this value",onClick:m,color:"link",children:(0,i.jsx)("i",{className:"fa fa-copy text-small"})})}),(0,i.jsx)(r.A,{className:"text-container",children:t?(0,i.jsxs)(i.Fragment,{children:[n,u?t.replace(/./g,"*"):t,c]}):(0,i.jsx)("span",{children:"\xa0"})})]})}},4343:(e,t,n)=>{n.d(t,{A:()=>b});var a=n(9950),s=n(2043),r=n(5488),l=n(9435),o=n(7176),i=n(6114),c=n(4414);const u=e=>{let{headerGroups:t,onSortedChange:n,sorted:a,showFilter:s,dynamicAttributesFromDataTable:r,tableDescriptionAttributes:l}=e;const u=e=>{let t=!1;return l.forEach((n=>{n.attribute===e&&(n.is_primary_key||n.indexed)&&(t=!0)})),t};return t.map((e=>{const{key:t,...l}=e.getHeaderGroupProps();return(0,c.jsxs)("div",{...l,children:[(0,c.jsx)(o.A,{className:"header g-0",children:e.headers.map((e=>{var t,s;return(0,c.jsx)(i.A,{onClick:()=>{var t,s;r&&!r.includes(e.id)&&u(e.id)&&n([{id:e.id,desc:(null===(t=a[0])||void 0===t?void 0:t.id)===e.id&&!(null!==(s=a[0])&&void 0!==s&&s.desc)}])},className:`${(null===(t=a[0])||void 0===t?void 0:t.id)===e.id?"sorted":""} ${null!==(s=a[0])&&void 0!==s&&s.desc?"desc":"asc"} ${-1!==e.id.indexOf("hdb-narrow")?"action":""} px-1 ${r&&!r.includes(e.id)&&u(e.id)?"":"disabled-column"}`,children:(0,c.jsx)("div",{className:"text-renderer",children:e.render("Header")})},e.id)}))}),s&&(0,c.jsx)(o.A,{className:"filter g-0",children:e.headers.map((e=>(0,c.jsx)(i.A,{className:-1!==e.id.indexOf("hdb-narrow")?"action":"",children:e.render("Filter")},e.id)))})]},t)}))};var d=n(3452);const p=function(e){let{page:t,pageSize:n,totalPages:a,onPageChange:s,onPageSizeChange:l,loading:u}=e;return(0,c.jsxs)(o.A,{className:"pagination",children:[(0,c.jsx)(i.A,{xs:"12",sm:"2",className:"previous",children:(0,c.jsx)(d.A,{className:"mb-2 btn-pagination",color:"purple",block:!0,onClick:()=>s(t-1),disabled:!a||0===t,children:(0,c.jsx)("i",{className:"fa fa-chevron-left"})})}),(0,c.jsxs)(i.A,{xs:"12",sm:"4",className:"paginator",children:[(0,c.jsx)("i",{className:"fa fa-book me-2"}),(0,c.jsx)(r.A,{className:"mb-2",type:"number",value:t+1,min:1,max:a,onChange:e=>s(e.target.value-1)}),(0,c.jsxs)("div",{className:"page-count",children:["\xa0/\xa0",u?(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"}):a]})]}),(0,c.jsx)(i.A,{xs:"12",sm:"4",className:"page-size",children:(0,c.jsx)(r.A,{className:"mb-2",type:"select",value:n,onChange:e=>l(e.target.value),children:[20,50,100,250].map((e=>(0,c.jsxs)("option",{value:e,children:[e," rows"]},e)))})}),(0,c.jsx)(i.A,{xs:"12",sm:"2",className:"next",children:(0,c.jsx)(d.A,{className:"mb-2 pull-right btn-pagination",block:!0,color:"purple",onClick:()=>s(t+1),disabled:!a||t+1===a,children:(0,c.jsx)("i",{className:"fa fa-chevron-right"})})})]})};const m=function(e){let{previousPage:t,canPreviousPage:n,pageIndex:a,gotoPage:s,setPageSize:l,pageCount:u,nextPage:p,canNextPage:m,loading:h}=e;return(0,c.jsxs)(o.A,{className:"pagination",children:[(0,c.jsx)(i.A,{xs:"12",sm:"2",className:"previous",children:(0,c.jsx)(d.A,{className:"mb-2 btn-pagination",color:"purple",block:!0,onClick:t,disabled:!u||!n,children:(0,c.jsx)("i",{className:"fa fa-chevron-left"})})}),(0,c.jsxs)(i.A,{xs:"12",sm:"4",className:"paginator",children:[(0,c.jsx)("i",{className:"fa fa-book me-2"}),(0,c.jsx)(r.A,{className:"mb-2",type:"number",value:a+1||1,min:1,max:u,onChange:e=>s(e.target.value?Number(e.target.value)-1:0)}),(0,c.jsxs)("div",{className:"page-count",children:["\xa0/\xa0",h?(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"}):u]})]}),(0,c.jsx)(i.A,{xs:"12",sm:"4",className:"page-size",children:(0,c.jsx)(r.A,{className:"mb-2",type:"select",onChange:e=>{s(0),setTimeout((()=>l(e.target.value)),1e3)},children:[20,50,100,250].map((e=>(0,c.jsxs)("option",{value:e,children:[e," rows"]},e)))})}),(0,c.jsx)(i.A,{xs:"12",sm:"2",className:"next",children:(0,c.jsx)(d.A,{className:"mb-2 pull-right btn-pagination",block:!0,color:"purple",onClick:p,disabled:!u||!m,children:(0,c.jsx)("i",{className:"fa fa-chevron-right"})})})]})};const h=function(e){let{prepareRow:t,row:n,onRowClick:a=!1}=e;return t(n),(0,c.jsx)(o.A,{onClick:()=>a&&a(n.original),className:"g-0",children:n.cells.map((e=>(0,c.jsx)(i.A,{className:-1!==e.column.id.indexOf("hdb-narrow")?"action":"",children:e.render("Cell")},`${e.row.id}-${e.column.id}`)))})};var f=n(3628),g=n(3150);function x(e){let{value:t}=e;return(0,c.jsx)("div",{className:"text-renderer",children:t})}function j(e){let{src:t}=e;const[n,s]=(0,a.useState)(!1),[r,l]=(0,a.useState)(!1);return(0,c.jsxs)("div",{className:"image-renderer",onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[(0,c.jsx)("i",{className:"fa fa-image"}),n&&r?(0,c.jsxs)("div",{className:"preview-image no-image",children:[(0,c.jsx)("i",{className:"fa fa-ban text-danger"}),(0,c.jsx)("div",{className:"mt-2",children:"image failed to load"})]}):n?(0,c.jsx)("img",{onError:l,alt:t,src:t,className:"preview-image"}):null]})}const v={Filter:e=>{let{column:{filterValue:t,setFilter:n}}=e;return(0,c.jsx)(r.A,{type:"text",value:t||"",onChange:e=>n(e.target.value||void 0)})},Cell:e=>{let{value:t}=e;return(e=>{switch(Object.prototype.toString.call(e)){case"[object Array]":case"[object Object]":return(0,c.jsx)(x,{value:JSON.stringify(e)});case"[object Boolean]":return(0,c.jsx)(x,{value:e?"true":"false"});case"[object String]":return(t=e)&&(t.match(/^https?.*\.(jpeg|jpg|gif|png)$/)||-1!==t.indexOf("data:image"))?(0,c.jsx)(j,{src:e}):(0,c.jsx)(x,{value:e});default:return(0,c.jsx)(x,{value:e})}var t})(t)}};const b=function(e){let{columns:t,data:n,error:r,currentPage:o,pageSize:i,totalPages:d,onFilteredChange:x,onSortedChange:j,onPageChange:b,onPageSizeChange:y,showFilter:N,onRowClick:A,sorted:k,loading:C,dynamicAttributesFromDataTable:w,tableDescriptionAttributes:_,manual:S=!1}=e;const{headerGroups:F,page:O,rows:P,prepareRow:$,state:E,setAllFilters:D,canPreviousPage:I,canNextPage:T,pageOptions:R,pageCount:z,gotoPage:U,nextPage:L,previousPage:W,setPageSize:M}=(0,s.useTable)({columns:t,data:n,defaultColumn:v,onFilteredChange:x,onSortedChange:j,onPageChange:b,onPageSizeChange:y,onRowClick:A,manualPagination:S,manualFilters:S,initialState:{pageIndex:o,pageSize:i}},s.useFilters,s.usePagination),[q,H]=(0,a.useState)(!0),G=S||!O.length?P:O;return(0,a.useEffect)((()=>{!N&&E.filters.length?D([]):x(E.filters)}),[E.filters,N]),(0,a.useEffect)((()=>{setTimeout((()=>H(!1)),100)}),[null===G||void 0===G?void 0:G.length]),(0,c.jsxs)(l.tH,{onError:(e,t)=>(0,f.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:g.A,children:[(0,c.jsxs)("div",{className:"react-table-scroller",children:[(0,c.jsx)(u,{headerGroups:F,tableDescriptionAttributes:_,dynamicAttributesFromDataTable:w,onSortedChange:j,sorted:k,showFilter:N}),C||q?(0,c.jsx)("div",{className:"centered text-center",children:(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"})}):G.length?G.map((e=>(0,c.jsx)(h,{row:e,prepareRow:$,onRowClick:A},e.id))):(0,c.jsxs)("div",{className:"centered text-center",children:[(0,c.jsx)("i",{className:"fa fa-exclamation-triangle text-danger"}),(0,c.jsx)("div",{className:"mt-2 text-darkgrey",children:r?`Error loading data: ${r}`:"no records"})]})]}),S?(0,c.jsx)(p,{page:o,pageSize:i,totalPages:d,onPageChange:b,onPageSizeChange:y,loading:C}):(0,c.jsx)(m,{previousPage:W,pageSize:i,canPreviousPage:I,pageIndex:E.pageIndex,pageOptions:R,gotoPage:U,setPageSize:M,pageCount:z,nextPage:L,canNextPage:T,loading:C})]})}},8750:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(127);const s=async e=>{let{auth:t,url:n}=e;return(0,a.A)({operation:{operation:"get_configuration"},auth:t,url:n})}},2415:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(127),s=n(5269);const r=async e=>{let{auth:t,url:n}=e;const r=await(0,a.A)({operation:{operation:"list_roles"},auth:t,url:n}),l=[...Array.isArray(r)?r:[]].sort(((e,t)=>e.role.toLowerCase()>t.role.toLowerCase()?1:-1));return s.A.update((e=>{e.roles=l})),l}},8222:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(127),s=n(5269);const r=async e=>{let{auth:t,url:n,signal:r}=e;const l=await(0,a.A)({operation:{operation:"list_users"},auth:t,url:n,signal:r}),o=Array.isArray(l)?[...l].map((e=>({username:e.username,role:e.role.role}))).sort(((e,t)=>e.username.toLowerCase()>t.username.toLowerCase()?1:-1)):[];return s.A.update((e=>{e.users=o})),o}},2010:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(127),s=n(5269);const r=async e=>{let{auth:t,url:n}=e;return s.A.update((e=>{e.restarting=!0})),(0,a.A)({operation:{operation:"restart"},auth:t,url:n})}},1534:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(127),s=n(5269);const r=async e=>{let{auth:t,url:n,service:r=null}=e;return r?(s.A.update((e=>{e.restarting_service=r})),(0,a.A)({operation:{operation:"restart_service",service:r},auth:t,url:n})):{error:!0,message:"You must specify a service"}}},4834:(e,t,n)=>{n.d(t,{A:()=>s});var a=n(127);const s=async e=>{let{auth:t,url:n,...s}=e;return(0,a.A)({operation:{operation:"set_configuration",...s},auth:t,url:n})}},6177:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(8750),s=n(2415),r=n(8222),l=n(717),o=n(127);const i=async e=>{var t,n,i,c,u,d,p;let{auth:m,url:h}=e;const f=await(0,a.A)({auth:m,url:h}),g=await(0,l.A)({auth:m,url:h}),x=await(async e=>{let{auth:t,url:n}=e;return(0,o.A)({operation:{operation:"cluster_status"},auth:t,url:n})})({auth:m,url:h}),j=parseFloat(null===g||void 0===g?void 0:g.version)>=4?"nats":"socketcluster",v=await(0,s.A)({auth:m,url:h});let b=!1;v.error||(b=v.find((e=>e.permission.cluster_user)));const y=await(0,r.A)({auth:m,url:h});let N=!1;y.error||(N=b&&y.find((e=>e.role===b.role)));const A="nats"===j?null===(t=f.clustering)||void 0===t?void 0:t.enabled:f.CLUSTERING,k="nats"===j?null===(n=f.clustering)||void 0===n?void 0:n.user:f.CLUSTERING_USER,C="nats"===j?null===(i=f.clustering)||void 0===i||null===(c=i.hubServer)||void 0===c||null===(u=c.cluster)||void 0===u||null===(d=u.network)||void 0===d?void 0:d.port:f.CLUSTERING_PORT,w="nats"===j?null===(p=f.clustering)||void 0===p?void 0:p.nodeName:f.NODE_NAME;return{is_ready:!!A&&!!N&&!!k&&!!b&&!!C&&!!w,cluster_role:b,cluster_user:N,is_enabled:A,config_cluster_user:k,config_cluster_port:C,node_name:w,engine:j,status:null===x||void 0===x?void 0:x.status,message:null===x||void 0===x?void 0:x.message,connections:null===x||void 0===x?void 0:x.connections}}},9561:(e,t,n)=>{n.d(t,{A:()=>a});const a=e=>e.match(/^[-a-zA-Z0-9_]+$/)},5488:(e,t,n)=>{n.d(t,{A:()=>b});var a=n(9950),s=n(1942),r=n.n(s),l=n(8738),o=n.n(l),i=n(1497);function c(e){return c="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},c(e)}var u=["className","cssModule","type","bsSize","valid","invalid","tag","addon","plaintext","innerRef"];function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},d.apply(this,arguments)}function p(e,t){if(null==e)return{};var n,a,s=function(e,t){if(null==e)return{};var n,a,s={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function m(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(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,a=x(e);if(t){var s=x(this).constructor;n=Reflect.construct(a,arguments,s)}else n=a.apply(this,arguments);return function(e,t){if(t&&("object"===c(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return g(e)}(this,n)}}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}var j={children:r().node,type:r().string,size:r().oneOfType([r().number,r().string]),bsSize:r().string,valid:r().bool,invalid:r().bool,tag:i.Wx,innerRef:r().oneOfType([r().object,r().func,r().string]),plaintext:r().bool,addon:r().bool,className:r().string,cssModule:r().object},v=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&&h(e,t)}(l,e);var t,n,s,r=f(l);function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=r.call(this,e)).getRef=t.getRef.bind(g(t)),t.focus=t.focus.bind(g(t)),t}return t=l,(n=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"focus",value:function(){this.ref&&this.ref.focus()}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.cssModule,s=e.type,r=void 0===s?"text":s,l=e.bsSize,c=e.valid,m=e.invalid,h=e.tag,f=e.addon,g=e.plaintext,x=e.innerRef,j=p(e,u),v=["switch","radio","checkbox"].indexOf(r)>-1,b="select"===r,y="range"===r,N=h||(b||"textarea"===r?r:"input"),A="form-control";g?(A="".concat(A,"-plaintext"),N=h||"input"):y?A="form-range":b?A="form-select":v&&(A=f?null:"form-check-input"),j.size&&/\D/g.test(j.size)&&((0,i.mc)('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'),l=j.size,delete j.size);var k=(0,i.qO)(o()(t,m&&"is-invalid",c&&"is-valid",!!l&&(b?"form-select-".concat(l):"form-control-".concat(l)),A),n);return("input"===N||h&&"function"===typeof h)&&(j.type="switch"===r?"checkbox":r),j.children&&!g&&"select"!==r&&"string"===typeof N&&"select"!==N&&((0,i.mc)('Input with a type of "'.concat(r,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete j.children),a.createElement(N,d({},j,{ref:x,className:k,"aria-invalid":m}))}}])&&m(t.prototype,n),s&&m(t,s),Object.defineProperty(t,"prototype",{writable:!1}),l}(a.Component);v.propTypes=j;const b=v}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[575],{1679:(e,t,s)=>{s.r(t),s.d(t,{default:()=>oe});var n=s(9950),a=s(6713),r=s(135),l=s(4492),i=s(5269),o=s(7176),c=s(6114),u=s(4084),d=s(8156),h=s(9435),m=s(6165),p=s(3150),g=s(3628),f=s(3452),v=s(2010),b=s(4834),_=s(127);var x=s(8198),j=s(8738),N=s.n(j),A=s(4414);function k(e){let{error:t,style:s={}}=e;return(0,A.jsx)("div",{style:s,className:N()("form-validation-error",{error:t}),children:t||"input is valid"})}var y=s(5488);const w=function(e){let{label:t,value:s,type:a="text",max:r=null,min:l=null,editable:i=!1,handleChange:o,validator:c=()=>!0,errorMessage:u="is required",addSpace:d=!0,valid:h=!1}=e;const[m,p]=(0,n.useState)(null);return i?(0,A.jsxs)(A.Fragment,{children:[d&&(0,A.jsx)("br",{}),(0,A.jsxs)("div",{className:N()("text-nowrap mt-2 mb-1",{"text-danger":m}),children:[t," ",m]}),(0,A.jsx)(y.A,{id:`cluster-field-${t}`,type:a,className:N()("cluster-field form-control",{error:m}),max:r,min:l,defaultValue:s,valid:h,onChange:e=>o(e.target.value),onBlur:e=>{const t=c(e.target.value);p(t?null:u)}})]}):(0,A.jsxs)(A.Fragment,{children:[d&&(0,A.jsx)("br",{}),(0,A.jsx)("div",{className:"text-nowrap mt-2 mb-1",children:t}),(0,A.jsx)(y.A,{readOnly:!0,valid:!0,type:a,value:s})]})};var C=s(2765);const S=function(e){var t,s,r,l,o,c,u,d,h;let{setConfiguring:m,clusterStatus:p,refreshStatus:g,compute_stack_id:j}=e;const N=(0,a.O$)(i.A,(e=>e.auth)),y=(0,a.O$)(i.A,(e=>e.url)),S=p.engine,P=1024,O=65535,[E,T]=(0,n.useState)({clusterRole:null===p||void 0===p||null===(t=p.cluster_role)||void 0===t?void 0:t.role,clusterUsername:(null===p||void 0===p||null===(s=p.cluster_user)||void 0===s?void 0:s.username)||"cluster_user",clusterPassword:(null===p||void 0===p||null===(r=p.cluster_user)||void 0===r?void 0:r.password)||"",clusterPort:(null===p||void 0===p?void 0:p.config_cluster_port)||"",clusterNodeName:(null===p||void 0===p?void 0:p.node_name)||j}),[R,F]=(0,n.useState)(null);function M(e){T({...E,...e})}return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(w,{label:"Cluster Role",handleChange:e=>M({clusterRole:e}),value:E.clusterRole,valid:(null===(l=E.clusterRole)||void 0===l?void 0:l.trim().length)>0,validator:e=>(null===e||void 0===e?void 0:e.trim().length)>0,editable:!(null!==p&&void 0!==p&&null!==(o=p.cluster_role)&&void 0!==o&&o.role),addSpace:!1}),(0,A.jsx)(w,{label:"Cluster User",handleChange:e=>M({clusterUsername:e}),value:E.clusterUsername,valid:E.clusterUsername.trim().length>0,validator:e=>e.trim().length>0,editable:!(null!==p&&void 0!==p&&null!==(c=p.cluster_user)&&void 0!==c&&c.username)}),(0,A.jsx)(w,{label:"Cluster Password",type:"password",handleChange:e=>M({clusterPassword:e}),value:null!==p&&void 0!==p&&null!==(u=p.cluster_user)&&void 0!==u&&u.username?"********":E.clusterPassword,valid:(null===p||void 0===p||null===(d=p.cluster_user)||void 0===d?void 0:d.username)||E.clusterPassword.trim().length>0,validator:e=>e.trim().length>0,editable:!(null!==p&&void 0!==p&&null!==(h=p.cluster_user)&&void 0!==h&&h.username),showDivider:!1}),(0,A.jsx)(w,{label:"Cluster Port",type:"number",max:O,min:P,handleChange:e=>M({clusterPort:e}),value:E.clusterPort,valid:E.clusterPort>=P&&E.clusterPort<=O,validator:e=>e>=P&&e<=O,errorMessage:"must be between 1024 and 65535",editable:!(null!==p&&void 0!==p&&p.config_cluster_port)}),(0,A.jsx)(w,{label:"Cluster Node Name",handleChange:e=>M({clusterNodeName:e}),value:E.clusterNodeName,valid:E.clusterNodeName.length>0,validator:e=>e.length>0,editable:!(null!==p&&void 0!==p&&p.node_name)}),(0,A.jsx)("hr",{className:"my-3"}),(0,A.jsx)(f.A,{block:!0,color:"success",disabled:!function(e){var t;let{clusterRole:s,clusterUsername:n,clusterPassword:a,clusterPort:r,clusterNodeName:l}=e;return(null===s||void 0===s?void 0:s.length)>0&&n.length>0&&((null===p||void 0===p||null===(t=p.cluster_user)||void 0===t?void 0:t.username)||a.length>0)&&l.length>0&&r>=P&&r<=O}(E),onClick:async function(){var e;if(F(null),null===(e=p.cluster_role)||void 0===e||!e.role){const e=await(0,C.A)({auth:N,url:y,role:E.clusterRole,permission:{cluster_user:!0}});if(e.error)return F(e.message)}if(!p.cluster_user){const e=await(0,x.A)({auth:N,url:y,role:E.clusterRole,username:E.clusterUsername,password:E.clusterPassword});if(e.error)return F(e.message)}const t="nats"===S?await(0,b.A)({auth:N,url:y,clustering_enabled:!0,clustering_nodeName:E.clusterNodeName,clustering_port:E.clusterPort,clustering_user:E.clusterUsername}):await(async e=>{let{CLUSTERING:t=!1,CLUSTERING_PORT:s,CLUSTERING_USER:n,NODE_NAME:a,auth:r,url:l}=e;return(0,_.A)({operation:{operation:"configure_cluster",CLUSTERING:t,CLUSTERING_PORT:s,CLUSTERING_USER:n,NODE_NAME:a},auth:r,url:l})})({auth:N,url:y,CLUSTERING:!0,CLUSTERING_PORT:E.clusterPort,CLUSTERING_USER:E.clusterUsername,NODE_NAME:E.clusterNodeName});return t.error?F(t.message):(window._kmq&&window._kmq.push(["record","enabled clustering"]),await(0,v.A)({auth:N,url:y}),setTimeout((()=>m(!0)),0),g())},children:"Enable Clustering"}),(0,A.jsx)("br",{}),R&&(0,A.jsx)(k,{error:R})]})};const P=function(e){let{setConfiguring:t,clusterStatus:s,refreshStatus:n}=e;const{compute_stack_id:r}=(0,l.g)(),f=null===s||void 0===s?void 0:s.cluster_role,v=(null===s||void 0===s?void 0:s.cluster_role)&&(null===s||void 0===s?void 0:s.cluster_user),b=(null===s||void 0===s?void 0:s.cluster_role)&&(null===s||void 0===s?void 0:s.cluster_user),_=(null===s||void 0===s?void 0:s.cluster_role)&&(null===s||void 0===s?void 0:s.cluster_user)&&(null===s||void 0===s?void 0:s.node_name),x=(0,a.O$)(i.A,(e=>e.rule_arn)),j=Boolean(x);return(0,A.jsxs)(o.A,{id:"clustering",children:[(0,A.jsxs)(c.A,{xl:"3",lg:"4",md:"5",xs:"12",children:[(0,A.jsx)("span",{className:"floating-card-header",children:"enable clustering"}),(0,A.jsx)(u.A,{className:"my-3",children:(0,A.jsx)(d.A,{children:(0,A.jsx)(h.tH,{onError:(e,t)=>(0,g.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:p.A,children:(0,A.jsx)(S,{setConfiguring:t,refreshStatus:n,clusterStatus:s,compute_stack_id:r})})})})]}),(0,A.jsx)(c.A,{xl:"9",lg:"8",md:"7",xs:"12",children:_?(0,A.jsx)(m.A,{headline:"You're all set!",description:"Click the button at left to enable clustering. NOTE: We'll restart the instance when you click this button.",icon:(0,A.jsx)("i",{className:"fa fa-thumbs-up text-success"})}):b?(0,A.jsx)(m.A,{headline:"Set Instance Cluster Name",description:`We need to set a unique node name to identify your instance in the cluster. By default, we set it to "${r}", but you can choose your own unique node name.`,icon:(0,A.jsx)("i",{className:"fa fa-exclamation-triangle text-warning"})}):v?(0,A.jsx)(m.A,{headline:"Cluster Port Set To: 12345",description:"If your instance is behind a firewall, you'll need to ensure this port is accessible by other instances if you want to publish/subscribe to/from this instance.",icon:(0,A.jsx)("i",{className:"fa fa-thumbs-up text-success"})}):f?(0,A.jsx)(m.A,{headline:"Create a Cluster User",description:"If you have other instances you want to cluster together with this one, make sure the cluster user has the same name and password as those other instances.",warning:j?"Harper clustering functionality will not work between AWS cloud instances. We are working on upgrading our cloud infrastructure to support clustering functionality.":null,icon:(0,A.jsx)("i",{className:"fa fa-exclamation-triangle text-warning"})}):(0,A.jsx)(m.A,{headline:"Create a Cluster Role",description:"This role subscribes to instance transaction logs and handles operations that result from its pub/sub configuration.",icon:(0,A.jsx)("i",{className:"fa fa-exclamation-triangle text-warning"})})})]})};var O=s(7348);const E=function(e){let{handleAddNode:t,loading:s}=e;return(0,A.jsx)(f.A,{color:"purple",className:"round",title:"Connect To This Instance",disabled:s,onClick:t,children:(0,A.jsx)("i",{className:`fa ${s?"fa-spin fa-spinner":"fa-plus"} text-white`})})};const T=function(e){let{handleRemoveNode:t,showModal:s,loading:n}=e;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(f.A,{color:"danger",className:"round me-1",title:"Why isn't this instance clustering?",disabled:n,onClick:s,children:(0,A.jsx)("i",{className:"fa fa-exclamation"})}),(0,A.jsx)(f.A,{color:"purple",className:"round",title:"Disconnect From This Instance",disabled:n,onClick:t,children:(0,A.jsx)("i",{className:`fa ${n?"fa-spin fa-spinner":"fa-minus"} text-white`})})]})};const R=function(e){let{handleRemoveNode:t,loading:s}=e;return(0,A.jsx)(f.A,{color:"purple",className:"round",title:"Disconnect From This Instance",disabled:s,onClick:t,children:(0,A.jsx)("i",{className:`fa ${s?"fa-spin fa-spinner":"fa-minus"} text-white`})})};const F=function(){return(0,A.jsx)(f.A,{color:"purple",className:"round",title:"Connecting to this instance",disabled:!0,children:(0,A.jsx)("i",{className:"fa fa-spin fa-spinner text-white"})})};const M=function(e){let{handleConfigureNode:t,loading:s}=e;return(0,A.jsx)(f.A,{color:"success",className:"round me-1",title:"Enable Clustering",disabled:s,onClick:t,children:(0,A.jsx)("i",{className:`fa ${s?"fa-spin fa-spinner":"fa-share"} text-white`})})};const $=function(e){var t,s,n;let{setShowModal:a,item:r,itemType:l,loading:i,handleAddNode:u,handleRemoveNode:d,handleConfigureNode:h,refreshNetwork:m}=e;const p=r.compute_stack_id===i;return(0,A.jsxs)(o.A,{className:"item-row",children:[(0,A.jsx)(c.A,{className:"item-label "+("closed"===(null===(t=r.connection)||void 0===t?void 0:t.state)?"text-danger":""),children:r.instance_name}),(0,A.jsx)(c.A,{className:"item-action",children:"incompatible/unreachable"===l?null:"unconfigured"===l?(0,A.jsx)(M,{loading:p,handleConfigureNode:()=>h({compute_stack_id:r.compute_stack_id})}):"CREATE_IN_PROGRESS"===r.instance_status?(0,A.jsx)(f.A,{color:"grey",className:"round",title:"Creating Instance",disabled:!0,children:(0,A.jsx)("i",{className:"fa fa-spin fa-spinner"})}):r.connection?"closed"===(null===(s=r.connection)||void 0===s?void 0:s.state)?(0,A.jsx)(T,{loading:p,handleRemoveNode:()=>d({compute_stack_id:r.compute_stack_id}),showModal:()=>a(r.instance_name)}):"connecting"===(null===(n=r.connection)||void 0===n?void 0:n.state)?(0,A.jsx)(F,{refreshNetwork:m}):(0,A.jsx)(R,{loading:p,handleRemoveNode:()=>d({compute_stack_id:r.compute_stack_id,instance_host:r.instance_host,clusterPort:r.clusterPort})}):(0,A.jsx)(E,{loading:p,handleAddNode:()=>u({compute_stack_id:r.compute_stack_id,instance_url:r.instance_url,instance_host:r.instance_host,clusterPort:r.clusterPort})})})]})};var I=s(1534);const L=function(e){let{items:t,itemType:s,setShowModal:r,loading:h,setLoading:m,refreshNetwork:p}=e;const{customer_id:g}=(0,l.g)(),f=(0,l.Zp)(),v=(0,O.MW)(),b=(0,a.O$)(i.A,(e=>e.compute_stack_id)),x=(0,a.O$)(i.A,(e=>e.auth),[b]),j=(0,a.O$)(i.A,(e=>e.url),[b]),N=(0,a.O$)(i.A,(e=>e.is_local),[b]),k=(0,a.O$)(i.A,(e=>{var t;return parseFloat(null===(t=e.auth)||void 0===t?void 0:t.version)>=4?"nats":"socketcluster"}),[b]),y=(0,n.useCallback)((async e=>{m(e.compute_stack_id);const t="nats"===k?await(async e=>{let{auth:t,url:s,server:n="hub",routes:a}=e;return(0,_.A)({operation:{operation:"cluster_set_routes",server:n,routes:a},auth:t,url:s})})({auth:x,url:j,routes:[{host:e.instance_host,port:e.clusterPort}]}):await(async e=>{let{compute_stack_id:t,instance_host:s,clusterPort:n,auth:a,url:r}=e;return(0,_.A)({operation:{operation:"add_node",name:t,node_name:t,host:s,port:n,subscriptions:[]},auth:a,url:r})})({...e,auth:x,url:j,is_local:N,customer_id:g});t.error?(v.error("localhost"===e.instance_host?"External instances cannot reach that instance's URL":t.message),m(!1)):("nats"===k&&await(0,I.A)({auth:x,url:j,service:"clustering config"}),await p()),m(!1)}),[m,x,j,N,g,p,v,k]),w=(0,n.useCallback)((async e=>{m(e.compute_stack_id);const t="nats"===k?await(async e=>{let{auth:t,url:s,routes:n}=e;return(0,_.A)({operation:{operation:"cluster_delete_routes",routes:n},auth:t,url:s})})({auth:x,url:j,routes:[{host:e.instance_host,port:e.clusterPort}]}):await(async e=>{let{compute_stack_id:t,auth:s,url:n}=e;return(0,_.A)({operation:{operation:"remove_node",name:t,node_name:t},auth:s,url:n})})({...e,auth:x,url:j,is_local:N,customer_id:g});t.error?(v.error(t.message),m(!1)):("nats"===k&&await(0,I.A)({auth:x,url:j,service:"clustering config"}),await p()),m(!1)}),[m,x,j,N,g,p,v,k]),C=(0,n.useCallback)((e=>f(`/o/${g}/i/${e.compute_stack_id}/cluster`)),[f,g]);return(0,A.jsxs)("div",{className:"entity-manager",children:[(0,A.jsxs)("div",{className:"floating-card-header",children:[s," instances"]}),(0,A.jsx)(u.A,{className:"my-3",children:(0,A.jsx)(d.A,{children:null!==t&&void 0!==t&&t.length?t.map((e=>(0,A.jsx)($,{item:e,itemType:s,setShowModal:r,handleAddNode:y,handleRemoveNode:w,handleConfigureNode:C,loading:h,refreshNetwork:p},e.instance_name))):t?(0,A.jsx)(o.A,{className:"item-row",children:(0,A.jsxs)(c.A,{className:"item-label",children:["There are no ",s," instances"]})}):(0,A.jsx)(o.A,{className:"item-row",children:(0,A.jsx)(c.A,{className:"item-label",children:(0,A.jsx)("i",{className:"fa fa-spinner fa-spin"})})})})})]})};var U=s(4343);const z={filtered:[],sorted:[],page:0,totalPages:1,pageSize:20,autoRefresh:!1,showFilter:!1,lastUpdate:!1};const D=function(e){let{refreshNetwork:t,loading:s,setLoading:r}=e;const l=(0,a.O$)(i.A,(e=>e.clusterDataTable||[])),h=(0,a.O$)(i.A,(e=>e.clusterDataTableColumns||[])),[m,p]=(0,n.useState)(z);(0,n.useEffect)((()=>{p({...m,totalPages:Math.ceil((l.length||m.pageSize)/m.pageSize)})}),[p,m.pageSize]);const g=(0,n.useCallback)((async()=>{r(!0),t()}),[r,t]);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(o.A,{className:"floating-card-header",children:[(0,A.jsx)(c.A,{children:"manage clustering"}),(0,A.jsx)(c.A,{className:"text-end",children:(0,A.jsxs)(f.A,{color:"link",onClick:g,className:"me-2",children:[(0,A.jsx)("span",{className:"me-2",children:"refresh network"}),(0,A.jsx)("i",{title:"Refresh Roles",className:"fa "+(s?"fa-spinner fa-spin":"fa-sync-alt")})]})})]}),(0,A.jsx)(u.A,{className:"my-3",children:(0,A.jsx)(d.A,{className:"react-table-holder "+(s?"loading":""),children:null!==l&&void 0!==l&&l.length?(0,A.jsx)(U.A,{columns:h,data:l,page:m.page,pageSize:m.pageSize,totalPages:m.totalPages,showFilter:m.showFilter,sorted:m.sorted,onFilteredChange:e=>p({...m,filtered:e}),onSortedChange:e=>p({...m,sorted:e}),onPageChange:e=>p({...m,pageSize:e}),onPageSizeChange:e=>p({...m,page:0,pageSize:e})}):(0,A.jsx)("div",{className:"empty-prompt",children:"Please connect at least one instance to configure clustering"})})})]})};var G=s(6685),B=s(1340),X=s(877);const H=function(e){let{showModal:t,setShowModal:s}=e;const{compute_stack_id:n}=(0,l.g)(),r=(0,a.O$)(i.A,(e=>e.instance_name),[n]);return(0,A.jsxs)(G.A,{id:"cluster-state-modal",isOpen:!!t,toggle:()=>s(!1),centered:!0,fade:!1,children:[(0,A.jsx)(B.A,{toggle:()=>s(!1),children:"Instance Cluster Error"}),(0,A.jsx)(X.A,{children:(0,A.jsx)(u.A,{children:(0,A.jsxs)(d.A,{children:[(0,A.jsx)("b",{children:r})," is unable to open a connection to ",(0,A.jsx)("b",{children:t}),".",(0,A.jsx)("hr",{className:"my-3"}),(0,A.jsxs)("ul",{children:[(0,A.jsx)("li",{children:"Clustered instances must be able to reach each other. This may require allowing access through a firewall."}),(0,A.jsx)("li",{children:"Both instances must be running. In the event of a restart, instances will automatically attempt to reconnect."}),(0,A.jsxs)("li",{children:["Clustered instances must have the same cluster user ",(0,A.jsx)("b",{children:"name"})," and ",(0,A.jsx)("b",{children:"password"}),". You can edit an instance's cluster user credentials in the ",(0,A.jsx)("b",{children:"config"})," section."]})]}),(0,A.jsx)("hr",{className:"my-3"}),"If none of these help fix the issue, you can disconnect ",(0,A.jsx)("b",{children:t})," from ",(0,A.jsx)("b",{children:r})," by clicking the purple disconnect button with the minus sign."]})})})]})};var q=s(2414),W=s.n(q);var Y=s(1110);const J=async e=>{let{channel:t,subscriptions:s,buttonState:n,instance_host:a,clusterPort:r,clusterName:l,auth:o,url:c}=e;const u=JSON.parse(JSON.stringify(s)),d=u.findIndex((e=>e.channel===t)),[h,m]=t.split(":");-1===d?u.push({channel:t,schema:h,table:m,publish:"togglePublish"===n,subscribe:"toggleSubscribe"===n}):"togglePublish"===n?u[d].publish=!u[d].publish:"toggleSubscribe"===n&&(u[d].subscribe=!u[d].subscribe),u[d]&&!u[d].publish&&u[d].subscribe;const p={operation:"update_node",name:l,node_name:l,host:a,port:r,subscriptions:u},g=await(0,_.A)({operation:p,auth:o,url:c});return g.error&&-1!==g.message.indexOf("add_node")&&(p.operation="add_node",await(0,_.A)({operation:p,auth:o,url:c})),i.A.update((e=>{e.lastUpdate=Date.now()}))};var V=s(5346),K=s(396),Z=s(6177);const Q=async e=>{let{instance:t,auth:s}=e;const n=s&&await(0,Z.A)({auth:s,url:t.url}),a=s&&await(0,V.A)({auth:s,url:t.url}),{structure:r}=a?(0,K.A)(a):{structure:{}},l=new URL(t.url),i={...t,auth:s,structure:r,host:l.hostname,clustering:n};return Object.entries(i).reduce(((e,t)=>{let[s,n]=t;return null==n||(e[s]=n),e}),{})},ee=async e=>{let{auth:t,url:s,instances:n,connections:a}=e;const r=await(async e=>{let{auth:t,url:s}=e;return(0,_.A)({operation:{operation:"cluster_get_routes"},auth:t,url:s})})({auth:t,url:s});return r.hub.map((e=>{var t;const s=n.find((t=>t.host===e.host||t.private_ip===e.host));if(!s)return!1;const r=s.host===s.private_ip?s.private_ip:s.host,l=a.find((e=>{var t;return e.node_name===(null===s||void 0===s||null===(t=s.clustering)||void 0===t?void 0:t.node_name)})),i=(null===l||void 0===l||null===(t=l.subscriptions)||void 0===t?void 0:t.map((e=>({channel:`${e.schema}:${e.table}`,...e}))))||[];return{host:r,port:e.port,state:"open",name:null===s||void 0===s?void 0:s.compute_stack_id,subscriptions:i}})).filter((e=>!1!==e))},te=e=>{let{connections:t}=e;return t?t.filter((e=>-1===e.host_address.indexOf("::ffff"))).map((e=>({name:e.node_name,host:e.host_address,port:e.host_port,state:e.state,subscriptions:e.subscriptions}))):[]},se=async e=>{let{auth:t,url:s,instances:n,compute_stack_id:a,instanceAuths:r,setLoading:l}=e;const o=await Promise.all(n.filter((e=>!!r[e.compute_stack_id])).map((e=>Q({instance:e,auth:r[e.compute_stack_id]})))),c=o.find((e=>e.compute_stack_id===a)),u=c.clustering.message||!c.clustering.is_enabled?[]:"nats"===c.clustering.engine?await ee({auth:t,url:s,instances:o,connections:c.clustering.connections}):te({connections:c.clustering.status.outbound_connections}),d={is_enabled:c.clustering.is_enabled,connections:u},h=(e=>{let{instances:t,network:s,instance_region:n,instance_wavelength_zone_id:a,instance_cluster_engine:r}=e;const l=t.filter((e=>e.url&&"DELETE_IN_PROGRESS"!==e.status)).filter((e=>e.clustering.engine===r)).map((e=>{var t,l;const i="socketcluster"===r?null===s||void 0===s?void 0:s.connections.find((t=>t.name===e.compute_stack_id)):null===s||void 0===s?void 0:s.connections.find((t=>t.host===e.host)),o=(null===i||void 0===i?void 0:i.subscriptions)||[],c=null===e||void 0===e||null===(t=e.clustering)||void 0===t?void 0:t.config_cluster_port,u=e.is_local?"OK":e.status,d=!n||n!==e.instance_region||e.wavelength_zone_id||a?e.url.match(/^https?:\/\/([^/:?#]+)(?:[/:?#]|$)/i)[1]:e.private_ip,h=e.clustering.node_name;return{instance_name:e.instance_name,instance_url:e.url,compute_stack_id:e.compute_stack_id,instance_status:u,instance_host:d,clusterPort:c,clusterName:h,connection:i,subscriptions:o,structure:e.structure,configured:null===(l=e.clustering)||void 0===l?void 0:l.is_ready}})),i=t.filter((e=>e.clustering.engine!==r)).map((e=>({instance_name:e.instance_name,compute_stack_id:e.name})));return{connected:l.filter((e=>e.connection&&e.configured)),unconnected:l.filter((e=>!e.connection&&e.configured)),unconfigured:l.filter((e=>!e.configured)),unreachable:i}})({instances:o.filter((e=>r[e.compute_stack_id]&&e.compute_stack_id!==a)),network:d,instance_region:c.instance_region,instance_wavelength_zone_id:c.wavelength_zone_id,instance_cluster_engine:c.clustering.engine}),m=(e=>{let{instances:t,structure:s}=e;if(!s||!t.length)return[];const n=[];return t.map((e=>{const t=W()(e.structure,s);return Object.keys(t).sort().map(((s,a)=>(Object.keys(t[s]).sort().map(((t,r)=>{const l=`${s}:${t}`,i=l&&e.subscriptions.find((e=>e.channel===l)),o=i&&i.publish,c=i&&i.subscribe;return n.push({is_first_instance:0===a&&0===r,is_first_schema:0===r,instance_name:e.instance_name,schema:s,table:t,compute_stack_id:e.compute_stack_id,instance_host:e.instance_host,clusterPort:e.clusterPort,clusterName:e.clusterName,subscriptions:e.subscriptions,channel:l,publish:o,subscribe:c}),!0})),!0))),!0})),n})({instances:h.connected.filter((e=>"closed"!==e.connection.state)),structure:c.structure}),p=(e=>{let{auth:t,url:s,buildNetwork:n,setLoading:a}=e;return[{Header:"instance",Cell:e=>{let{row:{original:{is_first_instance:t,instance_name:s}}}=e;return(0,A.jsx)("div",{className:t?"text-bold":"text-grey",children:s})}},{Header:"schema",Cell:e=>{let{row:{original:{is_first_schema:t,schema:s}}}=e;return(0,A.jsx)("div",{className:t?"text-bold":"text-grey",children:s})}},{Header:"table",accessor:"table"},{Header:"publish",id:"hdb-narrow-publish",Cell:e=>{let{row:{original:{compute_stack_id:r,instance_host:l,instance_name:i,clusterPort:o,clusterName:c,subscriptions:u,publish:d,channel:h}}}=e;return(0,A.jsx)(Y.A,{checked:d||!1,onChange:async()=>{a(r),await J({channel:h,subscriptions:u,instance_host:l,instance_name:i,clusterPort:o,clusterName:c,auth:t,url:s,buttonState:"togglePublish"}),n()}})}},{Header:"subscribe",id:"hdb-narrow-subscribe",Cell:e=>{let{row:{original:{compute_stack_id:r,instance_host:l,instance_name:i,clusterPort:o,clusterName:c,subscriptions:u,subscribe:d,channel:h}}}=e;return(0,A.jsx)(Y.A,{checked:d||!1,onChange:async()=>{a(r),await J({channel:h,subscriptions:u,instance_host:l,instance_name:i,clusterPort:o,clusterName:c,auth:t,url:s,buttonState:"toggleSubscribe"}),n()}})}}]})({auth:t,url:c.url,compute_stack_id:a,buildNetwork:()=>se({auth:t,url:s,instances:n,compute_stack_id:a,instanceAuths:r,setLoading:l}),setLoading:l});return i.A.update((e=>{e.network=d,e.clusterPartners=h,e.clusterDataTable=m,e.clusterDataTableColumns=p,e.instances=o})),l(!1),{network:d,clusterPartners:h,clusterDataTable:m,clusterDataTableColumns:p}},ne=se;var ae=s(5553),re=s(4319);const le=function(e){let{configuring:t}=e;const{compute_stack_id:s}=(0,l.g)(),u=(0,a.O$)(ae.A,(e=>e.instances)),[d]=(0,re.A)({}),m=(0,a.O$)(i.A,(e=>e.auth),[s]),f=(0,a.O$)(i.A,(e=>e.url),[s]),v=(0,a.O$)(i.A,(e=>e.clusterPartners),[s]),b=(0,a.O$)(i.A,(e=>e.restarting),[s]),_="socketcluster"===(0,a.O$)(i.A,(e=>{var t;return parseFloat(null===(t=e.registration)||void 0===t?void 0:t.version)>=4?"nats":"socketcluster"}),[s])&&(null===v||void 0===v?void 0:v.connected.some((e=>"connecting"===e.connection.state))),[x,j]=(0,n.useState)(!1),[N,k]=(0,n.useState)(!1),y=(0,n.useCallback)((async()=>{m&&f&&u&&s&&!b&&!t&&await ne({auth:m,url:f,instances:u,compute_stack_id:s,instanceAuths:d,setLoading:k})}),[m,f,u,s,b,d,t]);return(0,n.useEffect)((()=>{y()}),[y]),(0,r.A)((()=>_&&y()),1500),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(o.A,{id:"clustering",children:[(0,A.jsx)(c.A,{xl:"3",lg:"4",md:"6",xs:"12",children:(0,A.jsxs)(h.tH,{onError:(e,t)=>(0,g.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:p.A,children:[(0,A.jsx)(L,{items:null===v||void 0===v?void 0:v.connected,itemType:"connected",loading:N,refreshNetwork:y,setLoading:k,setShowModal:j}),(0,A.jsx)(L,{items:null===v||void 0===v?void 0:v.unconnected,itemType:"unconnected",loading:N,refreshNetwork:y,setLoading:k}),(0,A.jsx)(L,{items:null===v||void 0===v?void 0:v.unconfigured,itemType:"unconfigured",loading:N}),(0,A.jsx)(L,{items:null===v||void 0===v?void 0:v.unreachable,itemType:"incompatible/unreachable",loading:N})]})}),(0,A.jsx)(c.A,{xl:"9",lg:"8",md:"6",xs:"12",children:(0,A.jsx)(D,{refreshNetwork:y,loading:N,setLoading:k})})]}),(0,A.jsx)(H,{showModal:x,setShowModal:j})]})};var ie=s(4979);const oe=function(){const{compute_stack_id:e}=(0,l.g)(),t=(0,a.O$)(i.A,(e=>e.auth),[e]),s=(0,a.O$)(i.A,(e=>e.url),[e]),[o,c]=(0,n.useState)(!1),[u,d]=(0,n.useState)(!1),h=(0,n.useCallback)((async()=>{if(t&&s){const e=await(0,Z.A)({auth:t,url:s});c(e),e.is_ready&&d(!1)}}),[t,s]);return(0,r.A)((async()=>{u&&h()}),3e3),(0,n.useEffect)((()=>{h()}),[h]),(0,n.useEffect)((()=>{c(!1)}),[e]),o?u?(0,A.jsx)(m.A,{description:"Configuring Clustering",icon:(0,A.jsx)("i",{className:"fa fa-spinner fa-spin"})}):o.is_ready?(0,A.jsx)(le,{configuring:u}):(0,A.jsx)(P,{setConfiguring:d,clusterStatus:o,refreshStatus:h}):(0,A.jsx)(ie.A,{header:"loading network",spinner:!0})}},4343:(e,t,s)=>{s.d(t,{A:()=>x});var n=s(9950),a=s(2043),r=s(5488),l=s(9435),i=s(7176),o=s(6114),c=s(4414);const u=e=>{let{headerGroups:t,onSortedChange:s,sorted:n,showFilter:a,dynamicAttributesFromDataTable:r,tableDescriptionAttributes:l}=e;const u=e=>{let t=!1;return l.forEach((s=>{s.attribute===e&&(s.is_primary_key||s.indexed)&&(t=!0)})),t};return t.map((e=>{const{key:t,...l}=e.getHeaderGroupProps();return(0,c.jsxs)("div",{...l,children:[(0,c.jsx)(i.A,{className:"header g-0",children:e.headers.map((e=>{var t,a;return(0,c.jsx)(o.A,{onClick:()=>{var t,a;r&&!r.includes(e.id)&&u(e.id)&&s([{id:e.id,desc:(null===(t=n[0])||void 0===t?void 0:t.id)===e.id&&!(null!==(a=n[0])&&void 0!==a&&a.desc)}])},className:`${(null===(t=n[0])||void 0===t?void 0:t.id)===e.id?"sorted":""} ${null!==(a=n[0])&&void 0!==a&&a.desc?"desc":"asc"} ${-1!==e.id.indexOf("hdb-narrow")?"action":""} px-1 ${r&&!r.includes(e.id)&&u(e.id)?"":"disabled-column"}`,children:(0,c.jsx)("div",{className:"text-renderer",children:e.render("Header")})},e.id)}))}),a&&(0,c.jsx)(i.A,{className:"filter g-0",children:e.headers.map((e=>(0,c.jsx)(o.A,{className:-1!==e.id.indexOf("hdb-narrow")?"action":"",children:e.render("Filter")},e.id)))})]},t)}))};var d=s(3452);const h=function(e){let{page:t,pageSize:s,totalPages:n,onPageChange:a,onPageSizeChange:l,loading:u}=e;return(0,c.jsxs)(i.A,{className:"pagination",children:[(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"previous",children:(0,c.jsx)(d.A,{className:"mb-2 btn-pagination",color:"purple",block:!0,onClick:()=>a(t-1),disabled:!n||0===t,children:(0,c.jsx)("i",{className:"fa fa-chevron-left"})})}),(0,c.jsxs)(o.A,{xs:"12",sm:"4",className:"paginator",children:[(0,c.jsx)("i",{className:"fa fa-book me-2"}),(0,c.jsx)(r.A,{className:"mb-2",type:"number",value:t+1,min:1,max:n,onChange:e=>a(e.target.value-1)}),(0,c.jsxs)("div",{className:"page-count",children:["\xa0/\xa0",u?(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"}):n]})]}),(0,c.jsx)(o.A,{xs:"12",sm:"4",className:"page-size",children:(0,c.jsx)(r.A,{className:"mb-2",type:"select",value:s,onChange:e=>l(e.target.value),children:[20,50,100,250].map((e=>(0,c.jsxs)("option",{value:e,children:[e," rows"]},e)))})}),(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"next",children:(0,c.jsx)(d.A,{className:"mb-2 pull-right btn-pagination",block:!0,color:"purple",onClick:()=>a(t+1),disabled:!n||t+1===n,children:(0,c.jsx)("i",{className:"fa fa-chevron-right"})})})]})};const m=function(e){let{previousPage:t,canPreviousPage:s,pageIndex:n,gotoPage:a,setPageSize:l,pageCount:u,nextPage:h,canNextPage:m,loading:p}=e;return(0,c.jsxs)(i.A,{className:"pagination",children:[(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"previous",children:(0,c.jsx)(d.A,{className:"mb-2 btn-pagination",color:"purple",block:!0,onClick:t,disabled:!u||!s,children:(0,c.jsx)("i",{className:"fa fa-chevron-left"})})}),(0,c.jsxs)(o.A,{xs:"12",sm:"4",className:"paginator",children:[(0,c.jsx)("i",{className:"fa fa-book me-2"}),(0,c.jsx)(r.A,{className:"mb-2",type:"number",value:n+1||1,min:1,max:u,onChange:e=>a(e.target.value?Number(e.target.value)-1:0)}),(0,c.jsxs)("div",{className:"page-count",children:["\xa0/\xa0",p?(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"}):u]})]}),(0,c.jsx)(o.A,{xs:"12",sm:"4",className:"page-size",children:(0,c.jsx)(r.A,{className:"mb-2",type:"select",onChange:e=>{a(0),setTimeout((()=>l(e.target.value)),1e3)},children:[20,50,100,250].map((e=>(0,c.jsxs)("option",{value:e,children:[e," rows"]},e)))})}),(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"next",children:(0,c.jsx)(d.A,{className:"mb-2 pull-right btn-pagination",block:!0,color:"purple",onClick:h,disabled:!u||!m,children:(0,c.jsx)("i",{className:"fa fa-chevron-right"})})})]})};const p=function(e){let{prepareRow:t,row:s,onRowClick:n=!1}=e;return t(s),(0,c.jsx)(i.A,{onClick:()=>n&&n(s.original),className:"g-0",children:s.cells.map((e=>(0,c.jsx)(o.A,{className:-1!==e.column.id.indexOf("hdb-narrow")?"action":"",children:e.render("Cell")},`${e.row.id}-${e.column.id}`)))})};var g=s(3628),f=s(3150);function v(e){let{value:t}=e;return(0,c.jsx)("div",{className:"text-renderer",children:t})}function b(e){let{src:t}=e;const[s,a]=(0,n.useState)(!1),[r,l]=(0,n.useState)(!1);return(0,c.jsxs)("div",{className:"image-renderer",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[(0,c.jsx)("i",{className:"fa fa-image"}),s&&r?(0,c.jsxs)("div",{className:"preview-image no-image",children:[(0,c.jsx)("i",{className:"fa fa-ban text-danger"}),(0,c.jsx)("div",{className:"mt-2",children:"image failed to load"})]}):s?(0,c.jsx)("img",{onError:l,alt:t,src:t,className:"preview-image"}):null]})}const _={Filter:e=>{let{column:{filterValue:t,setFilter:s}}=e;return(0,c.jsx)(r.A,{type:"text",value:t||"",onChange:e=>s(e.target.value||void 0)})},Cell:e=>{let{value:t}=e;return(e=>{switch(Object.prototype.toString.call(e)){case"[object Array]":case"[object Object]":return(0,c.jsx)(v,{value:JSON.stringify(e)});case"[object Boolean]":return(0,c.jsx)(v,{value:e?"true":"false"});case"[object String]":return(t=e)&&(t.match(/^https?.*\.(jpeg|jpg|gif|png)$/)||-1!==t.indexOf("data:image"))?(0,c.jsx)(b,{src:e}):(0,c.jsx)(v,{value:e});default:return(0,c.jsx)(v,{value:e})}var t})(t)}};const x=function(e){let{columns:t,data:s,error:r,currentPage:i,pageSize:o,totalPages:d,onFilteredChange:v,onSortedChange:b,onPageChange:x,onPageSizeChange:j,showFilter:N,onRowClick:A,sorted:k,loading:y,dynamicAttributesFromDataTable:w,tableDescriptionAttributes:C,manual:S=!1}=e;const{headerGroups:P,page:O,rows:E,prepareRow:T,state:R,setAllFilters:F,canPreviousPage:M,canNextPage:$,pageOptions:I,pageCount:L,gotoPage:U,nextPage:z,previousPage:D,setPageSize:G}=(0,a.useTable)({columns:t,data:s,defaultColumn:_,onFilteredChange:v,onSortedChange:b,onPageChange:x,onPageSizeChange:j,onRowClick:A,manualPagination:S,manualFilters:S,initialState:{pageIndex:i,pageSize:o}},a.useFilters,a.usePagination),[B,X]=(0,n.useState)(!0),H=S||!O.length?E:O;return(0,n.useEffect)((()=>{!N&&R.filters.length?F([]):v(R.filters)}),[R.filters,N]),(0,n.useEffect)((()=>{setTimeout((()=>X(!1)),100)}),[null===H||void 0===H?void 0:H.length]),(0,c.jsxs)(l.tH,{onError:(e,t)=>(0,g.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:f.A,children:[(0,c.jsxs)("div",{className:"react-table-scroller",children:[(0,c.jsx)(u,{headerGroups:P,tableDescriptionAttributes:C,dynamicAttributesFromDataTable:w,onSortedChange:b,sorted:k,showFilter:N}),y||B?(0,c.jsx)("div",{className:"centered text-center",children:(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"})}):H.length?H.map((e=>(0,c.jsx)(p,{row:e,prepareRow:T,onRowClick:A},e.id))):(0,c.jsxs)("div",{className:"centered text-center",children:[(0,c.jsx)("i",{className:"fa fa-exclamation-triangle text-danger"}),(0,c.jsx)("div",{className:"mt-2 text-darkgrey",children:r?`Error loading data: ${r}`:"no records"})]})]}),S?(0,c.jsx)(h,{page:i,pageSize:o,totalPages:d,onPageChange:x,onPageSizeChange:j,loading:y}):(0,c.jsx)(m,{previousPage:D,pageSize:o,canPreviousPage:M,pageIndex:R.pageIndex,pageOptions:I,gotoPage:U,setPageSize:G,pageCount:L,nextPage:z,canNextPage:$,loading:y})]})}},2765:(e,t,s)=>{s.d(t,{A:()=>a});var n=s(127);const a=async e=>{let{auth:t,url:s,role:a,permission:r}=e;return(0,n.A)({operation:{operation:"add_role",role:a,permission:r},auth:t,url:s})}},8198:(e,t,s)=>{s.d(t,{A:()=>a});var n=s(127);const a=async e=>{let{auth:t,role:s,username:a,password:r,url:l}=e;return(0,n.A)({operation:{operation:"add_user",role:s,username:a,password:r,active:!0},auth:t,url:l})}},8750:(e,t,s)=>{s.d(t,{A:()=>a});var n=s(127);const a=async e=>{let{auth:t,url:s}=e;return(0,n.A)({operation:{operation:"get_configuration"},auth:t,url:s})}},2415:(e,t,s)=>{s.d(t,{A:()=>r});var n=s(127),a=s(5269);const r=async e=>{let{auth:t,url:s}=e;const r=await(0,n.A)({operation:{operation:"list_roles"},auth:t,url:s}),l=[...Array.isArray(r)?r:[]].sort(((e,t)=>e.role.toLowerCase()>t.role.toLowerCase()?1:-1));return a.A.update((e=>{e.roles=l})),l}},8222:(e,t,s)=>{s.d(t,{A:()=>r});var n=s(127),a=s(5269);const r=async e=>{let{auth:t,url:s,signal:r}=e;const l=await(0,n.A)({operation:{operation:"list_users"},auth:t,url:s,signal:r}),i=Array.isArray(l)?[...l].map((e=>({username:e.username,role:e.role.role}))).sort(((e,t)=>e.username.toLowerCase()>t.username.toLowerCase()?1:-1)):[];return a.A.update((e=>{e.users=i})),i}},2010:(e,t,s)=>{s.d(t,{A:()=>r});var n=s(127),a=s(5269);const r=async e=>{let{auth:t,url:s}=e;return a.A.update((e=>{e.restarting=!0})),(0,n.A)({operation:{operation:"restart"},auth:t,url:s})}},1534:(e,t,s)=>{s.d(t,{A:()=>r});var n=s(127),a=s(5269);const r=async e=>{let{auth:t,url:s,service:r=null}=e;return r?(a.A.update((e=>{e.restarting_service=r})),(0,n.A)({operation:{operation:"restart_service",service:r},auth:t,url:s})):{error:!0,message:"You must specify a service"}}},4834:(e,t,s)=>{s.d(t,{A:()=>a});var n=s(127);const a=async e=>{let{auth:t,url:s,...a}=e;return(0,n.A)({operation:{operation:"set_configuration",...a},auth:t,url:s})}},6177:(e,t,s)=>{s.d(t,{A:()=>o});var n=s(8750),a=s(2415),r=s(8222),l=s(717),i=s(127);const o=async e=>{var t,s,o,c,u,d,h;let{auth:m,url:p}=e;const g=await(0,n.A)({auth:m,url:p}),f=await(0,l.A)({auth:m,url:p}),v=await(async e=>{let{auth:t,url:s}=e;return(0,i.A)({operation:{operation:"cluster_status"},auth:t,url:s})})({auth:m,url:p}),b=parseFloat(null===f||void 0===f?void 0:f.version)>=4?"nats":"socketcluster",_=await(0,a.A)({auth:m,url:p});let x=!1;_.error||(x=_.find((e=>e.permission.cluster_user)));const j=await(0,r.A)({auth:m,url:p});let N=!1;j.error||(N=x&&j.find((e=>e.role===x.role)));const A="nats"===b?null===(t=g.clustering)||void 0===t?void 0:t.enabled:g.CLUSTERING,k="nats"===b?null===(s=g.clustering)||void 0===s?void 0:s.user:g.CLUSTERING_USER,y="nats"===b?null===(o=g.clustering)||void 0===o||null===(c=o.hubServer)||void 0===c||null===(u=c.cluster)||void 0===u||null===(d=u.network)||void 0===d?void 0:d.port:g.CLUSTERING_PORT,w="nats"===b?null===(h=g.clustering)||void 0===h?void 0:h.nodeName:g.NODE_NAME;return{is_ready:!!A&&!!N&&!!k&&!!x&&!!y&&!!w,cluster_role:x,cluster_user:N,is_enabled:A,config_cluster_user:k,config_cluster_port:y,node_name:w,engine:b,status:null===v||void 0===v?void 0:v.status,message:null===v||void 0===v?void 0:v.message,connections:null===v||void 0===v?void 0:v.connections}}},2414:e=>{var t=function(e){return function(e){return!!e&&"object"===typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===s}(e)}(e)};var s="function"===typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?o((s=e,Array.isArray(s)?[]:{}),e,t):e;var s}function a(e,t,s){return e.concat(t).map((function(e){return n(e,s)}))}function r(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function l(e,t){try{return t in e}catch(s){return!1}}function i(e,t,s){var a={};return s.isMergeableObject(e)&&r(e).forEach((function(t){a[t]=n(e[t],s)})),r(t).forEach((function(r){(function(e,t){return l(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,r)||(l(e,r)&&s.isMergeableObject(t[r])?a[r]=function(e,t){if(!t.customMerge)return o;var s=t.customMerge(e);return"function"===typeof s?s:o}(r,s)(e[r],t[r],s):a[r]=n(t[r],s))})),a}function o(e,s,r){(r=r||{}).arrayMerge=r.arrayMerge||a,r.isMergeableObject=r.isMergeableObject||t,r.cloneUnlessOtherwiseSpecified=n;var l=Array.isArray(s);return l===Array.isArray(e)?l?r.arrayMerge(e,s,r):i(e,s,r):n(s,r)}o.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,s){return o(e,s,t)}),{})};var c=o;e.exports=c},4010:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,a=s(9950),r=(n=a)&&n.__esModule?n:{default:n};t.default=function(){return r.default.createElement("svg",{width:"14",height:"11",viewBox:"0 0 14 11"},r.default.createElement("path",{d:"M11.264 0L5.26 6.004 2.103 2.847 0 4.95l5.26 5.26 8.108-8.107L11.264 0",fill:"#fff",fillRule:"evenodd"}))}},1110:(e,t,s)=>{var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},a=function(){function e(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,s,n){return s&&e(t.prototype,s),n&&e(t,n),t}}(),r=s(9950),l=h(r),i=h(s(8738)),o=h(s(1942)),c=h(s(4010)),u=h(s(4990)),d=s(6104);function h(e){return e&&e.__esModule?e:{default:e}}var m=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return s.handleClick=s.handleClick.bind(s),s.handleTouchStart=s.handleTouchStart.bind(s),s.handleTouchMove=s.handleTouchMove.bind(s),s.handleTouchEnd=s.handleTouchEnd.bind(s),s.handleFocus=s.handleFocus.bind(s),s.handleBlur=s.handleBlur.bind(s),s.previouslyChecked=!(!e.checked&&!e.defaultChecked),s.state={checked:!(!e.checked&&!e.defaultChecked),hasFocus:!1},s}return function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"componentDidUpdate",value:function(e){e.checked!==this.props.checked&&this.setState({checked:!!this.props.checked})}},{key:"handleClick",value:function(e){if(!this.props.disabled){var t=this.input;if(e.target!==t&&!this.moved)return this.previouslyChecked=t.checked,e.preventDefault(),t.focus(),void t.click();var s=this.props.hasOwnProperty("checked")?this.props.checked:t.checked;this.setState({checked:s})}}},{key:"handleTouchStart",value:function(e){this.props.disabled||(this.startX=(0,d.pointerCoord)(e).x,this.activated=!0)}},{key:"handleTouchMove",value:function(e){if(this.activated&&(this.moved=!0,this.startX)){var t=(0,d.pointerCoord)(e).x;this.state.checked&&t+15<this.startX?(this.setState({checked:!1}),this.startX=t,this.activated=!0):t-15>this.startX&&(this.setState({checked:!0}),this.startX=t,this.activated=t<this.startX+5)}}},{key:"handleTouchEnd",value:function(e){if(this.moved){var t=this.input;if(e.preventDefault(),this.startX){var s=(0,d.pointerCoord)(e).x;!0===this.previouslyChecked&&this.startX+4>s?this.previouslyChecked!==this.state.checked&&(this.setState({checked:!1}),this.previouslyChecked=this.state.checked,t.click()):this.startX-4<s&&this.previouslyChecked!==this.state.checked&&(this.setState({checked:!0}),this.previouslyChecked=this.state.checked,t.click()),this.activated=!1,this.startX=null,this.moved=!1}}}},{key:"handleFocus",value:function(e){var t=this.props.onFocus;t&&t(e),this.setState({hasFocus:!0})}},{key:"handleBlur",value:function(e){var t=this.props.onBlur;t&&t(e),this.setState({hasFocus:!1})}},{key:"getIcon",value:function(e){var s=this.props.icons;return s?void 0===s[e]?t.defaultProps.icons[e]:s[e]:null}},{key:"render",value:function(){var e=this,t=this.props,s=t.className,a=(t.icons,function(e,t){var s={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n]);return s}(t,["className","icons"])),r=(0,i.default)("react-toggle",{"react-toggle--checked":this.state.checked,"react-toggle--focus":this.state.hasFocus,"react-toggle--disabled":this.props.disabled},s);return l.default.createElement("div",{className:r,onClick:this.handleClick,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEnd},l.default.createElement("div",{className:"react-toggle-track"},l.default.createElement("div",{className:"react-toggle-track-check"},this.getIcon("checked")),l.default.createElement("div",{className:"react-toggle-track-x"},this.getIcon("unchecked"))),l.default.createElement("div",{className:"react-toggle-thumb"}),l.default.createElement("input",n({},a,{ref:function(t){e.input=t},onFocus:this.handleFocus,onBlur:this.handleBlur,className:"react-toggle-screenreader-only",type:"checkbox"})))}}]),t}(r.PureComponent);t.A=m,m.displayName="Toggle",m.defaultProps={icons:{checked:l.default.createElement(c.default,null),unchecked:l.default.createElement(u.default,null)}},m.propTypes={checked:o.default.bool,disabled:o.default.bool,defaultChecked:o.default.bool,onChange:o.default.func,onFocus:o.default.func,onBlur:o.default.func,className:o.default.string,name:o.default.string,value:o.default.string,id:o.default.string,"aria-labelledby":o.default.string,"aria-label":o.default.string,icons:o.default.oneOfType([o.default.bool,o.default.shape({checked:o.default.node,unchecked:o.default.node})])}},6104:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pointerCoord=function(e){if(e){var t=e.changedTouches;if(t&&t.length>0){var s=t[0];return{x:s.clientX,y:s.clientY}}var n=e.pageX;if(void 0!==n)return{x:n,y:e.pageY}}return{x:0,y:0}}},4990:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,a=s(9950),r=(n=a)&&n.__esModule?n:{default:n};t.default=function(){return r.default.createElement("svg",{width:"10",height:"10",viewBox:"0 0 10 10"},r.default.createElement("path",{d:"M9.9 2.12L7.78 0 4.95 2.828 2.12 0 0 2.12l2.83 2.83L0 7.776 2.123 9.9 4.95 7.07 7.78 9.9 9.9 7.776 7.072 4.95 9.9 2.12",fill:"#fff",fillRule:"evenodd"}))}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[741],{7368:(e,t,s)=>{s.r(t),s.d(t,{default:()=>Y});var n=s(9950),i=s(7176),r=s(6114),a=s(3452),l=s(4084),o=s(8156),c=s(6713),d=s(4492),u=s(9435),m=s(9163),p=s.n(m),h=s(5269),_=s(5553),x=s(6359),v=s(7348),A=s(5996),j=s(4414);const g=function(e){let{which:t,compute:s,storage:n,total:a}=e;return(0,j.jsx)(l.A,{className:"my-3",children:(0,j.jsxs)(o.A,{className:"p-2 text-small",children:[(0,j.jsxs)(i.A,{children:[(0,j.jsxs)(r.A,{xs:"6",className:"text-nowrap",children:["Compute","compute"===t&&" (new)"]}),(0,j.jsx)(r.A,{xs:"6",className:"text-nowrap text-end text-truncate",children:s}),(0,j.jsx)(r.A,{xs:"12",children:(0,j.jsx)("hr",{className:"my-1"})})]}),(0,j.jsxs)(i.A,{children:[(0,j.jsxs)(r.A,{xs:"6",className:"text-nowrap",children:["Storage","storage"===t&&" (new)"]}),(0,j.jsx)(r.A,{xs:"6",className:"text-nowrap text-end text-truncate",children:n}),(0,j.jsx)(r.A,{xs:"12",children:(0,j.jsx)("hr",{className:"my-1"})})]}),(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{xs:"6",className:"text-nowrap",children:(0,j.jsx)("b",{children:"New Total"})}),(0,j.jsx)(r.A,{xs:"6",className:"text-nowrap text-end text-truncate",children:(0,j.jsx)("b",{children:a})})]})]})})};var f=s(5887),b=s(1943),y=s(2714);const w=async e=>(0,y.A)({endpoint:"updateInstance",method:"POST",payload:Object.entries({stripe_plan_id:e.stripe_plan_id,compute_stack_id:e.compute_stack_id,customer_id:e.customer_id,data_volume_size:e.data_volume_size,stripe_storage_plan_id:e.stripe_storage_plan_id,compute_subscription_id:e.compute_subscription_id,storage_subscription_id:e.storage_subscription_id}).reduce(((e,t)=>{let[s,n]=t;return null==n||(e[s]=n),e}),{}),auth:e.auth});var O=s(4549);const N=function(e){let{setInstanceAction:t,showPrepaidStorage:s}=e;const{customer_id:u,compute_stack_id:m}=(0,d.g)(),y=(0,d.Zp)(),N=(0,v.MW)(),$=(0,c.O$)(_.A,(e=>e.auth)),k=(0,c.O$)(_.A,(e=>e.hasCard)),C=(0,c.O$)(_.A,(e=>{var t,s;return"invoice.payment_failed"===(null===(t=e.customer)||void 0===t||null===(s=t.current_payment_status)||void 0===s?void 0:s.status)})),S=(0,c.O$)(h.A,(e=>e.compute)),E=(0,c.O$)(h.A,(e=>e.storage)),P=(0,c.O$)(h.A,(e=>e.is_local)),T=(0,c.O$)(h.A,(e=>!["CREATE_COMPLETE","UPDATE_COMPLETE"].includes(e.status))),R=(0,c.O$)(h.A,(e=>e.last_volume_resize)),I=(0,c.O$)(h.A,(e=>e.data_volume_size)),z=(0,c.O$)(_.A,(e=>e.products.cloud_storage.filter((e=>e.value.data_volume_size>=(null===E||void 0===E?void 0:E.data_volume_size))))),D=(0,c.O$)(_.A,(e=>e.subscriptions.cloud_storage.filter((e=>(e.value.data_volume_size===I||e.value.storage_quantity_available>=e.value.data_volume_size)&&e.value.data_volume_size>=(null===E||void 0===E?void 0:E.data_volume_size))))),[L,F]=(0,n.useState)({}),[M,U]=(0,n.useState)({compute_stack_id:m,customer_id:u,...E}),[H,B]=(0,n.useState)(!1),W=s?D:z,q=W.find((e=>e.value.data_volume_size===M.data_volume_size&&e.value.stripe_storage_plan_id===M.stripe_storage_plan_id&&e.value.storage_subscription_id===M.storage_subscription_id)),V=$.orgs.filter((e=>$.user_id===e.owner_user_id)).reduce(((e,t)=>e+t.free_cloud_instance_count),0)<A.A.free_cloud_instance_limit,Y=((null===M||void 0===M?void 0:M.storage_price)||0)+((null===S||void 0===S?void 0:S.compute_price)||0),Z=Y?`${(0,O.A)(Y.toFixed(2))}/${S.compute_interval}`:"FREE",G=!R||(Date.now()-new Date(R).getTime())/1e3/3600>6,K=()=>U({compute_stack_id:m,customer_id:u,...E});return p()(K,[s]),p()((()=>{B((null===E||void 0===E?void 0:E.data_volume_size)!==M.data_volume_size||(null===E||void 0===E?void 0:E.stripe_storage_plan_id)!==M.stripe_storage_plan_id||(null===E||void 0===E?void 0:E.storage_subscription_id)!==M.storage_subscription_id)}),[M]),p()((()=>{B(!1)}),[m]),p()((async()=>{const{submitted:e}=L;if(e){t("Updating");(await w({auth:$,...M})).error?(N.error("There was an error updating your instance. Please try again later."),t(!1)):(window._kmq&&window._kmq.push(["record","upgrade instance - disk size",{totalPrice:null===M||void 0===M?void 0:M.compute_price,currency:"USD",products:[{name:"storage",id:q.data_volume_size_string,price:(null===M||void 0===M?void 0:M.storage_price)||0}]}]),N.success("Instance update initialized successfully"),_.A.update((e=>{e.lastUpdate=Date.now()})),setTimeout((()=>y(`/o/${u}/instances`)),100))}}),[L]),T?(0,j.jsx)(l.A,{className:"error",children:(0,j.jsx)(o.A,{children:"instance updating. please wait."})}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(x.Ay,{className:"react-select-container",classNamePrefix:"react-select",onChange:e=>{let{value:t}=e;return U({...M,...t})},options:W.filter((e=>e.value.active)),value:q,defaultValue:E,isSearchable:!1,isClearable:!1,isLoading:!W,placeholder:"Select Data Volume Size",styles:{placeholder:e=>({...e,textAlign:"center",width:"100%",color:"#BCBCBC"})}}),!H||M.storage_subscription_id||Y||P||V?H&&!G?(0,j.jsx)(l.A,{className:"error mt-3 text-start",children:(0,j.jsxs)(o.A,{children:["You may update disk size every 6 hours",(0,j.jsx)("br",{}),(0,j.jsx)("br",{}),"Last resize: ",new Date(R).toLocaleTimeString(),(0,j.jsx)("br",{}),(0,j.jsx)("br",{}),"Try again at: ",new Date(new Date(R).getTime()+216e5).toLocaleTimeString()]})}):H&&(null!==M&&void 0!==M&&M.storage_price||null!==S&&void 0!==S&&S.compute_price)&&C?(0,j.jsxs)("div",{className:"mt-3",children:[(0,j.jsx)(f.A,{}),(0,j.jsx)(b.A,{disabled:!H||L.submitted,label:"Update Credit Card",onClick:()=>y(`/o/${u}/billing?returnURL=/${u}/i/${m}/config`)})]}):H&&(null!==M&&void 0!==M&&M.storage_price||null!==S&&void 0!==S&&S.compute_price)&&!k?(0,j.jsx)(b.A,{disabled:!H||L.submitted,label:"Add Credit Card To Account",onClick:()=>y(`/o/${u}/billing?returnURL=/${u}/i/${m}/config`)}):H?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(g,{which:"storage",compute:null===S||void 0===S?void 0:S.compute_price_string_with_interval,storage:(null===M||void 0===M?void 0:M.storage_price_string_with_interval)||"FREE",total:Z}),(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{id:"cancelChange",onClick:K,title:"Cancel",block:!0,disabled:L.submitted,color:"grey",children:"Cancel"})}),(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{id:"confirmChange",onClick:()=>F({submitted:!0}),title:"Confirm Instance Details",block:!0,disabled:!H||L.submitted,color:"success",children:"Update"})})]})]}):null:(0,j.jsx)(l.A,{className:"error mt-3",children:(0,j.jsxs)(o.A,{children:["You are limited to ",A.A.free_cloud_instance_limit," free cloud instance",1!==A.A.free_cloud_instance_limit?"s":""]})})]})};const $=function(e){let{setInstanceAction:t,showPrepaidCompute:s}=e;const{customer_id:u,compute_stack_id:m}=(0,d.g)(),y=(0,d.Zp)(),N=(0,v.MW)(),$=(0,c.O$)(_.A,(e=>e.auth)),k=(0,c.O$)(_.A,(e=>e.hasCard)),C=(0,c.O$)(_.A,(e=>{var t,s;return"invoice.payment_failed"===(null===(t=e.customer)||void 0===t||null===(s=t.current_payment_status)||void 0===s?void 0:s.status)})),S=(0,c.O$)(h.A,(e=>e.compute)),E=(0,c.O$)(h.A,(e=>e.storage)),P=(0,c.O$)(h.A,(e=>e.is_local)),T=(0,c.O$)(h.A,(e=>e.wavelength_zone_id)),R=(0,c.O$)(h.A,(e=>e.compute_subscription_id)),I=(0,c.O$)(h.A,(e=>!["CREATE_COMPLETE","UPDATE_COMPLETE"].includes(e.status))),z=(0,c.O$)(_.A,(e=>{var t;return null===(t=e.customer)||void 0===t?void 0:t.is_unpaid})),D=(0,c.O$)(_.A,(e=>e.products[P?"local_compute":T?"wavelength_compute":"cloud_compute"])),L=(0,c.O$)(_.A,(e=>e.subscriptions[P?"local_compute":T?"wavelength_compute":"cloud_compute"].filter((e=>e.value.compute_subscription_id===R||e.value.compute_quantity_available)))),[F,M]=(0,n.useState)({}),[U,H]=(0,n.useState)({compute_stack_id:m,customer_id:u,...S}),[B,W]=(0,n.useState)(!1),q=s?L:D,V=q.find((e=>e.value.stripe_plan_id===U.stripe_plan_id&&e.value.compute_subscription_id===U.compute_subscription_id)),Y=$.orgs.filter((e=>$.user_id===e.owner_user_id)).reduce(((e,t)=>e+t.free_cloud_instance_count),0)<A.A.free_cloud_instance_limit,Z=((null===E||void 0===E?void 0:E.storage_price)||0)+((null===U||void 0===U?void 0:U.compute_price)||0),G=Z?`${(0,O.A)(Z.toFixed(2))}/${S.compute_interval}`:"FREE",K=()=>H({compute_stack_id:m,customer_id:u,...S});return p()(K,[s]),p()((()=>{W((null===S||void 0===S?void 0:S.stripe_plan_id)!==U.stripe_plan_id||U.compute_subscription_id!==(null===S||void 0===S?void 0:S.compute_subscription_id))}),[U]),p()((()=>{W(!1)}),[m]),p()((async()=>{const{submitted:e}=F;if(e)if(Z||U.compute_subscription_id||P||Y){t("Updating");(await w({auth:$,...U})).error?(N.error("There was an error updating your instance. Please try again later."),t(!1)):(window._kmq&&window._kmq.push(["record","upgrade instance - RAM",{totalPrice:null===U||void 0===U?void 0:U.compute_price,currency:"USD",products:[{name:"compute",id:V.compute_ram_string,price:(null===U||void 0===U?void 0:U.compute_price)||0}]}]),N.success("Instance update initialized successfully"),_.A.update((e=>{e.lastUpdate=Date.now()})),setTimeout((()=>y(`/o/${u}/instances`)),100))}else N.error(`You are limited to ${A.A.free_cloud_instance_limit} free cloud instance${1!==A.A.free_cloud_instance_limit?"s":""}`),K(),M({})}),[F]),I?(0,j.jsx)(l.A,{className:"error",children:(0,j.jsx)(o.A,{children:"instance updating. please wait."})}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(x.Ay,{className:"react-select-container",classNamePrefix:"react-select",onChange:e=>{let{value:t}=e;return H({...U,...t})},options:q.filter((e=>e.value.active)),value:V,defaultValue:S,isSearchable:!1,isClearable:!1,isLoading:!q,placeholder:"select a RAM allotment",styles:{placeholder:e=>({...e,textAlign:"center",width:"100%",color:"#BCBCBC"})}}),!B||Z||U.compute_subscription_id||P||Y?B&&(null!==E&&void 0!==E&&E.storage_price||null!==U&&void 0!==U&&U.compute_price)&&C?(0,j.jsxs)("div",{className:"mt-3",children:[(0,j.jsx)(f.A,{}),(0,j.jsx)(b.A,{disabled:!B||F.submitted,label:"Update Credit Card",onClick:()=>y(`/o/${u}/billing?returnURL=/${u}/i/${m}/config`)})]}):B&&(null!==E&&void 0!==E&&E.storage_price||null!==U&&void 0!==U&&U.compute_price)&&!k&&!z?(0,j.jsx)(b.A,{disabled:!B||F.submitted,label:"Add Credit Card To Account",onClick:()=>y(`/o/${u}/billing?returnURL=/${u}/i/${m}/config`)}):B?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(g,{which:"compute",compute:U.compute_price_string_with_interval,storage:(null===E||void 0===E?void 0:E.storage_price_string_with_interval)||"FREE",total:G}),(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{id:"cancelChange",onClick:K,title:"Cancel",block:!0,disabled:F.submitted,color:"grey",children:"Cancel"})}),(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{id:"confirmChange",onClick:()=>M({submitted:!0}),title:"Confirm Instance Details",block:!0,disabled:!B||F.submitted,color:"success",children:"Update"})})]})]}):null:(0,j.jsx)(l.A,{className:"error mt-2",children:(0,j.jsxs)(o.A,{children:["You are limited to ",A.A.free_cloud_instance_limit," free cloud instance",1!==A.A.free_cloud_instance_limit?"s":""]})})]})};var k=s(5488),C=s(6404);const S=function(e){let{setInstanceAction:t}=e;const{customer_id:s,compute_stack_id:u}=(0,d.g)(),m=(0,d.Zp)(),x=(0,v.MW)(),A=(0,c.O$)(_.A,(e=>e.auth)),g=(0,c.O$)(h.A,(e=>e.instance_name)),f=(0,c.O$)(h.A,(e=>e.is_local)),b=(0,c.O$)(h.A,(e=>e.wavelength_zone_id)),y=(0,c.O$)(h.A,(e=>!["CREATE_COMPLETE","UPDATE_COMPLETE"].includes(e.status))),[w,O]=(0,n.useState)({}),[N,$]=(0,n.useState)({});return p()((async()=>{const{submitted:e}=w;if(e){const{delete_instance_name:e}=N;if(g!==e)O({error:"instance name is not correct"});else{t("Removing");(await(0,C.A)({auth:A,customer_id:s,compute_stack_id:u,wavelength_zone_id:b})).error?(x.error("There was an error removing your instance. Please try again later."),t(!1)):(x.success("Instance deletion initiated"),_.A.update((e=>{e.lastUpdate=Date.now()})),setTimeout((()=>m(`/o/${s}/instances`)),3e3))}}}),[w]),y?(0,j.jsx)(l.A,{className:"error",children:(0,j.jsx)(o.A,{children:"instance updating. please wait."})}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(k.A,{id:"instance_name_remove",onChange:e=>$({delete_instance_name:e.target.value}),type:"text",title:"instance_name",placeholder:`Enter "${g}" here to confirm.`,value:N.delete_instance_name||""}),N.delete_instance_name===g&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.A,{className:"my-2",children:(0,j.jsx)(o.A,{className:"px-2 pb-2 pt-3 text-small",children:f?(0,j.jsxs)("ul",{className:"text-small mb-0",children:[(0,j.jsxs)("li",{children:[(0,j.jsx)("b",{children:"DOES NOT"})," uninstall Harper."]}),(0,j.jsxs)("li",{children:[(0,j.jsx)("b",{children:"DOES"})," leave all your data intact."]}),(0,j.jsx)("li",{children:"REMOVES your instance license."}),(0,j.jsx)("li",{children:"STOPS recurring license charges."}),(0,j.jsx)("li",{children:"LIMITS instance to 1GB RAM."}),(0,j.jsx)("li",{children:"REMOVES instance from the Studio."}),(0,j.jsx)("li",{children:"RESTARTS the instance."})]}):(0,j.jsxs)("ul",{className:"text-small mb-0",children:[(0,j.jsxs)("li",{children:[(0,j.jsx)("b",{children:"THIS IS"})," an irreversible process."]}),(0,j.jsxs)("li",{children:[(0,j.jsx)("b",{children:"IT CANNOT"})," be undone."]}),(0,j.jsx)("li",{children:"DELETES your instance completely."}),(0,j.jsx)("li",{children:"STOPS recurring license charges."}),(0,j.jsx)("li",{children:"REMOVES instance from the Studio."})]})})}),(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{id:"cancelDeleteInstance",onClick:()=>$({delete_instance_name:""}),title:"Cancel",block:!0,disabled:w.submitted,color:"grey",children:"Cancel"})}),(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{id:"removeInstance",onClick:()=>O({submitted:!0}),title:"Confirm Instance Details",block:!0,disabled:w.submitted,color:"danger",children:"Remove"})})]})]})]})};var E=s(135),P=s(5911),T=s(2010);const R=function(e){let{instanceAction:t,setInstanceAction:s}=e;const d=(0,v.MW)(),u=(0,c.O$)(h.A,(e=>e.auth)),m=(0,c.O$)(h.A,(e=>e.url)),_=(0,c.O$)(h.A,(e=>e.instance_name)),x=(0,c.O$)(h.A,(e=>!["CREATE_COMPLETE","UPDATE_COMPLETE"].includes(e.status))),[g,f]=(0,n.useState)({}),[b,y]=(0,n.useState)({});return p()((async()=>{const{submitted:e}=g;if(e){s("Restarting");const e=await(0,T.A)({auth:u,url:m});null!==e&&void 0!==e&&e.error&&(s(!1),d.error("There was an error restarting your instance. Please try again later."))}}),[g]),(0,E.A)((()=>{"Restarting"===t&&(async()=>{(await(0,P.A)({auth:u,url:m})).error||(y({}),f({}),s(!1),d.success("Instance restarted successfully"))})()}),A.A.refresh_content_interval),"Restarting"===t?(0,j.jsx)(l.A,{className:"error",children:(0,j.jsxs)(o.A,{children:[(0,j.jsx)("i",{className:"fa fa-spin fa-spinner me-2"}),"instance restarting. please wait."]})}):!A.A.is_local_studio&&x?(0,j.jsx)(l.A,{className:"error",children:(0,j.jsx)(o.A,{children:"instance updating. please wait."})}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(k.A,{id:"instance_name_restart",onChange:e=>y({restart_instance_name:e.target.value}),type:"text",title:"instance_name",placeholder:`Enter "${_}" here to confirm.`,value:b.restart_instance_name||""}),b.restart_instance_name===_&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.A,{className:"my-2",children:(0,j.jsx)(o.A,{className:"px-2 pb-2 pt-3 text-small",children:(0,j.jsxs)("ul",{className:"text-small mb-0",children:[(0,j.jsxs)("li",{children:[(0,j.jsx)("b",{children:"WILL"})," interrupt connectivity."]}),(0,j.jsxs)("li",{children:[(0,j.jsx)("b",{children:"WILL"})," leave all your data intact."]})]})})}),(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{onClick:()=>y({restart_instance_name:""}),title:"Cancel",block:!0,disabled:g.submitted,color:"grey",children:"Cancel"})}),(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{onClick:()=>f({submitted:!0}),title:"Confirm Instance Details",block:!0,disabled:g.submitted,color:"danger",children:"Restart"})})]})]})]})};var I=s(1652),z=s(7666);const D=function(e){var t,s,n,a,d,u,m,p,_,x,v,g,f,b,y,w,O,N;let{clusterNodeName:$,instanceConfig:k}=e;const C=(0,c.O$)(h.A,(e=>e.url)),S=(0,c.O$)(h.A,(e=>e.auth)),E=(0,c.O$)(h.A,(e=>e.totalPriceStringWithInterval)),P=(0,c.O$)(h.A,(e=>e.compute)),T=(0,c.O$)(h.A,(e=>!!e.compute_subscription_id)),R=(0,c.O$)(h.A,(e=>!!e.storage_subscription_id)),D=(0,c.O$)(h.A,(e=>e.creation_date)),L=(0,c.O$)(h.A,(e=>e.instance_region)),F=(0,c.O$)(h.A,(e=>e.storage)),M=(0,c.O$)(h.A,(e=>e.is_local)),U=null!==S&&void 0!==S&&S.user?`${btoa(`${S.user}:${S.pass}`)}`:"...",H=M?"HARDWARE LIMIT":`${null===F||void 0===F?void 0:F.iops}`,B=D?new Date(D).toLocaleDateString():"N/A",{hostname:W,origin:q}=window.location,V=new URL(A.A.is_local_studio?q:C),Y=A.A.is_local_studio?`${null!==(m=k.operationsApi)&&void 0!==m&&null!==(p=m.network)&&void 0!==p&&p.securePort?"https://":"http://"}${W}:${(null===(_=k.operationsApi)||void 0===_||null===(x=_.network)||void 0===x?void 0:x.securePort)||(null===(v=k.operationsApi)||void 0===v||null===(g=v.network)||void 0===g?void 0:g.port)}`:`${null!==(t=k.operationsApi)&&void 0!==t&&null!==(s=t.network)&&void 0!==s&&s.securePort?"https://":"http://"}${V.hostname}:${(null===(n=k.operationsApi)||void 0===n||null===(a=n.network)||void 0===a?void 0:a.securePort)||(null===(d=k.operationsApi)||void 0===d||null===(u=d.network)||void 0===u?void 0:u.port)}`,Z=A.A.is_local_studio?`${null!==(w=k.http)&&void 0!==w&&w.securePort?"https://":"http://"}${W}:${(null===(O=k.http)||void 0===O?void 0:O.securePort)||(null===(N=k.http)||void 0===N?void 0:N.port)}`:`${null!==(f=k.http)&&void 0!==f&&f.securePort?"https://":"http://"}${V.hostname}:${(null===(b=k.http)||void 0===b?void 0:b.securePort)||(null===(y=k.http)||void 0===y?void 0:y.port)}`,G=(0,c.O$)(h.A,(e=>{var t;return null===(t=e.registration)||void 0===t?void 0:t.version})),[K,J]=(null===G||void 0===G?void 0:G.split("."))||[],Q=parseFloat(`${K}.${J}`);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("span",{className:"floating-card-header",children:"instance overview"}),(0,j.jsx)(l.A,{className:"mt-3 mb-4 instance-details",children:(0,j.jsx)(o.A,{children:(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{md:"4",xs:"12",children:(0,j.jsx)(I.A,{header:"Instance URL",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:(0,j.jsx)(z.A,{text:Y})})})}),(0,j.jsx)(r.A,{md:"4",xs:"12",children:(0,j.jsx)(I.A,{header:(Q>=4.2?"Applications":"Custom Functions")+" URL",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:(0,j.jsx)(z.A,{text:Z})})})}),(0,j.jsx)(r.A,{md:"4",xs:"12",children:(0,j.jsx)(I.A,{header:"Instance Node Name (for clustering)",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:$?(0,j.jsx)(z.A,{text:$}):"clustering not enabled"})})}),!A.A.is_local_studio&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.A,{md:"4",xs:"12",children:(0,j.jsx)(I.A,{header:"Instance API Auth Header (this user)",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:(0,j.jsx)(z.A,{text:U,beforeText:"Basic ",obscure:!0})})})}),(0,j.jsx)(r.A,{md:"2",sm:"4",xs:"6",children:(0,j.jsx)(I.A,{header:"Created",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:B})})}),L&&(0,j.jsx)(r.A,{md:"2",sm:"4",xs:"6",children:(0,j.jsx)(I.A,{header:"Region",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:L})})}),(0,j.jsx)(r.A,{md:"2",sm:"4",xs:"6",children:(0,j.jsx)(I.A,{header:"Total Price",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:E})})}),(0,j.jsx)(r.A,{md:"2",sm:"4",xs:"6",children:(0,j.jsx)(I.A,{header:"RAM",className:"mb-3",children:(0,j.jsxs)("div",{className:"nowrap-scroll",children:[null===P||void 0===P?void 0:P.compute_ram_string," ",T&&"(PREPAID)"]})})}),!M&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.A,{md:"2",sm:"4",xs:"6",children:(0,j.jsx)(I.A,{header:"Storage",className:"mb-3 text-nowrap",children:(0,j.jsxs)("div",{className:"nowrap-scroll",children:[null===F||void 0===F?void 0:F.data_volume_size_string," ",R&&"(PREPAID)"]})})}),(0,j.jsx)(r.A,{md:"2",sm:"4",xs:"6",children:(0,j.jsx)(I.A,{header:"Disk IOPS",className:"mb-3 text-nowrap",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:H})})})]})]})]})})})]})};var L=s(4979),F=s(3150),M=s(3628),U=s(7596),H=s(5012),B=s(2594);const W=function(e){let{instanceConfig:t}=e;const s=(0,c.O$)(_.A,(e=>e.theme));return(0,j.jsx)(B.A,{placeholder:t,height:"calc(100vh - 568px)",theme:"light_mitsuketa_tribute",viewOnly:!0,colors:{background:"transparent",default:"dark"===s?"#aaa":"#000",colon:"dark"===s?"#aaa":"#000",keys:"dark"===s?"#aaa":"#000",string:"#13c664",number:"#ea4c89",primitive:"#ffa500"},style:{warningBox:{display:"none"},body:{padding:"8px 0 0 0"}},locale:H.A,width:"100%",confirmGood:!1,waitAfterKeyPress:3e4})};var q=s(8750);const V=function(){return(0,j.jsx)("div",{className:"configLoader",children:(0,j.jsx)("i",{className:"fa fa-spinner fa-spin"})})};const Y=function(){const{customer_id:e,compute_stack_id:t}=(0,d.g)(),s=(0,c.O$)(_.A,(e=>e.auth)),m=(0,c.O$)(_.A,(e=>e.theme)),x=(0,c.O$)(h.A,(e=>e.auth),[t]),v=(0,c.O$)(h.A,(e=>e.url),[t]),A=(0,c.O$)(_.A,(e=>{var t;return null===(t=e.customer)||void 0===t?void 0:t.stripe_id})),g=(0,c.O$)(h.A,(e=>e.is_local),[t]),f=(0,c.O$)(h.A,(e=>{var t;return parseFloat(null===(t=e.registration)||void 0===t?void 0:t.version)>=4?"nats":"socketcluster"}),[t]),b=(0,c.O$)(h.A,(e=>e.compute_subscription_id),[t]),y=(0,c.O$)(h.A,(e=>e.storage_subscription_id),[t]),w=(0,c.O$)(_.A,(t=>{var s,n;return null===(s=t.auth)||void 0===s||null===(n=s.orgs)||void 0===n?void 0:n.find((t=>{var s;return(null===(s=t.customer_id)||void 0===s?void 0:s.toString())===e}))}),[e]),O="owner"===(null===w||void 0===w?void 0:w.status),[k,C]=(0,n.useState)(!1),[E,P]=(0,n.useState)(!1),[T,I]=(0,n.useState)(""),z=(0,c.O$)(_.A,(e=>{var t;return(null===(t=e.subscriptions[g?"local_compute":"cloud_compute"])||void 0===t?void 0:t.filter((e=>!e.value.compute_subscription_name||e.value.compute_quantity_available)))||[]})),H=(0,c.O$)(_.A,(e=>{var t,s;return(null===(t=e.subscriptions)||void 0===t||null===(s=t.cloud_storage)||void 0===s?void 0:s.filter((e=>!e.value.storage_subscription_name||e.value.storage_quantity_available)))||[]})),[B,Y]=(0,n.useState)(!!b),[Z,G]=(0,n.useState)(!!y);return p()((async()=>{s&&e&&A&&(0,U.A)({auth:s,customer_id:e,stripe_id:A})}),[s,e,A]),p()((async()=>{if(x&&v){I("..."),P(!1);const t=await(0,q.A)({auth:x,url:v});if(!t.error){var e;const s="nats"===f?null===(e=t.clustering)||void 0===e?void 0:e.nodeName:t.NODE_NAME;I(s),P(t)}}}),[x]),k&&"Restarting"!==k?(0,j.jsx)(L.A,{header:`${k} Instance`,spinner:!0}):(0,j.jsxs)(i.A,{id:"config",children:[(0,j.jsx)(r.A,{xs:"12",children:(0,j.jsx)(u.tH,{onError:(e,t)=>(0,M.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:F.A,children:(0,j.jsx)(D,{clusterNodeName:T,instanceConfig:E})})}),O&&"akamai"!==m&&(0,j.jsxs)(r.A,{lg:"3",sm:"6",xs:"12",children:[(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{children:(0,j.jsx)("span",{className:"floating-card-header",children:"update ram"})}),(0,j.jsx)(r.A,{className:"text-end",children:(!!b||!!z.length)&&(0,j.jsxs)("span",{className:"floating-card-header",children:["prepaid:"," ",(0,j.jsx)(a.A,{id:"showPrepaidCompute",color:"link",onClick:()=>Y(!B),children:(0,j.jsx)("i",{className:"fa fa-lg fa-toggle-"+(B?"on":"off")})})]})})]}),(0,j.jsx)(l.A,{className:"my-3",children:(0,j.jsx)(o.A,{children:(0,j.jsx)(u.tH,{onError:(e,t)=>(0,M.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:F.A,children:E?(0,j.jsx)($,{setInstanceAction:C,showPrepaidCompute:B}):(0,j.jsx)(V,{})})})})]}),O&&!g&&"akamai"!==m&&(0,j.jsxs)(r.A,{lg:"3",sm:"6",xs:"12",children:[(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{children:(0,j.jsx)("span",{className:"floating-card-header",children:"update storage"})}),(0,j.jsx)(r.A,{className:"text-end",children:(!!y||!!H.length)&&(0,j.jsxs)("span",{className:"floating-card-header",children:["prepaid:"," ",(0,j.jsx)(a.A,{id:"showPrepaidStorage",color:"link",onClick:()=>G(!Z),children:(0,j.jsx)("i",{className:"fa fa-lg fa-toggle-"+(Z?"on":"off")})})]})})]}),(0,j.jsx)(l.A,{className:"my-3",children:(0,j.jsx)(o.A,{children:(0,j.jsx)(u.tH,{onError:(e,t)=>(0,M.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:F.A,children:E?(0,j.jsx)(N,{setInstanceAction:C,showPrepaidStorage:Z}):(0,j.jsx)(V,{})})})})]}),O&&(0,j.jsxs)(r.A,{lg:"3",sm:"6",xs:"12",children:[(0,j.jsx)("span",{className:"floating-card-header",children:"remove instance"}),(0,j.jsx)(l.A,{className:"my-3",children:(0,j.jsx)(o.A,{children:(0,j.jsx)(u.tH,{onError:(e,t)=>(0,M.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:F.A,children:(0,j.jsx)(S,{setInstanceAction:C,instanceAction:k})})})})]}),(0,j.jsxs)(r.A,{lg:"3",sm:"6",xs:"12",children:[(0,j.jsx)("span",{className:"floating-card-header",children:"restart instance"}),(0,j.jsx)(l.A,{className:"my-3",children:(0,j.jsx)(o.A,{children:(0,j.jsx)(u.tH,{onError:(e,t)=>(0,M.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:F.A,children:(0,j.jsx)(R,{setInstanceAction:C,instanceAction:k})})})})]}),(0,j.jsxs)(r.A,{xs:"12",children:[(0,j.jsx)("span",{className:"floating-card-header",children:"instance config (read only)"}),(0,j.jsx)(l.A,{className:"mt-3 mb-4",children:(0,j.jsx)(o.A,{className:"p-0",children:(0,j.jsx)(u.tH,{onError:(e,t)=>(0,M.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:F.A,children:E?(0,j.jsx)(W,{instanceConfig:E}):(0,j.jsx)(V,{})})})})]})]})}},5887:(e,t,s)=>{s.d(t,{A:()=>i});s(9950);var n=s(4414);const i=function(){return(0,n.jsxs)("div",{className:"text-danger",children:[(0,n.jsx)("i",{children:"Your most recent card payment failed. Please update your card below."}),(0,n.jsx)("hr",{className:"mt-3 mb-2"})]})}},1652:(e,t,s)=>{s.d(t,{A:()=>i});s(9950);var n=s(4414);const i=function(e){let{children:t,header:s,subheader:i,maxHeight:r="auto",minHeight:a="auto",className:l}=e;return(0,n.jsxs)("div",{className:`content-container ${l}`,children:[(0,n.jsxs)("div",{className:"header-container",children:[(0,n.jsx)("span",{className:"header",children:s}),(0,n.jsx)("span",{className:"subheader",children:i})]}),(0,n.jsx)("div",{className:"auto"!==r?"scrollable":"",style:{maxHeight:r,minHeight:a},children:t})]})}},7666:(e,t,s)=>{s.d(t,{A:()=>c});var n=s(9950),i=s(7176),r=s(6114),a=s(3452),l=s(7348),o=s(4414);const c=function(e){let{text:t,beforeText:s,afterText:c,obscure:d=!1}=e;const u=(0,l.MW)(),m=navigator.clipboard,p=(0,n.useCallback)((async e=>{e.stopPropagation(),await navigator.clipboard.writeText(t),u.success("Text copied to clipboard")}),[u,t]);return(0,o.jsxs)(i.A,{className:"copyable-text-holder g-0",children:[m&&t&&(0,o.jsx)(r.A,{className:"copy-icon",children:(0,o.jsx)(a.A,{title:"Copy this value",onClick:p,color:"link",children:(0,o.jsx)("i",{className:"fa fa-copy text-small"})})}),(0,o.jsx)(r.A,{className:"text-container",children:t?(0,o.jsxs)(o.Fragment,{children:[s,d?t.replace(/./g,"*"):t,c]}):(0,o.jsx)("span",{children:"\xa0"})})]})}},1943:(e,t,s)=>{s.d(t,{A:()=>r});s(9950);var n=s(3452),i=s(4414);const r=function(e){let{disabled:t,label:s,onClick:r}=e;return(0,i.jsx)(n.A,{onClick:r,title:s,block:!0,disabled:t,color:"danger",className:"mt-2",id:"visitCreditCard",children:s})}},8750:(e,t,s)=>{s.d(t,{A:()=>i});var n=s(127);const i=async e=>{let{auth:t,url:s}=e;return(0,n.A)({operation:{operation:"get_configuration"},auth:t,url:s})}},2010:(e,t,s)=>{s.d(t,{A:()=>r});var n=s(127),i=s(5269);const r=async e=>{let{auth:t,url:s}=e;return i.A.update((e=>{e.restarting=!0})),(0,n.A)({operation:{operation:"restart"},auth:t,url:s})}},6404:(e,t,s)=>{s.d(t,{A:()=>i});var n=s(2714);const i=async e=>{let{auth:t,customer_id:s,compute_stack_id:i,is_verizon:r,is_akamai:a}=e;return(0,n.A)({endpoint:r?"wl/removeWavelengthInstance":a?"removeAkamaiInstance":"removeInstance",method:"POST",payload:{customer_id:s,compute_stack_id:i,compute_stack_wl_id:i},auth:t})}},5488:(e,t,s)=>{s.d(t,{A:()=>g});var n=s(9950),i=s(1942),r=s.n(i),a=s(8738),l=s.n(a),o=s(1497);function c(e){return c="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},c(e)}var d=["className","cssModule","type","bsSize","valid","invalid","tag","addon","plaintext","innerRef"];function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},u.apply(this,arguments)}function m(e,t){if(null==e)return{};var s,n,i=function(e,t){if(null==e)return{};var s,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)s=r[n],t.indexOf(s)>=0||(i[s]=e[s]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)s=r[n],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(i[s]=e[s])}return i}function p(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function _(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 s,n=v(e);if(t){var i=v(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return function(e,t){if(t&&("object"===c(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return x(e)}(this,s)}}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}var A={children:r().node,type:r().string,size:r().oneOfType([r().number,r().string]),bsSize:r().string,valid:r().bool,invalid:r().bool,tag:o.Wx,innerRef:r().oneOfType([r().object,r().func,r().string]),plaintext:r().bool,addon:r().bool,className:r().string,cssModule:r().object},j=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&&h(e,t)}(a,e);var t,s,i,r=_(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=r.call(this,e)).getRef=t.getRef.bind(x(t)),t.focus=t.focus.bind(x(t)),t}return t=a,(s=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"focus",value:function(){this.ref&&this.ref.focus()}},{key:"render",value:function(){var e=this.props,t=e.className,s=e.cssModule,i=e.type,r=void 0===i?"text":i,a=e.bsSize,c=e.valid,p=e.invalid,h=e.tag,_=e.addon,x=e.plaintext,v=e.innerRef,A=m(e,d),j=["switch","radio","checkbox"].indexOf(r)>-1,g="select"===r,f="range"===r,b=h||(g||"textarea"===r?r:"input"),y="form-control";x?(y="".concat(y,"-plaintext"),b=h||"input"):f?y="form-range":g?y="form-select":j&&(y=_?null:"form-check-input"),A.size&&/\D/g.test(A.size)&&((0,o.mc)('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'),a=A.size,delete A.size);var w=(0,o.qO)(l()(t,p&&"is-invalid",c&&"is-valid",!!a&&(g?"form-select-".concat(a):"form-control-".concat(a)),y),s);return("input"===b||h&&"function"===typeof h)&&(A.type="switch"===r?"checkbox":r),A.children&&!x&&"select"!==r&&"string"===typeof b&&"select"!==b&&((0,o.mc)('Input with a type of "'.concat(r,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete A.children),n.createElement(b,u({},A,{ref:v,className:w,"aria-invalid":p}))}}])&&p(t.prototype,s),i&&p(t,i),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Component);j.propTypes=A;const g=j}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[18],{4016:(e,l,s)=>{s.r(l),s.d(l,{default:()=>I});var a=s(9950),t=s(7176),r=s(6114),n=s(1646),o=s(5488),i=s(3452),c=s(6359),d=s(7348),m=s(6713),u=s(4084),x=s(8156),h=s(6685),g=s(1340),p=s(877),v=s(135),f=s(9435),j=s(4492),b=s(5269),A=s(5553),N=s(5996),w=s(127);var y=s(7209),O=s(4414);const S=function(e){let{onRowClick:l,level:s,timestamp:a,message:n,tags:o,thread:i}=e;return(0,O.jsxs)(t.A,{xs:"12",md:"12",className:"item-row",onClick:l,children:[(0,O.jsx)(r.A,{xs:"2",md:"1",className:`text-nowrap ${null===s||void 0===s?void 0:s.toLowerCase()}`,children:(null===s||void 0===s?void 0:s.toUpperCase())||"UNKNOWN"}),(0,O.jsx)(r.A,{xs:"2",md:"2",lg:"1",children:new Date(a||null).toLocaleDateString()}),(0,O.jsx)(r.A,{xs:"2",md:"2",lg:"1",children:new Date(a||null).toLocaleTimeString()}),(0,O.jsx)(r.A,{xs:"2",md:"1",lg:"1",children:i}),(0,O.jsx)(r.A,{xs:"2",md:"2",lg:"1",children:null===o||void 0===o?void 0:o.join(", ")}),(0,O.jsx)(r.A,{xs:"2",md:"4",lg:"7",children:(0,y.A)(n)&&n.error?n.error:(0,O.jsx)("pre",{children:(0,O.jsx)("code",{children:n})})})]})};var k=s(3150),L=s(3628);let C;const F=async e=>{let{auth:l,url:s,logsFilter:a}=e;C=new AbortController,await(async e=>{let{auth:l,url:s,signal:a,logsFilter:t}=e;const r=await(0,w.A)({operation:{operation:"read_log",start:0,...t,order:"desc"},auth:l,url:s,signal:a});return b.A.update((e=>{e.logs=r.error?[]:(null===r||void 0===r?void 0:r.filter((e=>e.message)))||[],e.logsError=!1}))})({auth:l,url:s,signal:C.signal,logsFilter:a})};const T=function(e){var l,s,n,o,c;let{logsFilter:d}=e;const{compute_stack_id:w}=(0,j.g)(),y=(0,m.O$)(b.A,(e=>e.auth)),T=(0,m.O$)(b.A,(e=>e.url)),D=(0,m.O$)(b.A,(e=>e.logs),[w]),I=(0,m.O$)(b.A,(e=>e.logsError)),E=(0,m.O$)(A.A,(e=>e.theme)),[U,z]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!0),[$,_]=(0,a.useState)(!0),[M,V]=(0,a.useState)(!1),[W,q]=(0,a.useState)({}),G=()=>V(!M);return(0,a.useEffect)((()=>(y&&(R(!0),F({auth:y,url:T,logsFilter:d}),R(!1)),()=>{var e;null===(e=C)||void 0===e||e.abort()})),[y,$,d]),(0,v.A)((()=>y&&U&&_(Date.now())),N.A.refresh_content_interval),(0,O.jsxs)(f.tH,{onError:(e,l)=>(0,L.A)({error:{message:e.message,componentStack:l}}),FallbackComponent:k.A,children:[(0,O.jsxs)(t.A,{className:"floating-card-header",children:[(0,O.jsx)(r.A,{children:"logs"}),(0,O.jsxs)(r.A,{className:"text-end",children:[(0,O.jsx)(i.A,{color:"link",title:"Update Logs",className:"me-2",onClick:()=>_(Date.now()),children:(0,O.jsx)("i",{className:"fa "+(P?"fa-spinner fa-spin":"fa-sync-alt")})}),(0,O.jsxs)(i.A,{color:"link",title:"Turn on auto refresh",onClick:()=>z(!U),children:[(0,O.jsx)("span",{className:"me-2",children:"auto"}),(0,O.jsx)("i",{className:"fa fa-lg fa-toggle-"+(U?"on":"off")})]})]})]}),(0,O.jsx)(u.A,{className:"my-3",children:(0,O.jsxs)(x.A,{className:"item-list",children:[(0,O.jsxs)(t.A,{xs:"12",md:"12",className:"header",children:[(0,O.jsx)(r.A,{xs:"2",md:"1",className:"text-bold text-nowrap",children:"Status"}),(0,O.jsx)(r.A,{xs:"2",md:"2",lg:"1",className:"text-bold text-nowrap",children:"Date"}),(0,O.jsx)(r.A,{xs:"2",md:"2",lg:"1",className:"text-left text-bold text-nowrap",children:!P&&I?(0,O.jsxs)("span",{className:"text-danger",children:["log fetch error: ",(new Date).toLocaleTimeString().toLowerCase()]}):(0,O.jsx)("span",{children:"Time"})}),(0,O.jsx)(r.A,{xs:"2",md:"1",lg:"1",className:"text-bold text-nowrap",children:"Thread"}),(0,O.jsx)(r.A,{xs:"2",md:"2",lg:"1",className:"text-bold text-nowrap",children:"Tags"}),(0,O.jsx)(r.A,{xs:"2",md:"3",lg:"7",className:"text-bold text-nowrap",children:"Message"})]}),(0,O.jsx)("hr",{className:"mt-1 mb-0"}),(0,O.jsx)("div",{className:"item-scroller",children:!P||D||U?D&&D.length?D.map(((e,l)=>(0,O.jsx)(S,{level:e.level,timestamp:e.timestamp,message:e.message,tags:e.tags,thread:e.thread,onRowClick:()=>{q(e),G()}},e.timestamp+l))):D&&!D.length?(0,O.jsx)("div",{className:"pt-5 text-center",children:"no logs found"}):(0,O.jsx)("div",{className:"pt-5 text-center",children:"no logs found in this view"}):(0,O.jsx)("div",{className:"pt-5 text-center",children:(0,O.jsx)("i",{className:"fa fa-spinner fa-spin text-lightgrey"})})})]})}),(0,O.jsx)("br",{}),(0,O.jsxs)(h.A,{isOpen:M,className:E,centered:!0,fade:!1,id:"log-info-modal",children:[(0,O.jsx)(g.A,{toggle:G,children:"View Log Info"}),(0,O.jsx)(p.A,{children:W&&(0,O.jsxs)("div",{children:[(0,O.jsxs)("p",{children:[(0,O.jsx)("b",{children:"Level:"})," ",(0,O.jsx)("span",{className:`${null===W||void 0===W||null===(l=W.level)||void 0===l?void 0:l.toLowerCase()}`,children:null===W||void 0===W||null===(s=W.level)||void 0===s?void 0:s.toUpperCase()})]}),(0,O.jsx)("p",{className:"mb-1",children:(0,O.jsx)("b",{children:"Timestamp(UTC):"})}),(0,O.jsx)("span",{children:null===W||void 0===W?void 0:W.timestamp}),(0,O.jsxs)("p",{className:"mt-4",children:[(0,O.jsx)("b",{children:"Thread:"})," ",null===W||void 0===W?void 0:W.thread]}),(0,O.jsxs)("p",{children:[(0,O.jsx)("b",{children:"Tags:"})," ",null===W||void 0===W||null===(n=W.tags)||void 0===n?void 0:n.join(", ")]}),(0,O.jsx)("p",{className:"mb-2",children:(0,O.jsx)("b",{children:"Message:"})}),(0,O.jsx)("pre",{children:null!==W&&void 0!==W&&null!==(o=W.message)&&void 0!==o&&o.error?null===W||void 0===W||null===(c=W.message)||void 0===c?void 0:c.error:null===W||void 0===W?void 0:W.message})]})})]})]})},D={limit:1e3,level:void 0,from:void 0,until:void 0};const I=function(){const[e,l]=(0,a.useState)(D),s=(0,a.useRef)(),m=(0,a.useRef)(),u=(0,a.useRef)(),x=(0,d.MW)();return(0,O.jsxs)(t.A,{id:"logs",children:[(0,O.jsxs)(r.A,{lg:"2",xs:"12",children:[(0,O.jsx)("h2",{className:"mb-3 filters-header",children:"Log Filters"}),(0,O.jsx)("form",{onSubmit:e=>{var s,a;(e.preventDefault(),s=e.target.elements.logFromInput.value,a=e.target.elements.logUntilInput.value,!s&&!a||!s||!a||new Date(s)<=new Date(a))?l({limit:parseInt(e.target.elements.logLimitSelect.value,10)||1e3,level:e.target.elements.logLevelSelect.value||void 0,from:e.target.elements.logFromInput.value||void 0,until:e.target.elements.logUntilInput.value||void 0}):x.error("Please provide a valid date range.")},onReset:()=>{s.current.reset(),m.current.clearValue(),u.current.clearValue(),l(D)},ref:s,children:(0,O.jsxs)(t.A,{children:[(0,O.jsx)(r.A,{xs:"6",lg:"12",className:"mb-3",children:(0,O.jsx)(c.Ay,{name:"logLimitSelect",isSearchable:!1,className:"react-select-container",classNamePrefix:"react-select",ref:m,placeholder:"Log Limit",options:[{value:1e3,label:"1000"},{value:500,label:"500"},{value:250,label:"250"},{value:100,label:"100"},{value:10,label:"10"}]})}),(0,O.jsx)(r.A,{xs:"6",lg:"12",className:"mb-3",children:(0,O.jsx)(c.Ay,{name:"logLevelSelect",isSearchable:!1,className:"react-select-container",classNamePrefix:"react-select",ref:u,placeholder:"Log Level",defaultValue:null,options:[{value:null,label:"All"},{value:"notify",label:"Notify"},{value:"error",label:"Error"},{value:"warn",label:"Warn"},{value:"info",label:"Info"},{value:"debug",label:"Debug"},{value:"trace",label:"Trace"}]})}),(0,O.jsxs)(r.A,{xs:"8",lg:"12",className:"mb-3",children:[(0,O.jsx)(n.A,{htmlFor:"logFromInput",className:"input-label",children:"Start Date:"}),(0,O.jsx)(o.A,{name:"logFromInput",type:"datetime-local"})]}),(0,O.jsxs)(r.A,{xs:"8",lg:"12",className:"mb-3",children:[(0,O.jsx)(n.A,{htmlFor:"logUntilInput",className:"input-label",children:"End Date:"}),(0,O.jsx)(o.A,{name:"logUntilInput",type:"datetime-local"})]}),(0,O.jsx)(r.A,{xs:"6",lg:"12",className:"mb-3",children:(0,O.jsx)(i.A,{type:"submit",className:"btn btn-purple px-4 w-100",children:"Apply"})}),(0,O.jsx)(r.A,{xs:"6",lg:"12",className:"mb-3",children:(0,O.jsx)(i.A,{type:"reset",className:"btn btn-purple px-4 w-100",children:"Reset"})})]})})]}),(0,O.jsx)(r.A,{lg:"10",xs:"12",children:(0,O.jsx)(T,{logsFilter:e})})]})}},7209:(e,l,s)=>{s.d(l,{A:()=>a});const a=e=>"object"===typeof e&&!Array.isArray(e)&&null!==e},1646:(e,l,s)=>{s.d(l,{A:()=>j});var a=s(9950),t=s(1942),r=s.n(t),n=s(8738),o=s.n(n),i=s(1497),c=["className","cssModule","hidden","widths","tag","check","size","for"];function d(){return d=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},d.apply(this,arguments)}function m(e,l,s){return l in e?Object.defineProperty(e,l,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[l]=s,e}function u(e,l){if(null==e)return{};var s,a,t=function(e,l){if(null==e)return{};var s,a,t={},r=Object.keys(e);for(a=0;a<r.length;a++)s=r[a],l.indexOf(s)>=0||(t[s]=e[s]);return t}(e,l);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)s=r[a],l.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(t[s]=e[s])}return t}var x=["xs","sm","md","lg","xl","xxl"],h=r().oneOfType([r().number,r().string]),g=r().oneOfType([r().bool,r().string,r().number,r().shape({size:h,order:h,offset:h})]),p={children:r().node,hidden:r().bool,check:r().bool,size:r().string,for:r().string,tag:i.Wx,className:r().string,cssModule:r().object,xs:g,sm:g,md:g,lg:g,xl:g,xxl:g,widths:r().array},v=function(e,l,s){return!0===s||""===s?e?"col":"col-".concat(l):"auto"===s?e?"col-auto":"col-".concat(l,"-auto"):e?"col-".concat(s):"col-".concat(l,"-").concat(s)};function f(e){var l=e.className,s=e.cssModule,t=e.hidden,r=e.widths,n=void 0===r?x:r,h=e.tag,g=void 0===h?"label":h,p=e.check,f=e.size,j=e.for,b=u(e,c),A=[];n.forEach((function(l,a){var t=e[l];if(delete b[l],t||""===t){var r,n=!a;if((0,i.Gv)(t)){var c,d=n?"-":"-".concat(l,"-");r=v(n,l,t.size),A.push((0,i.qO)(o()((m(c={},r,t.size||""===t.size),m(c,"order".concat(d).concat(t.order),t.order||0===t.order),m(c,"offset".concat(d).concat(t.offset),t.offset||0===t.offset),c))),s)}else r=v(n,l,t),A.push(r)}}));var N=f||A.length,w=!(p||N),y=(0,i.qO)(o()(l,!!t&&"visually-hidden",!!p&&"form-check-label",!!f&&"col-form-label-".concat(f),A,!!N&&"col-form-label",!!w&&"form-label"),s);return a.createElement(g,d({htmlFor:j},b,{className:y}))}f.propTypes=p;const j=f}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[522],{7591:(e,t,r)=>{r.r(t),r.d(t,{default:()=>P});var n=r(9950),o=r(4492),s=r(7176),i=r(6114),a=r(3452),l=r(4084),c=r(8156),u=r(6713),f=r(5269),p=r(9435),d=r(9708),m=r(5488),h=r(7348),y=r(2765),b=r(2415),g=r(6196),j=r(4414);const v=function(e){let{itemType:t,toggleDropItem:r,toggleCreate:l,baseUrl:c}=e;const{compute_stack_id:p,customer_id:v}=(0,o.g)(),x=(0,o.Zp)(),A=(0,h.MW)(),O=(0,u.O$)(f.A,(e=>e.auth)),w=(0,u.O$)(f.A,(e=>e.url)),N=(0,u.O$)(f.A,(e=>e.is_local)),_=(0,u.O$)(f.A,(e=>e.roles&&e.roles.map((e=>e.role)))),[k,R]=(0,n.useState)({});return(0,n.useEffect)((()=>{r()}),[r]),(0,j.jsx)(d.A,{onSubmit:async e=>{if(e.preventDefault(),!k.name)return R({...k,error:!0}),A.error("You must provide a role name");if(_.includes(k.name))return R({...k,error:!0}),A.error("Role with that name already exists");if(!(0,g.A)(k.name))return R({...k,error:!0}),A.error("Role names must have only letters and underscores");const r="cluster user"===t?{cluster_user:!0}:"super user"===t?{super_user:!0}:{},n=await(0,y.A)({auth:O,url:w,is_local:N,compute_stack_id:p,customer_id:v,role:k.name,permission:r});return n.error?(R({...k,error:!0}),A.error(n.message)):(R({}),await(0,b.A)({auth:O,url:w}),x(`${c}/${n.id}`))},children:(0,j.jsxs)(s.A,{className:"item-row form",children:[(0,j.jsx)(i.A,{className:"input-holder",children:(0,j.jsx)(m.A,{id:"name",invalid:k.error,onChange:e=>R({name:e.target.value.toString()}),type:"text",name:"name",placeholder:"name"})}),(0,j.jsxs)(i.A,{className:"item-action",children:[(0,j.jsx)(a.A,{id:"createRole",color:"success",className:"round me-1",children:(0,j.jsx)("i",{className:"fa fa-check text-white"})}),(0,j.jsx)(a.A,{color:"black",className:"round",onClick:()=>l(!1),children:(0,j.jsx)("i",{className:"fa fa-times text-white"})})]})]})})};var x=r(127);const A=function(e){let{item:t,baseUrl:r,isActive:l,toggleDropItem:c,isDropping:p}=e;const d=(0,o.Zp)(),m=(0,h.MW)(),[y,g]=(0,n.useState)(!1),v=(0,u.O$)(f.A,(e=>e.auth)),A=(0,u.O$)(f.A,(e=>e.url)),O=async()=>{if(!y)return!1;const e=await(async e=>{let{auth:t,id:r,url:n}=e;return(0,x.A)({operation:{operation:"drop_role",id:r},auth:t,url:n})})({auth:v,url:A,id:t.id});return e.error?m.error(e.message):((0,b.A)({auth:v,url:A}),!!l&&setTimeout((()=>d(r)),100))};return(0,j.jsxs)(s.A,{className:"item-row "+(l?"active":""),onClick:()=>!(l||p||y)&&d(`${r}/${t.id}`),children:[(0,j.jsx)(i.A,{className:"item-label "+(y?"text-danger text-nowrap":""),children:y?`drop ${t.role}?`:t.role}),(0,j.jsx)(i.A,{className:"item-action",children:y?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(a.A,{id:"confirmDropRole",color:"danger",className:"round me-1",title:`confirm drop ${t.role}`,onClick:()=>{g(!1),O()},children:(0,j.jsx)("i",{className:"fa fa-check text-white"})}),(0,j.jsx)(a.A,{color:"black",className:"round",title:`Cancel drop ${t.role}`,onClick:()=>{g(!1)},children:(0,j.jsx)("i",{className:"fa fa-times text-white"})})]}):p?(0,j.jsx)(a.A,{id:`drop${t.role}`,color:"danger",className:"round",title:`Drop ${t.role}`,onClick:()=>{g(t),c(!1)},children:(0,j.jsx)("i",{className:"fa fa-minus text-white"})}):l?(0,j.jsx)(a.A,{color:"purple",className:"round",title:`Viewing ${t.role}`,children:(0,j.jsx)("i",{className:"fa fa-chevron-right"})}):null})]},t)};const O=function(e){let{items:t,itemType:r,toggleDropItem:n,isDropping:o,toggleCreate:l,isCreating:c,showForm:u}=e;return(0,j.jsxs)(s.A,{className:"floating-card-header",children:[(0,j.jsxs)(i.A,{children:[r,"s"]}),u&&t&&t.length?(0,j.jsxs)(i.A,{className:"text-end",children:[(0,j.jsx)(a.A,{color:"link",title:`Remove ${r}s`,className:"add-remove me-3",onClick:()=>{n(!o),l(!1)},children:(0,j.jsx)("i",{className:"fa fa-minus"})}),(0,j.jsx)(a.A,{color:"link",title:`Add ${r}`,className:"add-remove me-1",onClick:()=>{l(!c),n(!1)},children:(0,j.jsx)("i",{className:"fa fa-plus"})})]}):null]})};var w=r(3150),N=r(3628);const _=function(e){let{items:t,activeItem:r,showForm:o,baseUrl:s,itemType:i}=e;const[a,u]=(0,n.useState)(!1),[f,d]=(0,n.useState)(!1);(0,n.useEffect)((()=>{d(),u()}),[r,t]);const m=t&&[...t].sort(((e,t)=>e.role<t.role?-1:1));return(0,j.jsx)(p.tH,{onError:(e,t)=>(0,N.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:w.A,children:(0,j.jsxs)("div",{className:"entity-manager",children:[(0,j.jsx)(O,{items:t,itemType:i,isDropping:a,toggleDropItem:u,isCreating:f,toggleCreate:d,showForm:o}),(0,j.jsx)(l.A,{className:"my-3",children:(0,j.jsxs)(c.A,{children:[m&&m.length?m.map((e=>(0,j.jsx)(A,{item:e,baseUrl:s,isActive:r===e.id,isDropping:a,toggleDropItem:u},e.id))):null,(t&&!t.length||f)&&(0,j.jsx)(v,{itemType:i,baseUrl:s,isDropping:a,toggleDropItem:u,isCreating:f,toggleCreate:d})]})})]})})};var k=r(4979),R=r(717);const S=(0,n.lazy)((()=>Promise.all([r.e(239),r.e(831)]).then(r.bind(r,3109)))),C={roleName:!1,canEdit:!1,superUsers:[],clusterUsers:[],standardUsers:[],showAttributes:!1};const P=function(){const{role_id:e,customer_id:t}=(0,o.g)(),r=(0,u.O$)(f.A,(e=>e.compute_stack_id)),p=(0,u.O$)(f.A,(e=>e.auth)),d=(0,u.O$)(f.A,(e=>e.url)),m=(0,u.O$)(f.A,(e=>e.roles),[r]),[h,y]=(0,n.useState)(!1),[g,v]=(0,n.useState)(C),x=`/o/${t}/i/${r}/roles`,A=(0,u.O$)(f.A,(e=>{var t;return null===(t=e.registration)||void 0===t?void 0:t.version})),[O,w]=(null===A||void 0===A?void 0:A.split("."))||[],N=parseFloat(`${O}.${w}`),P=(0,n.useCallback)((async()=>{y(!0),await(0,b.A)({auth:p,url:d}),await(0,R.A)({auth:p,url:d}),y(!1)}),[p,d]);return(0,n.useEffect)((()=>{if(m){const t=e&&m.find((t=>t.id===e));v({...g,roleName:t&&t.role,canEdit:t&&!t.permission.cluster_user&&!t.permission.super_user,clusterUsers:m.filter((e=>e.permission.cluster_user)),superUsers:m.filter((e=>e.permission.super_user)),standardUsers:m.filter((e=>!e.permission.super_user&&!e.permission.cluster_user)),showAttributes:!1})}else v(C)}),[e,m]),(0,n.useEffect)((()=>{P()}),[P,r]),(0,j.jsxs)(s.A,{id:"roles",children:[(0,j.jsxs)(i.A,{xl:"3",lg:"4",md:"5",xs:"12",children:[(0,j.jsx)(_,{showForm:!0,activeItem:e,items:g.superUsers,baseUrl:x,itemType:"super user"}),(0,j.jsx)(_,{showForm:!0,activeItem:e,items:g.clusterUsers,baseUrl:x,itemType:"cluster user"}),(0,j.jsx)(_,{showForm:!0,activeItem:e,items:g.standardUsers,baseUrl:x,itemType:"standard role"})]}),(0,j.jsxs)(i.A,{xl:"9",lg:"8",md:"7",xs:"12",children:[(0,j.jsxs)(s.A,{className:"floating-card-header",children:[g.canEdit&&(0,j.jsxs)(i.A,{children:["edit role > ",g.roleName]}),(0,j.jsxs)(i.A,{className:"text-md-end",children:[g.canEdit&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(a.A,{color:"link",tabIndex:"0",title:"Show Attributes",onClick:()=>v({...g,showAttributes:!g.showAttributes}),children:[(0,j.jsx)("span",{className:"me-2",children:"show all attributes"}),(0,j.jsx)("i",{className:"fa fa-lg fa-toggle-"+(g.showAttributes?"on":"off")})]}),(0,j.jsx)("span",{className:"mx-3 text",children:"|"})]}),(0,j.jsxs)(a.A,{color:"link",onClick:P,className:"me-2",children:[(0,j.jsx)("span",{className:"me-2",children:"refresh roles"}),(0,j.jsx)("i",{title:"Refresh Roles",className:"fa "+(h?"fa-spinner fa-spin":"fa-sync-alt")})]})]})]}),g.canEdit?(0,j.jsx)(l.A,{className:"my-3",children:(0,j.jsx)(c.A,{className:"full-height",children:(0,j.jsx)(n.Suspense,{fallback:(0,j.jsx)(k.A,{header:" ",spinner:!0}),children:(0,j.jsx)(S,{showAttributes:g.showAttributes,fetchRoles:P})})})}):(0,j.jsx)(l.A,{className:"my-3",children:(0,j.jsx)(c.A,{children:e?(0,j.jsxs)("div",{className:"empty-prompt",children:["Super Users and Cluster Users have full access to all"," ",N>=4.2?"databases":"schemas",", tables, and attributes."]}):(0,j.jsx)("div",{className:"empty-prompt",children:"Please choose or add a role to manage it."})})})]})]})}},2765:(e,t,r)=>{r.d(t,{A:()=>o});var n=r(127);const o=async e=>{let{auth:t,url:r,role:o,permission:s}=e;return(0,n.A)({operation:{operation:"add_role",role:o,permission:s},auth:t,url:r})}},2415:(e,t,r)=>{r.d(t,{A:()=>s});var n=r(127),o=r(5269);const s=async e=>{let{auth:t,url:r}=e;const s=await(0,n.A)({operation:{operation:"list_roles"},auth:t,url:r}),i=[...Array.isArray(s)?s:[]].sort(((e,t)=>e.role.toLowerCase()>t.role.toLowerCase()?1:-1));return o.A.update((e=>{e.roles=i})),i}},6196:(e,t,r)=>{r.d(t,{A:()=>n});const n=e=>e.match(/^[a-zA-Z_]+$/)},9708:(e,t,r)=>{r.d(t,{A:()=>g});var n=r(9950),o=r(1942),s=r.n(o),i=r(1497);function a(e){return a="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},a(e)}var l=["className","cssModule","tag","innerRef"];function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c.apply(this,arguments)}function u(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function d(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 r,n=h(e);if(t){var o=h(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===a(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}(this,r)}}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}var y={children:s().node,tag:i.Wx,innerRef:s().oneOfType([s().object,s().func,s().string]),className:s().string,cssModule:s().object},b=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)}(a,e);var t,r,o,s=d(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=s.call(this,e)).getRef=t.getRef.bind(m(t)),t.submit=t.submit.bind(m(t)),t}return t=a,(r=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"submit",value:function(){this.ref&&this.ref.submit()}},{key:"render",value:function(){var e=this.props,t=e.className,r=e.cssModule,o=e.tag,s=void 0===o?"form":o,a=e.innerRef,f=u(e,l),p=(0,i.qO)(t,r);return n.createElement(s,c({},f,{ref:a,className:p}))}}])&&f(t.prototype,r),o&&f(t,o),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Component);b.propTypes=y;const g=b},5488:(e,t,r)=>{r.d(t,{A:()=>v});var n=r(9950),o=r(1942),s=r.n(o),i=r(8738),a=r.n(i),l=r(1497);function c(e){return c="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},c(e)}var u=["className","cssModule","type","bsSize","valid","invalid","tag","addon","plaintext","innerRef"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(this,arguments)}function p(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}function h(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 r,n=b(e);if(t){var o=b(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===c(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}(this,r)}}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}var g={children:s().node,type:s().string,size:s().oneOfType([s().number,s().string]),bsSize:s().string,valid:s().bool,invalid:s().bool,tag:l.Wx,innerRef:s().oneOfType([s().object,s().func,s().string]),plaintext:s().bool,addon:s().bool,className:s().string,cssModule:s().object},j=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&&m(e,t)}(i,e);var t,r,o,s=h(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=s.call(this,e)).getRef=t.getRef.bind(y(t)),t.focus=t.focus.bind(y(t)),t}return t=i,(r=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"focus",value:function(){this.ref&&this.ref.focus()}},{key:"render",value:function(){var e=this.props,t=e.className,r=e.cssModule,o=e.type,s=void 0===o?"text":o,i=e.bsSize,c=e.valid,d=e.invalid,m=e.tag,h=e.addon,y=e.plaintext,b=e.innerRef,g=p(e,u),j=["switch","radio","checkbox"].indexOf(s)>-1,v="select"===s,x="range"===s,A=m||(v||"textarea"===s?s:"input"),O="form-control";y?(O="".concat(O,"-plaintext"),A=m||"input"):x?O="form-range":v?O="form-select":j&&(O=h?null:"form-check-input"),g.size&&/\D/g.test(g.size)&&((0,l.mc)('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'),i=g.size,delete g.size);var w=(0,l.qO)(a()(t,d&&"is-invalid",c&&"is-valid",!!i&&(v?"form-select-".concat(i):"form-control-".concat(i)),O),r);return("input"===A||m&&"function"===typeof m)&&(g.type="switch"===s?"checkbox":s),g.children&&!y&&"select"!==s&&"string"===typeof A&&"select"!==A&&((0,l.mc)('Input with a type of "'.concat(s,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete g.children),n.createElement(A,f({},g,{ref:b,className:w,"aria-invalid":d}))}}])&&d(t.prototype,r),o&&d(t,o),Object.defineProperty(t,"prototype",{writable:!1}),i}(n.Component);j.propTypes=g;const v=j}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[541],{6812:(e,s,t)=>{t.r(s),t.d(s,{default:()=>M});var a=t(9950),r=t(7176),n=t(6114),l=t(6713),o=t(3452),i=t(4084),c=t(8156),d=t(9435),u=t(5269),m=t(127);const x=1e9,h=1073741824;var p=t(1652),j=t(3150),v=t(3628),A=t(4414);let f;const y=function(){const e=(0,l.O$)(u.A,(e=>e.auth)),s=(0,l.O$)(u.A,(e=>e.url)),t=(0,l.O$)(u.A,(e=>e.systemInfo)),y=(0,l.O$)(u.A,(e=>e.is_local)),[g,N]=(0,a.useState)(!(null!==t&&void 0!==t&&t.totalMemory)),w=async()=>{N(!0),f=new AbortController,await(async e=>{var s,t,a,r,n,l,o,i,c,d,p,j;let{auth:v,url:A,signal:f,refresh:y,is_local:g,cachedSystemInfo:N,skip:w=[]}=e;const k=["network","disk","cpu","memory","system"],b=await(0,m.A)({operation:{operation:"system_information",attributes:null!==w&&void 0!==w&&w.length?k.filter((e=>!w.includes(e))):k},auth:v,url:A,signal:f});if(b.error&&y)return u.A.update((e=>{e.systemInfoError=!0}));if(b.error)return u.A.update((e=>{e.systemInfo={totalMemory:"...",usedMemory:"...",freeMemory:"...",memoryStatus:"grey",totalDisk:"...",usedDisk:"...",freeDisk:"...",diskStatus:"grey",cpuInfo:"...",cpuCores:"...",cpuLoad:"...",cpuStatus:"grey",networkTransferred:"...",networkReceived:"...",networkLatency:"...",networkLatencyStatus:"grey"},e.systemInfoError=!0}));const S=w.includes("memory")?parseFloat(N.totalMemory):b.memory.total/h,_=w.includes("memory")?parseFloat(N.usedMemory):b.memory.active/h,C=w.includes("memory")?parseFloat(N.freeMemory):b.memory.available/h,F=w.includes("memory")?N.memoryStatus:C/S<.1?"danger":C/S<.25?"warning":"success",D=w.includes("disk")?parseFloat(N.totalDisk):"darwin"===b.system.platform?(null===(s=b.disk)||void 0===s||null===(t=s.size)||void 0===t?void 0:t[0].size)/x:g?(null===(n=b.disk)||void 0===n||null===(l=n.size)||void 0===l?void 0:l[0].size)/h:(null===(a=b.disk)||void 0===a||null===(r=a.size)||void 0===r?void 0:r.find((e=>"/home/ubuntu/hdb"===e.mount)).size)/h,L=w.includes("disk")?parseFloat(N.usedDisk):"darwin"===b.system.platform?(null===(o=b.disk)||void 0===o||null===(i=o.size)||void 0===i?void 0:i.reduce(((e,s)=>e+s.used),0))/x:g?(null===(p=b.disk)||void 0===p||null===(j=p.size)||void 0===j?void 0:j.reduce(((e,s)=>e+s.used),0))/h:(null===(c=b.disk)||void 0===c||null===(d=c.size)||void 0===d?void 0:d.find((e=>"/home/ubuntu/hdb"===e.mount)).used)/h,$=w.includes("disk")?parseFloat(N.freeDisk):D-L,M=w.includes("disk")?N.diskStatus:$/D<.1?"danger":$/D<.25?"warning":"success",O=w.includes("cpu")?N.cpuInfo:`${b.cpu.manufacturer} ${b.cpu.brand}`,E=w.includes("cpu")?N.cpuCores:`${b.cpu.physicalCores} physical / ${b.cpu.cores} virtual`,I=w.includes("cpu")?parseFloat(N.cpuLoad):b.cpu.current_load.currentLoad||b.cpu.current_load.currentload||0,T=w.includes("cpu")?N.cpuStatus:I>90?"danger":I>75?"warning":"success",z=w.includes("network")?parseFloat(N.networkTransferred):b.network.stats.reduce(((e,s)=>e+s.tx_bytes),0)/x,H=w.includes("network")?parseFloat(N.networkReceived):b.network.stats.reduce(((e,s)=>e+s.rx_bytes),0)/x,J=w.includes("network")?parseFloat(N.networkLatency):b.network.latency.ms,U=w.includes("network")?parseFloat(N.networkLatencyStatus):J>1e3?"danger":J>500?"warning":"success",B={totalMemory:null===S||void 0===S?void 0:S.toFixed(2),usedMemory:null===_||void 0===_?void 0:_.toFixed(2),freeMemory:null===C||void 0===C?void 0:C.toFixed(2),memoryStatus:F,totalDisk:null===D||void 0===D?void 0:D.toFixed(2),usedDisk:null===L||void 0===L?void 0:L.toFixed(2),freeDisk:null===$||void 0===$?void 0:$.toFixed(2),diskStatus:M,cpuInfo:O,cpuCores:E,cpuLoad:null===I||void 0===I?void 0:I.toFixed(2),cpuStatus:T,networkTransferred:null===z||void 0===z?void 0:z.toFixed(2),networkReceived:null===H||void 0===H?void 0:H.toFixed(2),networkLatency:J,networkLatencyStatus:U};return u.A.update((e=>{e.systemInfo=B}))})({auth:e,url:s,is_local:y,signal:f.signal,refresh:!!t,previousSystemInfo:t}),N(!1)};return(0,a.useEffect)((()=>(!e||null!==t&&void 0!==t&&t.totalMemory||w(),()=>{var e;null===(e=f)||void 0===e||e.abort()})),[e]),(0,A.jsxs)(d.tH,{onError:(e,s)=>(0,v.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:j.A,children:[(0,A.jsxs)(r.A,{className:"floating-card-header",children:[(0,A.jsx)(n.A,{children:"host system"}),(0,A.jsx)(n.A,{className:"text-end",children:(0,A.jsx)(o.A,{color:"link",title:"Update Metrics",className:"me-2",onClick:w,children:(0,A.jsx)("i",{className:"fa "+(g?"fa-spinner fa-spin":"fa-sync-alt")})})})]}),(0,A.jsx)(i.A,{className:"my-3 instance-details",children:(0,A.jsx)(c.A,{children:t?(0,A.jsxs)(r.A,{children:[(0,A.jsx)(n.A,{children:(0,A.jsx)(p.A,{header:"Total Memory",className:"mb-3",children:(0,A.jsxs)("div",{className:"nowrap-scroll",children:[(null===t||void 0===t?void 0:t.totalMemory)||"...","GB"]})})}),(0,A.jsx)(n.A,{children:(0,A.jsx)(p.A,{header:"Active Memory",className:"mb-3",children:(0,A.jsxs)("div",{className:"nowrap-scroll",children:[(null===t||void 0===t?void 0:t.usedMemory)||"...","GB"]})})}),(0,A.jsx)(n.A,{children:(0,A.jsx)(p.A,{header:"Available Memory",className:"mb-3",children:(0,A.jsxs)("div",{className:`nowrap-scroll text-${(null===t||void 0===t?void 0:t.memoryStatus)||"grey"}`,children:[(null===t||void 0===t?void 0:t.freeMemory)||"...","GB"]})})}),(0,A.jsx)(n.A,{children:(0,A.jsx)(p.A,{header:"CPU Cores",className:"mb-3",children:(0,A.jsx)("div",{className:"nowrap-scroll",children:(null===t||void 0===t?void 0:t.cpuCores)||"..."})})}),(0,A.jsx)(n.A,{children:(0,A.jsx)(p.A,{header:"CPU Load",className:"mb-3",children:(0,A.jsxs)("div",{className:`nowrap-scroll text-${(null===t||void 0===t?void 0:t.cpuStatus)||"grey"}`,children:[(null===t||void 0===t?void 0:t.cpuLoad)||"...","%"]})})})]}):(0,A.jsx)("div",{className:"pt-5 text-center",children:(0,A.jsx)("i",{className:"fa fa-spinner fa-spin text-purple"})})})}),(0,A.jsx)("br",{})]})};var g=t(135),N=t(5996);var w=t(7209);const k=function(e){let{end_datetime:s,start_datetime:t,status:a,message:l}=e;return(0,A.jsx)("div",{className:"item-row",children:(0,A.jsxs)(r.A,{children:[(0,A.jsx)(n.A,{xs:"3",className:`text-nowrap ${a.toLowerCase()}`,children:a}),(0,A.jsx)(n.A,{xs:"3",className:"text-nowrap",children:new Date(t).toLocaleDateString()}),(0,A.jsx)(n.A,{xs:"3",className:"text-nowrap",children:new Date(t).toLocaleTimeString()}),(0,A.jsx)(n.A,{xs:"3",className:"text-nowrap",children:new Date(s).toLocaleTimeString()}),(0,A.jsx)(n.A,{xs:"12",className:"mt-1",children:(0,w.A)(l)?JSON.stringify(l):l})]})})};let b;const S=function(){const e=(0,l.O$)(u.A,(e=>e.auth)),s=(0,l.O$)(u.A,(e=>e.url)),t=(0,l.O$)(u.A,(e=>e.jobs)),x=(0,l.O$)(u.A,(e=>e.jobsError)),[h,p]=(0,a.useState)(!1),[f,y]=(0,a.useState)(!0),[w,S]=(0,a.useState)(!0);return(0,a.useEffect)((()=>{let a=!0;return e&&(async()=>{y(!0),b=new AbortController;const r=new Date;r.setDate(r.getDate()+1);const n=r.toISOString().split("T")[0];r.setFullYear(r.getFullYear()-1);const l=r.toISOString().split("T")[0];await(async e=>{let{auth:s,url:t,signal:a,from_date:r,to_date:n,currentJobCount:l}=e;const o=await(0,m.A)({operation:{operation:"search_jobs_by_start_date",from_date:r,to_date:n},auth:s,url:t,signal:a});return o.error&&l?u.A.update((e=>{e.jobsError=!0})):!Array.isArray(o)||o.error?u.A.update((e=>{e.jobs=[],e.jobsError=!0})):u.A.update((e=>{e.jobs=[...o].sort(((e,s)=>s.start_datetime-e.end_datetime)),e.jobsError=!1}))})({auth:e,url:s,signal:b.signal,currentJobCount:(null===t||void 0===t?void 0:t.length)||0,from_date:l,to_date:n}),a&&y(!1)})(),()=>{var e;null===(e=b)||void 0===e||e.abort(),a=!1}}),[e,w]),(0,g.A)((()=>e&&h&&S(Date.now())),N.A.refresh_content_interval),(0,A.jsxs)(d.tH,{onError:(e,s)=>(0,v.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:j.A,children:[(0,A.jsxs)(r.A,{className:"floating-card-header",children:[(0,A.jsx)(n.A,{children:"jobs"}),(0,A.jsxs)(n.A,{className:"text-end",children:[(0,A.jsx)(o.A,{color:"link",title:"Update Jobs",className:"me-2",onClick:()=>S(Date.now()),children:(0,A.jsx)("i",{className:"fa "+(f?"fa-spinner fa-spin":"fa-sync-alt")})}),(0,A.jsxs)(o.A,{color:"link",title:"Turn on autofresh",onClick:()=>p(!h),children:[(0,A.jsx)("span",{className:"me-2",children:"auto"}),(0,A.jsx)("i",{className:"fa fa-lg fa-toggle-"+(h?"on":"off")})]})]})]}),(0,A.jsx)(i.A,{className:"my-3",children:(0,A.jsxs)(c.A,{className:"item-list",children:[(0,A.jsxs)(r.A,{className:"header",children:[(0,A.jsx)(n.A,{xs:"3",className:"text-bold text-nowrap",children:"status"}),(0,A.jsx)(n.A,{xs:"3",className:"text-bold text-nowrap",children:"date"}),!f&&x?(0,A.jsx)(n.A,{xs:"6",className:"text-end text-danger text-bold text-nowrap",children:(0,A.jsxs)("b",{children:["job fetch error: ",(new Date).toLocaleTimeString().toLowerCase()]})}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(n.A,{xs:"3",className:"text-bold text-nowrap",children:"start"}),(0,A.jsx)(n.A,{xs:"3",className:"text-bold text-nowrap",children:"end"})]})]}),(0,A.jsx)("hr",{className:"mt-1 mb-0"}),(0,A.jsx)("div",{className:"item-scroller",children:!f||t||h?null!==t&&void 0!==t&&t.length?t.map((e=>(0,A.jsx)(k,{...e},e.id))):(0,A.jsx)("div",{className:"pt-5 text-center",children:"no jobs found"}):(0,A.jsx)("div",{className:"pt-5 text-center",children:(0,A.jsx)("i",{className:"fa fa-spinner fa-spin text-lightgrey"})})})]})}),(0,A.jsx)("br",{})]})};var _=t(4492),C=t(5553);const F=function(e){let{date:s,type:t,message:a}=e;return(0,A.jsx)("div",{className:"item-row",children:(0,A.jsxs)(r.A,{children:[(0,A.jsx)(n.A,{xs:"3",className:"text-danger text-nowrap",children:t}),(0,A.jsx)(n.A,{xs:"9",className:"text-nowrap",children:new Date(s).toLocaleString()}),(0,A.jsx)(n.A,{xs:"12",className:"mt-1",children:(0,w.A)(a)?JSON.stringify(a):a})]})})};var D=t(4817);let L;const $=function(){const{customer_id:e}=(0,_.g)(),s=(0,l.O$)(u.A,(e=>e.compute_stack_id)),t=(0,l.O$)(C.A,(e=>e.auth)),m=(0,l.O$)(C.A,(e=>{var t;return e.alarms&&(null===(t=e.alarms[s])||void 0===t?void 0:t.alarms)}),[s]),x=(0,l.O$)(C.A,(e=>e.alarmsError)),[h,p]=(0,a.useState)(!1),[f,y]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!0);return(0,a.useEffect)((()=>{let s=!0;return t&&(async()=>{y(!0),L=new AbortController,await(0,D.A)({auth:t,signal:L.signal,customer_id:e,currentAlarmsLength:null===m||void 0===m?void 0:m.length}),s&&y(!1)})(),()=>{var e;null===(e=L)||void 0===e||e.abort(),s=!1}}),[t,w]),(0,g.A)((()=>t&&h&&k(Date.now())),N.A.refresh_content_interval),(0,A.jsxs)(d.tH,{onError:(e,s)=>(0,v.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:j.A,children:[(0,A.jsxs)(r.A,{className:"floating-card-header",children:[(0,A.jsx)(n.A,{children:"alarms"}),(0,A.jsxs)(n.A,{className:"text-end",children:[(0,A.jsx)(o.A,{color:"link",title:"Update Jobs",className:"me-2",onClick:()=>k(Date.now()),children:(0,A.jsx)("i",{className:"fa "+(f?"fa-spinner fa-spin":"fa-sync-alt")})}),(0,A.jsxs)(o.A,{color:"link",title:"Turn on autofresh",onClick:()=>p(!h),children:[(0,A.jsx)("span",{className:"me-2",children:"auto"}),(0,A.jsx)("i",{className:"fa fa-lg fa-toggle-"+(h?"on":"off")})]})]})]}),(0,A.jsx)(i.A,{className:"my-3",children:(0,A.jsxs)(c.A,{className:"item-list",children:[(0,A.jsxs)(r.A,{className:"header",children:[(0,A.jsx)(n.A,{xs:"3",className:"text-bold text-nowrap",children:"status"}),(0,A.jsx)(n.A,{xs:"3",className:"text-bold text-nowrap",children:"date"}),(0,A.jsx)(n.A,{xs:"6",className:"text-end text-danger text-bold",children:!f&&x&&(0,A.jsxs)("span",{children:["alarms fetch error: ",(new Date).toLocaleTimeString().toLowerCase()]})})]}),(0,A.jsx)("hr",{className:"mt-1 mb-0"}),(0,A.jsx)("div",{className:"item-scroller",children:!f||m||h?null!==m&&void 0!==m&&m.length?m.map((e=>(0,A.jsx)(F,{...e},e.id))):(0,A.jsx)("div",{className:"pt-5 text-center",children:"no alarms found"}):(0,A.jsx)("div",{className:"pt-5 text-center",children:(0,A.jsx)("i",{className:"fa fa-spinner fa-spin text-lightgrey"})})})]})}),(0,A.jsx)("br",{})]})};const M=function(){return(0,A.jsxs)(r.A,{id:"config",children:[(0,A.jsx)(n.A,{xs:"12",children:(0,A.jsx)(y,{})}),(0,A.jsx)(n.A,{lg:6,xs:"12",children:(0,A.jsx)(S,{})}),!N.A.is_local_studio&&(0,A.jsx)(n.A,{lg:"6",xs:"12",children:(0,A.jsx)($,{})})]})}},1652:(e,s,t)=>{t.d(s,{A:()=>r});t(9950);var a=t(4414);const r=function(e){let{children:s,header:t,subheader:r,maxHeight:n="auto",minHeight:l="auto",className:o}=e;return(0,a.jsxs)("div",{className:`content-container ${o}`,children:[(0,a.jsxs)("div",{className:"header-container",children:[(0,a.jsx)("span",{className:"header",children:t}),(0,a.jsx)("span",{className:"subheader",children:r})]}),(0,a.jsx)("div",{className:"auto"!==n?"scrollable":"",style:{maxHeight:n,minHeight:l},children:s})]})}},7209:(e,s,t)=>{t.d(s,{A:()=>a});const a=e=>"object"===typeof e&&!Array.isArray(e)&&null!==e}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[642],{7695:(e,a,s)=>{s.r(a),s.d(a,{default:()=>v});var t=s(9950),r=s(7176),n=s(6114),l=s(3452),i=s(4084),o=s(8156),c=s(6713),d=s(4492),g=s(9435),u=s(5269),m=s(8222),p=s(3150),h=s(3628),x=s(4343),j=s(4414);const f={tableData:[],dataTableColumns:[],totalRecords:0,filtered:[],sorted:[{id:"username",desc:!1}],page:0,loading:!1,totalPages:1,pageSize:20,autoRefresh:!1,showFilter:!1,lastUpdate:!1};let b;const v=function(e){var a,s;let{lastUpdate:v,setLastUpdate:N}=e;const{customer_id:A}=(0,d.g)(),C=(0,d.Zp)(),P=(0,c.O$)(u.A,(e=>e.compute_stack_id)),S=(0,c.O$)(u.A,(e=>e.auth)),w=(0,c.O$)(u.A,(e=>e.url)),[k,F]=(0,t.useState)(f),[z,y]=(0,t.useState)(!0),$=null===(a=k.sorted[0])||void 0===a?void 0:a.id,D=null===(s=k.sorted[0])||void 0===s?void 0:s.desc,O=(0,t.useCallback)((e=>{C(`/o/${A}/i/${P}/users/${e}`)}),[P,A]);return(0,t.useEffect)((()=>{let e=!0;return S&&(async()=>{y(!0),b=new AbortController;const a=await(0,m.A)({auth:S,url:w,signal:b.signal});e&&(y(!1),F({...k,tableData:a,dataTableColumns:[{Header:"username",accessor:"username"},{Header:"role",accessor:"role"}],totalPages:Math.ceil((a.length||k.pageSize)/k.pageSize),loading:!1}))})(),()=>{var a;e=!1,null===(a=b)||void 0===a||a.abort()}}),[S,v,k.pageSize]),(0,t.useEffect)((()=>{let e=!0;if(k.tableData.length&&$){const a=[...[...k.tableData]].sort(((e,a)=>e[$]>a[$]&&D?1:e[$]>a[$]||D?-1:1));e&&F({...k,tableData:a})}return()=>{var a;e=!1,null===(a=b)||void 0===a||a.abort()}}),[$,D]),(0,j.jsxs)(g.tH,{onError:(e,a)=>(0,h.A)({error:{message:e.message,componentStack:a}}),FallbackComponent:p.A,children:[(0,j.jsxs)(r.A,{className:"floating-card-header",children:[(0,j.jsx)(n.A,{children:"existing users"}),(0,j.jsxs)(n.A,{className:"text-end",children:[(0,j.jsx)(l.A,{color:"link",onClick:()=>N(Date.now()),className:"me-2",children:(0,j.jsx)("i",{title:"Refresh Structure",className:"fa "+(z?"fa-spinner fa-spin":"fa-sync-alt")})}),(0,j.jsx)("span",{className:"mx-3 text",children:"|"}),(0,j.jsx)(l.A,{color:"link",title:"Filter Users",className:"me-2",onClick:()=>F({...k,filtered:k.showFilter?[]:k.filtered,showFilter:!k.showFilter}),children:(0,j.jsx)("i",{className:"fa fa-search"})})]})]}),(0,j.jsx)(i.A,{className:"mt-3",children:(0,j.jsx)(o.A,{className:"react-table-holder",children:(0,j.jsx)(x.A,{columns:k.dataTableColumns,data:k.tableData,currentPage:k.page,pageSize:k.pageSize,totalPages:k.totalPages,showFilter:k.showFilter,sorted:k.sorted,loading:z,onFilteredChange:e=>F({...k,filtered:e}),onSortedChange:e=>F({...k,sorted:e}),onPageChange:e=>F({...k,pageSize:e}),onPageSizeChange:e=>F({...k,page:0,pageSize:e}),onRowClick:e=>O(e.username)})})})]})}},4343:(e,a,s)=>{s.d(a,{A:()=>v});var t=s(9950),r=s(2043),n=s(5488),l=s(9435),i=s(7176),o=s(6114),c=s(4414);const d=e=>{let{headerGroups:a,onSortedChange:s,sorted:t,showFilter:r,dynamicAttributesFromDataTable:n,tableDescriptionAttributes:l}=e;const d=e=>{let a=!1;return l.forEach((s=>{s.attribute===e&&(s.is_primary_key||s.indexed)&&(a=!0)})),a};return a.map((e=>{const{key:a,...l}=e.getHeaderGroupProps();return(0,c.jsxs)("div",{...l,children:[(0,c.jsx)(i.A,{className:"header g-0",children:e.headers.map((e=>{var a,r;return(0,c.jsx)(o.A,{onClick:()=>{var a,r;n&&!n.includes(e.id)&&d(e.id)&&s([{id:e.id,desc:(null===(a=t[0])||void 0===a?void 0:a.id)===e.id&&!(null!==(r=t[0])&&void 0!==r&&r.desc)}])},className:`${(null===(a=t[0])||void 0===a?void 0:a.id)===e.id?"sorted":""} ${null!==(r=t[0])&&void 0!==r&&r.desc?"desc":"asc"} ${-1!==e.id.indexOf("hdb-narrow")?"action":""} px-1 ${n&&!n.includes(e.id)&&d(e.id)?"":"disabled-column"}`,children:(0,c.jsx)("div",{className:"text-renderer",children:e.render("Header")})},e.id)}))}),r&&(0,c.jsx)(i.A,{className:"filter g-0",children:e.headers.map((e=>(0,c.jsx)(o.A,{className:-1!==e.id.indexOf("hdb-narrow")?"action":"",children:e.render("Filter")},e.id)))})]},a)}))};var g=s(3452);const u=function(e){let{page:a,pageSize:s,totalPages:t,onPageChange:r,onPageSizeChange:l,loading:d}=e;return(0,c.jsxs)(i.A,{className:"pagination",children:[(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"previous",children:(0,c.jsx)(g.A,{className:"mb-2 btn-pagination",color:"purple",block:!0,onClick:()=>r(a-1),disabled:!t||0===a,children:(0,c.jsx)("i",{className:"fa fa-chevron-left"})})}),(0,c.jsxs)(o.A,{xs:"12",sm:"4",className:"paginator",children:[(0,c.jsx)("i",{className:"fa fa-book me-2"}),(0,c.jsx)(n.A,{className:"mb-2",type:"number",value:a+1,min:1,max:t,onChange:e=>r(e.target.value-1)}),(0,c.jsxs)("div",{className:"page-count",children:["\xa0/\xa0",d?(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"}):t]})]}),(0,c.jsx)(o.A,{xs:"12",sm:"4",className:"page-size",children:(0,c.jsx)(n.A,{className:"mb-2",type:"select",value:s,onChange:e=>l(e.target.value),children:[20,50,100,250].map((e=>(0,c.jsxs)("option",{value:e,children:[e," rows"]},e)))})}),(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"next",children:(0,c.jsx)(g.A,{className:"mb-2 pull-right btn-pagination",block:!0,color:"purple",onClick:()=>r(a+1),disabled:!t||a+1===t,children:(0,c.jsx)("i",{className:"fa fa-chevron-right"})})})]})};const m=function(e){let{previousPage:a,canPreviousPage:s,pageIndex:t,gotoPage:r,setPageSize:l,pageCount:d,nextPage:u,canNextPage:m,loading:p}=e;return(0,c.jsxs)(i.A,{className:"pagination",children:[(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"previous",children:(0,c.jsx)(g.A,{className:"mb-2 btn-pagination",color:"purple",block:!0,onClick:a,disabled:!d||!s,children:(0,c.jsx)("i",{className:"fa fa-chevron-left"})})}),(0,c.jsxs)(o.A,{xs:"12",sm:"4",className:"paginator",children:[(0,c.jsx)("i",{className:"fa fa-book me-2"}),(0,c.jsx)(n.A,{className:"mb-2",type:"number",value:t+1||1,min:1,max:d,onChange:e=>r(e.target.value?Number(e.target.value)-1:0)}),(0,c.jsxs)("div",{className:"page-count",children:["\xa0/\xa0",p?(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"}):d]})]}),(0,c.jsx)(o.A,{xs:"12",sm:"4",className:"page-size",children:(0,c.jsx)(n.A,{className:"mb-2",type:"select",onChange:e=>{r(0),setTimeout((()=>l(e.target.value)),1e3)},children:[20,50,100,250].map((e=>(0,c.jsxs)("option",{value:e,children:[e," rows"]},e)))})}),(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"next",children:(0,c.jsx)(g.A,{className:"mb-2 pull-right btn-pagination",block:!0,color:"purple",onClick:u,disabled:!d||!m,children:(0,c.jsx)("i",{className:"fa fa-chevron-right"})})})]})};const p=function(e){let{prepareRow:a,row:s,onRowClick:t=!1}=e;return a(s),(0,c.jsx)(i.A,{onClick:()=>t&&t(s.original),className:"g-0",children:s.cells.map((e=>(0,c.jsx)(o.A,{className:-1!==e.column.id.indexOf("hdb-narrow")?"action":"",children:e.render("Cell")},`${e.row.id}-${e.column.id}`)))})};var h=s(3628),x=s(3150);function j(e){let{value:a}=e;return(0,c.jsx)("div",{className:"text-renderer",children:a})}function f(e){let{src:a}=e;const[s,r]=(0,t.useState)(!1),[n,l]=(0,t.useState)(!1);return(0,c.jsxs)("div",{className:"image-renderer",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[(0,c.jsx)("i",{className:"fa fa-image"}),s&&n?(0,c.jsxs)("div",{className:"preview-image no-image",children:[(0,c.jsx)("i",{className:"fa fa-ban text-danger"}),(0,c.jsx)("div",{className:"mt-2",children:"image failed to load"})]}):s?(0,c.jsx)("img",{onError:l,alt:a,src:a,className:"preview-image"}):null]})}const b={Filter:e=>{let{column:{filterValue:a,setFilter:s}}=e;return(0,c.jsx)(n.A,{type:"text",value:a||"",onChange:e=>s(e.target.value||void 0)})},Cell:e=>{let{value:a}=e;return(e=>{switch(Object.prototype.toString.call(e)){case"[object Array]":case"[object Object]":return(0,c.jsx)(j,{value:JSON.stringify(e)});case"[object Boolean]":return(0,c.jsx)(j,{value:e?"true":"false"});case"[object String]":return(a=e)&&(a.match(/^https?.*\.(jpeg|jpg|gif|png)$/)||-1!==a.indexOf("data:image"))?(0,c.jsx)(f,{src:e}):(0,c.jsx)(j,{value:e});default:return(0,c.jsx)(j,{value:e})}var a})(a)}};const v=function(e){let{columns:a,data:s,error:n,currentPage:i,pageSize:o,totalPages:g,onFilteredChange:j,onSortedChange:f,onPageChange:v,onPageSizeChange:N,showFilter:A,onRowClick:C,sorted:P,loading:S,dynamicAttributesFromDataTable:w,tableDescriptionAttributes:k,manual:F=!1}=e;const{headerGroups:z,page:y,rows:$,prepareRow:D,state:O,setAllFilters:R,canPreviousPage:E,canNextPage:T,pageOptions:_,pageCount:H,gotoPage:G,nextPage:I,previousPage:L,setPageSize:U}=(0,r.useTable)({columns:a,data:s,defaultColumn:b,onFilteredChange:j,onSortedChange:f,onPageChange:v,onPageSizeChange:N,onRowClick:C,manualPagination:F,manualFilters:F,initialState:{pageIndex:i,pageSize:o}},r.useFilters,r.usePagination),[M,B]=(0,t.useState)(!0),J=F||!y.length?$:y;return(0,t.useEffect)((()=>{!A&&O.filters.length?R([]):j(O.filters)}),[O.filters,A]),(0,t.useEffect)((()=>{setTimeout((()=>B(!1)),100)}),[null===J||void 0===J?void 0:J.length]),(0,c.jsxs)(l.tH,{onError:(e,a)=>(0,h.A)({error:{message:e.message,componentStack:a}}),FallbackComponent:x.A,children:[(0,c.jsxs)("div",{className:"react-table-scroller",children:[(0,c.jsx)(d,{headerGroups:z,tableDescriptionAttributes:k,dynamicAttributesFromDataTable:w,onSortedChange:f,sorted:P,showFilter:A}),S||M?(0,c.jsx)("div",{className:"centered text-center",children:(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"})}):J.length?J.map((e=>(0,c.jsx)(p,{row:e,prepareRow:D,onRowClick:C},e.id))):(0,c.jsxs)("div",{className:"centered text-center",children:[(0,c.jsx)("i",{className:"fa fa-exclamation-triangle text-danger"}),(0,c.jsx)("div",{className:"mt-2 text-darkgrey",children:n?`Error loading data: ${n}`:"no records"})]})]}),F?(0,c.jsx)(u,{page:i,pageSize:o,totalPages:g,onPageChange:v,onPageSizeChange:N,loading:S}):(0,c.jsx)(m,{previousPage:L,pageSize:o,canPreviousPage:E,pageIndex:O.pageIndex,pageOptions:_,gotoPage:G,setPageSize:U,pageCount:H,nextPage:I,canNextPage:T,loading:S})]})}},8222:(e,a,s)=>{s.d(a,{A:()=>n});var t=s(127),r=s(5269);const n=async e=>{let{auth:a,url:s,signal:n}=e;const l=await(0,t.A)({operation:{operation:"list_users"},auth:a,url:s,signal:n}),i=Array.isArray(l)?[...l].map((e=>({username:e.username,role:e.role.role}))).sort(((e,a)=>e.username.toLowerCase()>a.username.toLowerCase()?1:-1)):[];return r.A.update((e=>{e.users=i})),i}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[154],{2729:(e,s,r)=>{r.r(s),r.d(s,{default:()=>$});var a=r(9950),t=r(4492),l=r(4084),n=r(8156),o=r(7176),c=r(6114),u=r(3452),i=r(5488),d=r(6713),m=r(7348),h=r(9435),x=r(127);const p=async e=>{let{auth:s,url:r,username:a,password:t,role:l}=e;return(0,x.A)({operation:{operation:"alter_user",role:l,username:a,password:t,active:!0},auth:s,url:r})};var A=r(5269),j=r(3150),g=r(3628),w=r(8222),b=r(4414);const y=function(){const{username:e}=(0,t.g)(),[s,r]=(0,a.useState)({}),[l,n]=(0,a.useState)({}),x=(0,m.MW)(),y=(0,d.O$)(A.A,(e=>e.auth)),f=(0,d.O$)(A.A,(e=>e.url));return(0,b.jsx)(h.tH,{onError:(e,s)=>(0,g.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:j.A,children:(0,b.jsxs)(o.A,{children:[(0,b.jsxs)(c.A,{xs:"4",className:"py-1",children:["Change user password",(0,b.jsx)("br",{}),(0,b.jsx)("span",{className:"text-small",children:"Modify user's access credentials"})]}),(0,b.jsx)(c.A,{xs:"4",children:(0,b.jsx)(i.A,{id:"password",type:"text",className:"text-center",name:"password",placeholder:"enter new password",value:l.password||"",onChange:e=>n({...l,password:e.target.value})})}),(0,b.jsx)(c.A,{xs:"4",children:(0,b.jsx)(u.A,{block:!0,color:"success",onClick:async()=>{const{password:s}=l;if(s){r({submitted:!0});const a=await p({auth:y,url:f,username:e,password:s});n({}),-1!==a.message.indexOf("updated")?(x.success("password updated"),(0,w.A)({auth:y,url:f}),r({})):(x.error(a.message),r({}))}else r({error:"password is required"})},disabled:s.submitted||!l.password,children:"Update Password"})})]})})};var f=r(6359),v=r(9163),C=r.n(v);const k=function(){const{username:e}=(0,t.g)(),[s,r]=(0,a.useState)({}),[l,n]=(0,a.useState)({}),i=(0,m.MW)(),x=(0,d.O$)(A.A,(e=>e.auth)),y=(0,d.O$)(A.A,(e=>e.url)),v=(0,d.O$)(A.A,(e=>{var s;return parseFloat(null===(s=e.registration)||void 0===s?void 0:s.version)<3})),k=(0,d.O$)(A.A,(e=>e.roles.map((e=>({label:e.role,value:v?e.id:e.role}))))),N=(0,d.O$)(A.A,(s=>s.users&&s.users.find((s=>s.username===e))));return C()((()=>{var e;return n({...l,newRole:null===N||void 0===N||null===(e=N.role)||void 0===e?void 0:e.id})}),[]),(0,b.jsx)(h.tH,{onError:(e,s)=>(0,g.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:j.A,children:(0,b.jsxs)(o.A,{children:[(0,b.jsxs)(c.A,{xs:"4",className:"py-1",children:["Change user role",(0,b.jsx)("br",{}),(0,b.jsx)("span",{className:"text-small",children:"Change what this user can do"})]}),(0,b.jsx)(c.A,{xs:"4",children:(0,b.jsx)(f.Ay,{className:"react-select-container",classNamePrefix:"react-select",onChange:e=>{let{value:s}=e;return n({...l,newRole:s})},options:k.filter((e=>e.value!==N.role.id)),value:k.find((e=>e.value===l.newRole)),isSearchable:!1,isClearable:!1,isLoading:!k,placeholder:"select a role",styles:{placeholder:e=>({...e,textAlign:"center",width:"100%",color:"#BCBCBC"})}})}),(0,b.jsx)(c.A,{xs:"4",children:(0,b.jsx)(u.A,{id:"updateRole",block:!0,color:"success",onClick:async()=>{const{newRole:s}=l;if(s)if(N.role.id===s)r({error:"user already has this role"});else{r({submitted:!0});const a=await p({auth:x,url:y,username:e,role:s});-1!==a.message.indexOf("updated")?(i.success("user role updated"),(0,w.A)({auth:x,url:y}),r({})):(i.error(a.message),r({}))}else r({error:"role is required"})},disabled:l.newRole===N.role.id||"submitted"===s,children:"Update Role"})})]})})};var N=r(2034);const O=function(){const{username:e}=(0,t.g)(),{pathname:s}=(0,t.zy)(),r=(0,t.Zp)(),[l,n]=(0,a.useState)({}),[x,p]=(0,a.useState)({}),y=(0,m.MW)(),f=(0,d.O$)(A.A,(e=>e.auth)),v=(0,d.O$)(A.A,(e=>e.url));return(0,b.jsx)(h.tH,{onError:(e,s)=>(0,g.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:j.A,children:(0,b.jsxs)(o.A,{children:[(0,b.jsxs)(c.A,{xs:"4",className:"py-1",children:["Delete User",(0,b.jsx)("br",{}),(0,b.jsx)("span",{className:"text-small",children:"user will be removed from this instance"})]}),(0,b.jsx)(c.A,{xs:"4",children:(0,b.jsx)(i.A,{id:"delete_username",onChange:e=>n({delete_username:e.target.value}),type:"text",className:"text-center",title:"confirm username to delete",placeholder:`Enter "${e}" here to enable deletion.`,value:l.delete_username||""})}),(0,b.jsx)(c.A,{xs:"4",children:(0,b.jsx)(u.A,{id:"deleteUser",block:!0,color:"success",onClick:async()=>{if(l.delete_username!==e)y.error("Please type the username to delete this user");else{p({submitted:!0});const a=await(0,N.A)({auth:f,username:e,url:v});-1!==a.message.indexOf("successfully")?(y.success(a.message),(0,w.A)({auth:f,url:v}),p({}),setTimeout((()=>r(s.replace(`/users/${e}`,"/users"))),0)):(y.error(a.message),p({}))}},disabled:e!==l.delete_username||x.submitted,children:x.submitted?(0,b.jsx)("i",{className:"fa fa-spinner fa-spin text-white"}):(0,b.jsx)("span",{children:"Delete User"})})})]})})};const $=function(){const{username:e}=(0,t.g)(),{pathname:s}=(0,t.zy)(),r=(0,t.Zp)();return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"floating-card-header",children:["existing users > edit > ",(0,b.jsx)("b",{children:e})]}),(0,b.jsx)(l.A,{className:"my-3",children:(0,b.jsxs)(n.A,{children:[(0,b.jsx)(y,{}),(0,b.jsx)("hr",{className:"my-3"}),(0,b.jsx)(k,{}),(0,b.jsx)("hr",{className:"my-3"}),(0,b.jsx)(O,{}),(0,b.jsx)("hr",{className:"my-3"}),(0,b.jsxs)(o.A,{children:[(0,b.jsx)(c.A,{xs:"8",className:"py-1"}),(0,b.jsx)(c.A,{xs:"4",children:(0,b.jsx)(u.A,{id:"returnToUserList",block:!0,color:"grey",onClick:()=>r(s.replace(`/${e}`,"")),children:"Return to User List"})})]})]})})]})}},2034:(e,s,r)=>{r.d(s,{A:()=>t});var a=r(127);const t=async e=>{let{auth:s,username:r,url:t}=e;return(0,a.A)({operation:{operation:"drop_user",username:r},auth:s,url:t})}},8222:(e,s,r)=>{r.d(s,{A:()=>l});var a=r(127),t=r(5269);const l=async e=>{let{auth:s,url:r,signal:l}=e;const n=await(0,a.A)({operation:{operation:"list_users"},auth:s,url:r,signal:l}),o=Array.isArray(n)?[...n].map((e=>({username:e.username,role:e.role.role}))).sort(((e,s)=>e.username.toLowerCase()>s.username.toLowerCase()?1:-1)):[];return t.A.update((e=>{e.users=o})),o}}}]);
|