harperdb 4.3.19 → 4.3.21
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 +3 -3
- package/bin/harperdb.js +58 -58
- package/bin/lite.js +20 -20
- package/index.d.ts +1 -0
- package/launchServiceScripts/launchInstallNATSServer.js +2 -2
- package/launchServiceScripts/launchNatsIngestService.js +20 -20
- package/launchServiceScripts/launchNatsReplyService.js +20 -20
- package/launchServiceScripts/launchUpdateNodes4-0-0.js +20 -20
- package/npm-shrinkwrap.json +1057 -1245
- package/package.json +16 -8
- package/resources/Resource.d.ts +5 -6
- package/resources/ResourceInterface.d.ts +56 -13
- package/resources/Table.d.ts +19 -19
- package/resources/databases.d.ts +17 -18
- package/server/jobs/jobProcess.js +20 -20
- package/server/threads/threadServer.js +20 -20
- package/studio/build-local/asset-manifest.json +36 -36
- package/studio/build-local/index.html +1 -1
- package/studio/build-local/static/css/main.6c0f1b63.css +13 -0
- package/studio/build-local/static/js/{424.7d57284b.chunk.js → 424.ad87c8fd.chunk.js} +1 -1
- package/studio/build-local/static/js/{662.02ce7b65.chunk.js → 662.92e32ffc.chunk.js} +1 -1
- package/studio/build-local/static/js/723.c58acced.chunk.js +2 -0
- package/studio/build-local/static/js/807.510f66df.chunk.js +2 -0
- package/studio/build-local/static/js/browse-csvupload.453237f3.chunk.js +1 -0
- package/studio/build-local/static/js/browse-datatable.b9ef2d28.chunk.js +1 -0
- package/studio/build-local/static/js/browse-entitymanager.50827a5a.chunk.js +1 -0
- package/studio/build-local/static/js/browse-jsonviewer.a2534004.chunk.js +1 -0
- package/studio/build-local/static/js/custom-functions.dd7e182c.chunk.js +1 -0
- package/studio/build-local/static/js/instance-charts.34d15f02.chunk.js +1 -0
- package/studio/build-local/static/js/instance-cluster.5bce430c.chunk.js +1 -0
- package/studio/build-local/static/js/instance-config.70c17b53.chunk.js +1 -0
- package/studio/build-local/static/js/instance-query.4f6eec62.chunk.js +1 -0
- package/studio/build-local/static/js/instance-roles.507a4ed0.chunk.js +1 -0
- package/studio/build-local/static/js/instance-status.ce9d7f64.chunk.js +1 -0
- package/studio/build-local/static/js/instance-users-datatable.190640fd.chunk.js +1 -0
- package/studio/build-local/static/js/{instance-users-edit.436e0908.chunk.js → instance-users-edit.d2444479.chunk.js} +1 -1
- package/studio/build-local/static/js/instance-users.eabfbbde.chunk.js +1 -0
- package/studio/build-local/static/js/instance.a163623f.chunk.js +1 -0
- package/studio/build-local/static/js/instances.6b88a87c.chunk.js +1 -0
- package/studio/build-local/static/js/{main.05c1913d.js → main.a22f6951.js} +2 -2
- package/studio/build-local/static/js/offline-app.7371216b.chunk.js +1 -0
- package/studio/build-local/static/js/online-app.db436eec.chunk.js +1 -0
- package/studio/build-local/static/js/organization-billing.b2f260f0.chunk.js +1 -0
- package/studio/build-local/static/js/organization-users.b6171b18.chunk.js +1 -0
- package/studio/build-local/static/js/organization.7800f16a.chunk.js +1 -0
- package/studio/build-local/static/js/organizations.8bb505f2.chunk.js +1 -0
- package/studio/build-local/static/js/profile.292bdd86.chunk.js +1 -0
- package/studio/build-local/static/js/roles-jsonviewer.c11f1816.chunk.js +1 -0
- package/studio/build-local/static/js/signIn.b11bdc50.chunk.js +1 -0
- package/studio/build-local/static/js/signUp.564d4e0b.chunk.js +1 -0
- package/studio/build-local/static/js/structure-reloader.b6de4091.chunk.js +1 -0
- package/studio/build-local/static/js/topnav.4fd41d60.chunk.js +1 -0
- package/utility/scripts/restartHdb.js +20 -20
- package/studio/build-local/static/css/main.038ec116.css +0 -13
- package/studio/build-local/static/js/723.36068040.chunk.js +0 -2
- package/studio/build-local/static/js/807.3473ab0a.chunk.js +0 -2
- package/studio/build-local/static/js/browse-csvupload.5e77eb8a.chunk.js +0 -1
- package/studio/build-local/static/js/browse-datatable.cd71d518.chunk.js +0 -1
- package/studio/build-local/static/js/browse-entitymanager.09237801.chunk.js +0 -1
- package/studio/build-local/static/js/browse-jsonviewer.fcccabdc.chunk.js +0 -1
- package/studio/build-local/static/js/custom-functions.98af4a5e.chunk.js +0 -1
- package/studio/build-local/static/js/instance-charts.f1a1969d.chunk.js +0 -1
- package/studio/build-local/static/js/instance-cluster.0dc3ac1b.chunk.js +0 -1
- package/studio/build-local/static/js/instance-config.19223fab.chunk.js +0 -1
- package/studio/build-local/static/js/instance-query.ed7e59f5.chunk.js +0 -1
- package/studio/build-local/static/js/instance-roles.9c3f140d.chunk.js +0 -1
- package/studio/build-local/static/js/instance-status.1687cd77.chunk.js +0 -1
- package/studio/build-local/static/js/instance-users-datatable.ced7813f.chunk.js +0 -1
- package/studio/build-local/static/js/instance-users.12c0c117.chunk.js +0 -1
- package/studio/build-local/static/js/instance.b8863754.chunk.js +0 -1
- package/studio/build-local/static/js/instances.5bd051eb.chunk.js +0 -1
- package/studio/build-local/static/js/offline-app.b3ad12ac.chunk.js +0 -1
- package/studio/build-local/static/js/online-app.2ac03c15.chunk.js +0 -1
- package/studio/build-local/static/js/organization-billing.a8014c6f.chunk.js +0 -1
- package/studio/build-local/static/js/organization-users.523136d9.chunk.js +0 -1
- package/studio/build-local/static/js/organization.0abc89ca.chunk.js +0 -1
- package/studio/build-local/static/js/organizations.e536b86f.chunk.js +0 -1
- package/studio/build-local/static/js/profile.92f9be59.chunk.js +0 -1
- package/studio/build-local/static/js/roles-jsonviewer.5fe72bc9.chunk.js +0 -1
- package/studio/build-local/static/js/signIn.97bded2f.chunk.js +0 -1
- package/studio/build-local/static/js/signUp.482f9fe4.chunk.js +0 -1
- package/studio/build-local/static/js/structure-reloader.9322abd3.chunk.js +0 -1
- package/studio/build-local/static/js/topnav.5e7913a5.chunk.js +0 -1
- /package/studio/build-local/static/js/{723.36068040.chunk.js.LICENSE.txt → 723.c58acced.chunk.js.LICENSE.txt} +0 -0
- /package/studio/build-local/static/js/{807.3473ab0a.chunk.js.LICENSE.txt → 807.510f66df.chunk.js.LICENSE.txt} +0 -0
- /package/studio/build-local/static/js/{main.05c1913d.js.LICENSE.txt → main.a22f6951.js.LICENSE.txt} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[25],{8244:(e,s,a)=>{a.r(s),a.d(s,{default:()=>A});var t=a(7313),r=a(6782),n=a(5399),l=a(7387),o=a(9327),c=a(238),i=a(3516),d=a(4122),m=a(9842),u=a(6449),x=a(5447),h=a(511),j=a(9859);const p=1e9,Z=1073741824,f=async e=>{let{auth:s,url:a,signal:t,refresh:r,is_local:n,cachedSystemInfo:l,skip:o=[]}=e;const c=["network","disk","cpu","memory","system"],i=await(0,j.Z)({operation:{operation:"system_information",attributes:null!==o&&void 0!==o&&o.length?c.filter((e=>!o.includes(e))):c},auth:s,url:a,signal:t});if(i.error&&r)return x.Z.update((e=>{e.systemInfoError=!0}));if(i.error)return x.Z.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 d=o.includes("memory")?parseFloat(l.totalMemory):i.memory.total/Z,m=o.includes("memory")?parseFloat(l.usedMemory):i.memory.active/Z,u=o.includes("memory")?parseFloat(l.freeMemory):i.memory.available/Z,h=o.includes("memory")?l.memoryStatus:u/d<.1?"danger":u/d<.25?"warning":"success",f=o.includes("disk")?parseFloat(l.totalDisk):"darwin"===i.system.platform?i.disk.size[0].size/p:n?i.disk.size[0].size/Z:i.disk.size.find((e=>"/home/ubuntu/hdb"===e.mount)).size/Z,v=o.includes("disk")?parseFloat(l.usedDisk):"darwin"===i.system.platform?i.disk.size.reduce(((e,s)=>e+s.used),0)/p:n?i.disk.size.reduce(((e,s)=>e+s.used),0)/Z:i.disk.size.find((e=>"/home/ubuntu/hdb"===e.mount)).used/Z,w=o.includes("disk")?parseFloat(l.freeDisk):f-v,N=o.includes("disk")?l.diskStatus:w/f<.1?"danger":w/f<.25?"warning":"success",g=o.includes("cpu")?l.cpuInfo:"".concat(i.cpu.manufacturer," ").concat(i.cpu.brand),k=o.includes("cpu")?l.cpuCores:"".concat(i.cpu.physicalCores," physical / ").concat(i.cpu.cores," virtual"),y=o.includes("cpu")?parseFloat(l.cpuLoad):i.cpu.current_load.currentLoad||i.cpu.current_load.currentload||0,b=o.includes("cpu")?l.cpuStatus:y>90?"danger":y>75?"warning":"success",S=o.includes("network")?parseFloat(l.networkTransferred):i.network.stats.reduce(((e,s)=>e+s.tx_bytes),0)/p,_=o.includes("network")?parseFloat(l.networkReceived):i.network.stats.reduce(((e,s)=>e+s.rx_bytes),0)/p,D=o.includes("network")?parseFloat(l.networkLatency):i.network.latency.ms,C=o.includes("network")?parseFloat(l.networkLatencyStatus):D>1e3?"danger":D>500?"warning":"success",L={totalMemory:null===d||void 0===d?void 0:d.toFixed(2),usedMemory:null===m||void 0===m?void 0:m.toFixed(2),freeMemory:null===u||void 0===u?void 0:u.toFixed(2),memoryStatus:h,totalDisk:null===f||void 0===f?void 0:f.toFixed(2),usedDisk:null===v||void 0===v?void 0:v.toFixed(2),freeDisk:null===w||void 0===w?void 0:w.toFixed(2),diskStatus:N,cpuInfo:g,cpuCores:k,cpuLoad:null===y||void 0===y?void 0:y.toFixed(2),cpuStatus:b,networkTransferred:null===S||void 0===S?void 0:S.toFixed(2),networkReceived:null===_||void 0===_?void 0:_.toFixed(2),networkLatency:D,networkLatencyStatus:C};return x.Z.update((e=>{e.systemInfo=L}))};var v=a(2589),w=a(4220),N=a(2261),g=a(6417);let k;const y=function(){const e=(0,l.Kw)(x.Z,(e=>e.compute_stack_id)),s=(0,l.Kw)(x.Z,(e=>e.auth)),a=(0,l.Kw)(x.Z,(e=>e.url)),j=(0,l.Kw)(x.Z,(e=>e.systemInfo)),p=(0,l.Kw)(x.Z,(e=>e.is_local)),Z=(0,l.Kw)(x.Z,(e=>e.storage)),y=(0,l.Kw)(u.Z,(s=>{var a;return s.alarms&&(null===(a=s.alarms[e])||void 0===a?void 0:a.alarmCounts["Disk I/O"])}),[e]),[b,S]=(0,t.useState)(!1),[_,D]=(0,t.useState)(!0),[C,L]=(0,t.useState)(null);async function F(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]?await f({auth:s,url:a,is_local:p,signal:k.signal,refresh:!!j,previousSystemInfo:j,skip:["disk","network"]}):await f({auth:s,url:a,is_local:p,signal:k.signal,refresh:!!j,previousSystemInfo:j})}return(0,t.useEffect)((()=>{let e=!0;return s&&(async()=>{D(!0),k=new AbortController,await F(!!C),e&&D(!1)})(),()=>{var s;null===(s=k)||void 0===s||s.abort(),e=!1}}),[s,C]),(0,d.Z)((()=>{s&&b&&L(Date.now())}),h.Z.refresh_content_interval),(0,g.jsxs)(m.SV,{onError:(e,s)=>(0,N.Z)({error:{message:e.message,componentStack:s}}),FallbackComponent:w.Z,children:[(0,g.jsxs)(r.Z,{className:"floating-card-header",children:[(0,g.jsx)(n.Z,{children:"host system"}),(0,g.jsxs)(n.Z,{className:"text-end",children:[(0,g.jsx)(o.Z,{color:"link",title:"Update Metrics",className:"me-2",onClick:async()=>{D(!0),await F(!1),D(!1)},children:(0,g.jsx)("i",{className:"fa ".concat(_?"fa-spinner fa-spin":"fa-sync-alt")})}),(0,g.jsxs)(o.Z,{color:"link",title:"Turn on autofresh",onClick:()=>S(!b),children:[(0,g.jsx)("span",{className:"me-2",children:"auto"}),(0,g.jsx)("i",{className:"fa fa-lg fa-toggle-".concat(b?"on":"off")})]})]})]}),(0,g.jsx)(c.Z,{className:"my-3 instance-details",children:(0,g.jsx)(i.Z,{children:j||b?(0,g.jsxs)(r.Z,{children:[(0,g.jsx)(n.Z,{md:"2",sm:"4",xs:"6",children:(0,g.jsx)(v.Z,{header:"Total Memory",className:"mb-3",children:(0,g.jsxs)("div",{className:"nowrap-scroll",children:[(null===j||void 0===j?void 0:j.totalMemory)||"...","GB"]})})}),(0,g.jsx)(n.Z,{md:"2",sm:"4",xs:"6",children:(0,g.jsx)(v.Z,{header:"Active Memory",className:"mb-3",children:(0,g.jsxs)("div",{className:"nowrap-scroll",children:[(null===j||void 0===j?void 0:j.usedMemory)||"...","GB"]})})}),(0,g.jsx)(n.Z,{md:"2",sm:"4",xs:"6",children:(0,g.jsx)(v.Z,{header:"Available Memory",className:"mb-3",children:(0,g.jsxs)("div",{className:"nowrap-scroll text-".concat((null===j||void 0===j?void 0:j.memoryStatus)||"grey"),children:[(null===j||void 0===j?void 0:j.freeMemory)||"...","GB"]})})}),(0,g.jsx)(n.Z,{md:"2",sm:"4",xs:"6",children:(0,g.jsx)(v.Z,{header:"Total Disk",className:"mb-3",children:(0,g.jsxs)("div",{className:"nowrap-scroll",children:[(null===j||void 0===j?void 0:j.totalDisk)||"...","GB"]})})}),(0,g.jsx)(n.Z,{md:"2",sm:"4",xs:"6",children:(0,g.jsx)(v.Z,{header:"Used Disk",className:"mb-3",children:(0,g.jsxs)("div",{className:"nowrap-scroll",children:[(null===j||void 0===j?void 0:j.usedDisk)||"...","GB"]})})}),(0,g.jsx)(n.Z,{md:"2",sm:"4",xs:"6",children:(0,g.jsx)(v.Z,{header:"Free Disk",className:"mb-3",children:(0,g.jsxs)("div",{className:"nowrap-scroll text-".concat((null===j||void 0===j?void 0:j.diskStatus)||"grey"),children:[(null===j||void 0===j?void 0:j.freeDisk)||"...","GB"]})})}),(0,g.jsx)(n.Z,{md:"2",sm:"4",xs:"6",children:(0,g.jsx)(v.Z,{header:"CPU Cores",className:"mb-3",children:(0,g.jsx)("div",{className:"nowrap-scroll",children:(null===j||void 0===j?void 0:j.cpuCores)||"..."})})}),(0,g.jsx)(n.Z,{md:"2",sm:"4",xs:"6",children:(0,g.jsx)(v.Z,{header:"CPU Load",className:"mb-3",children:(0,g.jsxs)("div",{className:"nowrap-scroll text-".concat((null===j||void 0===j?void 0:j.cpuStatus)||"grey"),children:[(null===j||void 0===j?void 0:j.cpuLoad)||"...","%"]})})}),(0,g.jsx)(n.Z,{md:"2",sm:"4",xs:"6",children:(0,g.jsx)(v.Z,{header:"Network Volume Up",className:"mb-3",children:(0,g.jsxs)("div",{className:"nowrap-scroll",children:[(null===j||void 0===j?void 0:j.networkTransferred)||"...","GB"]})})}),(0,g.jsx)(n.Z,{md:"2",sm:"4",xs:"6",children:(0,g.jsx)(v.Z,{header:"Network Volume Down",className:"mb-3",children:(0,g.jsxs)("div",{className:"nowrap-scroll",children:[(null===j||void 0===j?void 0:j.networkReceived)||"...","GB"]})})}),(0,g.jsx)(n.Z,{md:"2",sm:"4",xs:"6",children:(0,g.jsx)(v.Z,{header:"Network Latency",className:"mb-3",children:(0,g.jsx)("div",{className:"nowrap-scroll text-".concat((null===j||void 0===j?void 0:j.networkLatencyStatus)||"grey"),children:null!==j&&void 0!==j&&j.networkLatency?"".concat(null===j||void 0===j?void 0:j.networkLatency," ms"):"N/A"})})}),(0,g.jsx)(n.Z,{md:"2",sm:"4",xs:"6",children:(0,g.jsx)(v.Z,{header:"Disk IOPS",className:"mb-3",children:(0,g.jsx)("div",{className:"nowrap-scroll text-".concat(y?"danger":""),children:p?"HARDWARE LIMIT":(null===Z||void 0===Z?void 0:Z.iops)||"..."})})})]}):(0,g.jsx)("div",{className:"pt-5 text-center",children:(0,g.jsx)("i",{className:"fa fa-spinner fa-spin text-purple"})})})}),(0,g.jsx)("br",{})]})};var b=a(8467);const S=e=>"object"===typeof e&&!Array.isArray(e)&&null!==e;const _=function(e){let{level:s,timestamp:a,message:t,tags:l,thread:o}=e;return(0,g.jsx)("div",{className:"item-row",children:(0,g.jsxs)(r.Z,{children:[(0,g.jsx)(n.Z,{className:"text-nowrap ".concat(null===s||void 0===s?void 0:s.toLowerCase()),children:(null===s||void 0===s?void 0:s.toUpperCase())||"UNKNOWN"}),(0,g.jsx)(n.Z,{className:"text-nowrap",children:new Date(a||null).toLocaleDateString()}),(0,g.jsx)(n.Z,{className:"text-nowrap",children:new Date(a||null).toLocaleTimeString()}),(0,g.jsx)(n.Z,{className:"text-nowrap",children:o}),(0,g.jsx)(n.Z,{className:"text-nowrap",children:null===l||void 0===l?void 0:l.join(", ")}),(0,g.jsx)(n.Z,{xs:"12",className:"mt-1",children:S(t)&&t.error?t.error:JSON.stringify(t).slice(1,-1)})]})})};let D;const C=function(){const{compute_stack_id:e}=(0,b.UO)(),s=(0,l.Kw)(x.Z,(e=>e.auth)),a=(0,l.Kw)(x.Z,(e=>e.url)),u=(0,l.Kw)(x.Z,(e=>e.logs),[e]),p=(0,l.Kw)(x.Z,(e=>e.logsError)),[Z,f]=(0,t.useState)(!1),[v,k]=(0,t.useState)(!0),[y,S]=(0,t.useState)(!0);return(0,t.useEffect)((()=>{let e=!0;return s&&(async()=>{k(!0),D=new AbortController,await(async e=>{let{auth:s,url:a,signal:t}=e;const r=await(0,j.Z)({operation:{operation:"read_log",limit:1e3,order:"desc"},auth:s,url:a,signal:t});return x.Z.update((e=>{e.logs=r.filter((e=>e.message)),e.logsError=!1}))})({auth:s,url:a,signal:D.signal,currentLogCount:(null===u||void 0===u?void 0:u.length)||0}),e&&k(!1)})(),()=>{var s;null===(s=D)||void 0===s||s.abort(),e=!1}}),[s,y]),(0,d.Z)((()=>s&&Z&&S(Date.now())),h.Z.refresh_content_interval),(0,g.jsxs)(m.SV,{onError:(e,s)=>(0,N.Z)({error:{message:e.message,componentStack:s}}),FallbackComponent:w.Z,children:[(0,g.jsxs)(r.Z,{className:"floating-card-header",children:[(0,g.jsx)(n.Z,{children:"logs"}),(0,g.jsxs)(n.Z,{className:"text-end",children:[(0,g.jsx)(o.Z,{color:"link",title:"Update Logs",className:"me-2",onClick:()=>S(Date.now()),children:(0,g.jsx)("i",{className:"fa ".concat(v?"fa-spinner fa-spin":"fa-sync-alt")})}),(0,g.jsxs)(o.Z,{color:"link",title:"Turn on autofresh",onClick:()=>f(!Z),children:[(0,g.jsx)("span",{className:"me-2",children:"auto"}),(0,g.jsx)("i",{className:"fa fa-lg fa-toggle-".concat(Z?"on":"off")})]})]})]}),(0,g.jsx)(c.Z,{className:"my-3",children:(0,g.jsxs)(i.Z,{className:"item-list",children:[(0,g.jsxs)(r.Z,{xs:"5",className:"header",children:[(0,g.jsx)(n.Z,{className:"text-bold text-nowrap",children:"status"}),(0,g.jsx)(n.Z,{className:"text-bold text-nowrap",children:"date"}),(0,g.jsx)(n.Z,{className:"text-left text-bold text-nowrap",children:!v&&p?(0,g.jsxs)("span",{className:"text-danger",children:["log fetch error: ",(new Date).toLocaleTimeString().toLowerCase()]}):(0,g.jsx)("span",{children:"time"})}),(0,g.jsx)(n.Z,{className:"text-bold text-nowrap",children:"thread"}),(0,g.jsx)(n.Z,{className:"text-bold text-nowrap",children:"tags"})]}),(0,g.jsx)("hr",{className:"mt-1 mb-0"}),(0,g.jsx)("div",{className:"item-scroller",children:!v||u||Z?u&&u.length?u.map(((e,s)=>(0,g.jsx)(_,{...e},s))):u&&!u.length?(0,g.jsx)("div",{className:"pt-5 text-center",children:"no logs found"}):(0,g.jsx)("div",{className:"pt-5 text-center",children:"no logs found in this view"}):(0,g.jsx)("div",{className:"pt-5 text-center",children:(0,g.jsx)("i",{className:"fa fa-spinner fa-spin text-lightgrey"})})})]})}),(0,g.jsx)("br",{})]})};const L=function(e){let{end_datetime:s,start_datetime:a,status:t,message:l}=e;return(0,g.jsx)("div",{className:"item-row",children:(0,g.jsxs)(r.Z,{children:[(0,g.jsx)(n.Z,{xs:"3",className:"text-nowrap ".concat(t.toLowerCase()),children:t}),(0,g.jsx)(n.Z,{xs:"3",className:"text-nowrap",children:new Date(a).toLocaleDateString()}),(0,g.jsx)(n.Z,{xs:"3",className:"text-nowrap",children:new Date(a).toLocaleTimeString()}),(0,g.jsx)(n.Z,{xs:"3",className:"text-nowrap",children:new Date(s).toLocaleTimeString()}),(0,g.jsx)(n.Z,{xs:"12",className:"mt-1",children:S(l)?JSON.stringify(l):l})]})})};let F;const K=function(){const e=(0,l.Kw)(x.Z,(e=>e.auth)),s=(0,l.Kw)(x.Z,(e=>e.url)),a=(0,l.Kw)(x.Z,(e=>e.jobs)),u=(0,l.Kw)(x.Z,(e=>e.jobsError)),[p,Z]=(0,t.useState)(!1),[f,v]=(0,t.useState)(!0),[k,y]=(0,t.useState)(!0);return(0,t.useEffect)((()=>{let t=!0;return e&&(async()=>{v(!0),F=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:a,signal:t,from_date:r,to_date:n,currentJobCount:l}=e;const o=await(0,j.Z)({operation:{operation:"search_jobs_by_start_date",from_date:r,to_date:n},auth:s,url:a,signal:t});return o.error&&l?x.Z.update((e=>{e.jobsError=!0})):!Array.isArray(o)||o.error?x.Z.update((e=>{e.jobs=[],e.jobsError=!0})):x.Z.update((e=>{e.jobs=[...o].sort(((e,s)=>s.start_datetime-e.end_datetime)),e.jobsError=!1}))})({auth:e,url:s,signal:F.signal,currentJobCount:(null===a||void 0===a?void 0:a.length)||0,from_date:l,to_date:n}),t&&v(!1)})(),()=>{var e;null===(e=F)||void 0===e||e.abort(),t=!1}}),[e,k]),(0,d.Z)((()=>e&&p&&y(Date.now())),h.Z.refresh_content_interval),(0,g.jsxs)(m.SV,{onError:(e,s)=>(0,N.Z)({error:{message:e.message,componentStack:s}}),FallbackComponent:w.Z,children:[(0,g.jsxs)(r.Z,{className:"floating-card-header",children:[(0,g.jsx)(n.Z,{children:"jobs"}),(0,g.jsxs)(n.Z,{className:"text-end",children:[(0,g.jsx)(o.Z,{color:"link",title:"Update Jobs",className:"me-2",onClick:()=>y(Date.now()),children:(0,g.jsx)("i",{className:"fa ".concat(f?"fa-spinner fa-spin":"fa-sync-alt")})}),(0,g.jsxs)(o.Z,{color:"link",title:"Turn on autofresh",onClick:()=>Z(!p),children:[(0,g.jsx)("span",{className:"me-2",children:"auto"}),(0,g.jsx)("i",{className:"fa fa-lg fa-toggle-".concat(p?"on":"off")})]})]})]}),(0,g.jsx)(c.Z,{className:"my-3",children:(0,g.jsxs)(i.Z,{className:"item-list",children:[(0,g.jsxs)(r.Z,{className:"header",children:[(0,g.jsx)(n.Z,{xs:"3",className:"text-bold text-nowrap",children:"status"}),(0,g.jsx)(n.Z,{xs:"3",className:"text-bold text-nowrap",children:"date"}),!f&&u?(0,g.jsx)(n.Z,{xs:"6",className:"text-end text-danger text-bold text-nowrap",children:(0,g.jsxs)("b",{children:["job fetch error: ",(new Date).toLocaleTimeString().toLowerCase()]})}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Z,{xs:"3",className:"text-bold text-nowrap",children:"start"}),(0,g.jsx)(n.Z,{xs:"3",className:"text-bold text-nowrap",children:"end"})]})]}),(0,g.jsx)("hr",{className:"mt-1 mb-0"}),(0,g.jsx)("div",{className:"item-scroller",children:!f||a||p?null!==a&&void 0!==a&&a.length?a.map((e=>(0,g.jsx)(L,{...e},e.id))):(0,g.jsx)("div",{className:"pt-5 text-center",children:"no jobs found"}):(0,g.jsx)("div",{className:"pt-5 text-center",children:(0,g.jsx)("i",{className:"fa fa-spinner fa-spin text-lightgrey"})})})]})}),(0,g.jsx)("br",{})]})};const T=function(e){let{date:s,type:a,message:t}=e;return(0,g.jsx)("div",{className:"item-row",children:(0,g.jsxs)(r.Z,{children:[(0,g.jsx)(n.Z,{xs:"3",className:"text-danger text-nowrap",children:a}),(0,g.jsx)(n.Z,{xs:"9",className:"text-nowrap",children:new Date(s).toLocaleString()}),(0,g.jsx)(n.Z,{xs:"12",className:"mt-1",children:S(t)?JSON.stringify(t):t})]})})};var E=a(8751);let I;const M=function(){const{customer_id:e}=(0,b.UO)(),s=(0,l.Kw)(x.Z,(e=>e.compute_stack_id)),a=(0,l.Kw)(u.Z,(e=>e.auth)),j=(0,l.Kw)(u.Z,(e=>{var a;return e.alarms&&(null===(a=e.alarms[s])||void 0===a?void 0:a.alarms)}),[s]),p=(0,l.Kw)(u.Z,(e=>e.alarmsError)),[Z,f]=(0,t.useState)(!1),[v,k]=(0,t.useState)(!1),[y,S]=(0,t.useState)(!0);return(0,t.useEffect)((()=>{let s=!0;return a&&(async()=>{k(!0),I=new AbortController,await(0,E.Z)({auth:a,signal:I.signal,customer_id:e,currentAlarmsLength:null===j||void 0===j?void 0:j.length}),s&&k(!1)})(),()=>{var e;null===(e=I)||void 0===e||e.abort(),s=!1}}),[a,y]),(0,d.Z)((()=>a&&Z&&S(Date.now())),h.Z.refresh_content_interval),(0,g.jsxs)(m.SV,{onError:(e,s)=>(0,N.Z)({error:{message:e.message,componentStack:s}}),FallbackComponent:w.Z,children:[(0,g.jsxs)(r.Z,{className:"floating-card-header",children:[(0,g.jsx)(n.Z,{children:"alarms"}),(0,g.jsxs)(n.Z,{className:"text-end",children:[(0,g.jsx)(o.Z,{color:"link",title:"Update Jobs",className:"me-2",onClick:()=>S(Date.now()),children:(0,g.jsx)("i",{className:"fa ".concat(v?"fa-spinner fa-spin":"fa-sync-alt")})}),(0,g.jsxs)(o.Z,{color:"link",title:"Turn on autofresh",onClick:()=>f(!Z),children:[(0,g.jsx)("span",{className:"me-2",children:"auto"}),(0,g.jsx)("i",{className:"fa fa-lg fa-toggle-".concat(Z?"on":"off")})]})]})]}),(0,g.jsx)(c.Z,{className:"my-3",children:(0,g.jsxs)(i.Z,{className:"item-list",children:[(0,g.jsxs)(r.Z,{className:"header",children:[(0,g.jsx)(n.Z,{xs:"3",className:"text-bold text-nowrap",children:"status"}),(0,g.jsx)(n.Z,{xs:"3",className:"text-bold text-nowrap",children:"date"}),(0,g.jsx)(n.Z,{xs:"6",className:"text-end text-danger text-bold",children:!v&&p&&(0,g.jsxs)("span",{children:["alarms fetch error: ",(new Date).toLocaleTimeString().toLowerCase()]})})]}),(0,g.jsx)("hr",{className:"mt-1 mb-0"}),(0,g.jsx)("div",{className:"item-scroller",children:!v||j||Z?null!==j&&void 0!==j&&j.length?j.map((e=>(0,g.jsx)(T,{...e},e.id))):(0,g.jsx)("div",{className:"pt-5 text-center",children:"no alarms found"}):(0,g.jsx)("div",{className:"pt-5 text-center",children:(0,g.jsx)("i",{className:"fa fa-spinner fa-spin text-lightgrey"})})})]})}),(0,g.jsx)("br",{})]})};const A=function(){return(0,g.jsxs)(r.Z,{id:"config",children:[(0,g.jsx)(n.Z,{xs:"12",children:(0,g.jsx)(y,{})}),(0,g.jsx)(n.Z,{lg:"6",xs:"12",children:(0,g.jsx)(C,{})}),(0,g.jsx)(n.Z,{lg:"3",xs:"12",children:(0,g.jsx)(K,{})}),(0,g.jsx)(n.Z,{lg:"3",xs:"12",children:(0,g.jsx)(M,{})})]})}},2589:(e,s,a)=>{a.d(s,{Z:()=>r});a(7313);var t=a(6417);const r=function(e){let{children:s,header:a,subheader:r,maxHeight:n="auto",minHeight:l="auto",className:o}=e;return(0,t.jsxs)("div",{className:"content-container ".concat(o),children:[(0,t.jsxs)("div",{className:"header-container",children:[(0,t.jsx)("span",{className:"header",children:a}),(0,t.jsx)("span",{className:"subheader",children:r})]}),(0,t.jsx)("div",{className:"auto"!==n?"scrollable":"",style:{maxHeight:n,minHeight:l},children:s})]})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[196],{8351:(e,a,s)=>{s.r(a),s.d(a,{default:()=>N});var t=s(7313),n=s(6782),r=s(5399),l=s(9327),i=s(238),o=s(3516),c=s(7387),d=s(8467),g=s(9842),u=s(5447),m=s(2066),h=s(4220),p=s(2261),x=s(6855),j=s(6417);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 v;const N=function(e){var a,s;let{lastUpdate:N,setLastUpdate:b}=e;const{customer_id:C}=(0,d.UO)(),Z=(0,d.s0)(),P=(0,c.Kw)(u.Z,(e=>e.compute_stack_id)),w=(0,c.Kw)(u.Z,(e=>e.auth)),S=(0,c.Kw)(u.Z,(e=>e.url)),[k,z]=(0,t.useState)(f),[F,y]=(0,t.useState)(!0),R=null===(a=k.sorted[0])||void 0===a?void 0:a.id,O=null===(s=k.sorted[0])||void 0===s?void 0:s.desc,E=(0,t.useCallback)((e=>{Z("/o/".concat(C,"/i/").concat(P,"/users/").concat(e))}),[P,C]);return(0,t.useEffect)((()=>{let e=!0;return w&&(async()=>{y(!0),v=new AbortController;const a=await(0,m.Z)({auth:w,url:S,signal:v.signal});e&&(y(!1),z({...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=v)||void 0===a||a.abort()}}),[w,N,k.pageSize]),(0,t.useEffect)((()=>{let e=!0;if(k.tableData.length&&R){const a=[...[...k.tableData]].sort(((e,a)=>e[R]>a[R]&&O?1:e[R]>a[R]||O?-1:1));e&&z({...k,tableData:a})}return()=>{var a;e=!1,null===(a=v)||void 0===a||a.abort()}}),[R,O]),(0,j.jsxs)(g.SV,{onError:(e,a)=>(0,p.Z)({error:{message:e.message,componentStack:a}}),FallbackComponent:h.Z,children:[(0,j.jsxs)(n.Z,{className:"floating-card-header",children:[(0,j.jsx)(r.Z,{children:"existing users"}),(0,j.jsxs)(r.Z,{className:"text-end",children:[(0,j.jsx)(l.Z,{color:"link",onClick:()=>b(Date.now()),className:"me-2",children:(0,j.jsx)("i",{title:"Refresh Structure",className:"fa ".concat(F?"fa-spinner fa-spin":"fa-sync-alt")})}),(0,j.jsx)("span",{className:"mx-3 text",children:"|"}),(0,j.jsx)(l.Z,{color:"link",title:"Filter Users",className:"me-2",onClick:()=>z({...k,filtered:k.showFilter?[]:k.filtered,showFilter:!k.showFilter}),children:(0,j.jsx)("i",{className:"fa fa-search"})})]})]}),(0,j.jsx)(i.Z,{className:"mt-3",children:(0,j.jsx)(o.Z,{className:"react-table-holder",children:(0,j.jsx)(x.Z,{columns:k.dataTableColumns,data:k.tableData,currentPage:k.page,pageSize:k.pageSize,totalPages:k.totalPages,showFilter:k.showFilter,sorted:k.sorted,loading:F,onFilteredChange:e=>z({...k,filtered:e}),onSortedChange:e=>z({...k,sorted:e}),onPageChange:e=>z({...k,pageSize:e}),onPageSizeChange:e=>z({...k,page:0,pageSize:e}),onRowClick:e=>E(e.username)})})})]})}},6855:(e,a,s)=>{s.d(a,{Z:()=>N});var t=s(7313),n=s(5110),r=s(1781),l=s(9842),i=s(6782),o=s(5399),c=s(6417);const d=e=>{let{headerGroups:a,onSortedChange:s,sorted:t,showFilter:n}=e;return a.map((e=>(0,c.jsxs)("div",{...e.getHeaderGroupProps(),children:[(0,c.jsx)(i.Z,{className:"header g-0",children:e.headers.map((e=>{var a,n;return(0,c.jsx)(o.Z,{onClick:()=>{var a,n;return s([{id:e.id,desc:(null===(a=t[0])||void 0===a?void 0:a.id)===e.id&&!(null!==(n=t[0])&&void 0!==n&&n.desc)}])},className:"".concat((null===(a=t[0])||void 0===a?void 0:a.id)===e.id?"sorted":""," ").concat(null!==(n=t[0])&&void 0!==n&&n.desc?"desc":"asc"," ").concat(-1!==e.id.indexOf("hdb-narrow")?"action":""," px-1"),children:(0,c.jsx)("div",{className:"text-renderer",children:e.render("Header")})},e.id)}))}),n&&(0,c.jsx)(i.Z,{className:"filter g-0",children:e.headers.map((e=>(0,c.jsx)(o.Z,{className:-1!==e.id.indexOf("hdb-narrow")?"action":"",children:e.render("Filter")},e.id)))})]})))};var g=s(9327);const u=function(e){let{page:a,pageSize:s,totalPages:t,onPageChange:n,onPageSizeChange:l,loading:d}=e;return(0,c.jsxs)(i.Z,{className:"pagination",children:[(0,c.jsx)(o.Z,{xs:"12",sm:"2",className:"previous",children:(0,c.jsx)(g.Z,{className:"mb-2 btn-pagination",color:"purple",block:!0,onClick:()=>n(a-1),disabled:!t||0===a,children:(0,c.jsx)("i",{className:"fa fa-chevron-left"})})}),(0,c.jsxs)(o.Z,{xs:"12",sm:"4",className:"paginator",children:[(0,c.jsx)("i",{className:"fa fa-book me-2"}),(0,c.jsx)(r.Z,{className:"mb-2",type:"number",value:a+1,min:1,max:t,onChange:e=>n(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.Z,{xs:"12",sm:"4",className:"page-size",children:(0,c.jsx)(r.Z,{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.Z,{xs:"12",sm:"2",className:"next",children:(0,c.jsx)(g.Z,{className:"mb-2 pull-right btn-pagination",block:!0,color:"purple",onClick:()=>n(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:n,setPageSize:l,pageCount:d,nextPage:u,canNextPage:m,loading:h}=e;return(0,c.jsxs)(i.Z,{className:"pagination",children:[(0,c.jsx)(o.Z,{xs:"12",sm:"2",className:"previous",children:(0,c.jsx)(g.Z,{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.Z,{xs:"12",sm:"4",className:"paginator",children:[(0,c.jsx)("i",{className:"fa fa-book me-2"}),(0,c.jsx)(r.Z,{className:"mb-2",type:"number",value:t+1||1,min:1,max:d,onChange:e=>n(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"}):d]})]}),(0,c.jsx)(o.Z,{xs:"12",sm:"4",className:"page-size",children:(0,c.jsx)(r.Z,{className:"mb-2",type:"select",onChange:e=>{n(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.Z,{xs:"12",sm:"2",className:"next",children:(0,c.jsx)(g.Z,{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 h=function(e){let{prepareRow:a,row:s,onRowClick:t=!1}=e;return a(s),(0,c.jsx)(i.Z,{onClick:()=>t&&t(s.original),className:"g-0",children:s.cells.map((e=>(0,c.jsx)(o.Z,{className:-1!==e.column.id.indexOf("hdb-narrow")?"action":"",children:e.render("Cell")},"".concat(e.row.id,"-").concat(e.column.id))))})};var p=s(2261),x=s(4220);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,n]=(0,t.useState)(!1),[r,l]=(0,t.useState)(!1);return(0,c.jsxs)("div",{className:"image-renderer",onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!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:a,src:a,className:"preview-image"}):null]})}const v={Filter:e=>{let{column:{filterValue:a,setFilter:s}}=e;return(0,c.jsx)(r.Z,{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 N=function(e){let{columns:a,data:s,currentPage:r,pageSize:i,totalPages:o,onFilteredChange:g,onSortedChange:j,onPageChange:f,onPageSizeChange:N,showFilter:b,onRowClick:C,sorted:Z,loading:P,manual:w=!1}=e;const{headerGroups:S,page:k,rows:z,prepareRow:F,state:y,setAllFilters:R,canPreviousPage:O,canNextPage:E,pageOptions:D,pageCount:T,gotoPage:_,nextPage:A,previousPage:U,setPageSize:G}=(0,n.useTable)({columns:a,data:s,defaultColumn:v,onFilteredChange:g,onSortedChange:j,onPageChange:f,onPageSizeChange:N,onRowClick:C,manualPagination:w,manualFilters:w,initialState:{pageIndex:r,pageSize:i}},n.useFilters,n.usePagination),[H,I]=(0,t.useState)(!0),L=w||!k.length?z:k;return(0,t.useEffect)((()=>{!b&&y.filters.length?R([]):g(y.filters)}),[y.filters,b]),(0,t.useEffect)((()=>{setTimeout((()=>I(!1)),100)}),[null===L||void 0===L?void 0:L.length]),(0,c.jsxs)(l.SV,{onError:(e,a)=>(0,p.Z)({error:{message:e.message,componentStack:a}}),FallbackComponent:x.Z,children:[(0,c.jsxs)("div",{className:"react-table-scroller",children:[(0,c.jsx)(d,{headerGroups:S,onSortedChange:j,sorted:Z,showFilter:b}),P||H?(0,c.jsx)("div",{className:"centered text-center",children:(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"})}):L.length?L.map((e=>(0,c.jsx)(h,{row:e,prepareRow:F,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:"no records"})]})]}),w?(0,c.jsx)(u,{page:r,pageSize:i,totalPages:o,onPageChange:f,onPageSizeChange:N,loading:P}):(0,c.jsx)(m,{previousPage:U,pageSize:i,canPreviousPage:O,pageIndex:y.pageIndex,pageOptions:D,gotoPage:_,setPageSize:G,pageCount:T,nextPage:A,canNextPage:E,loading:P})]})}},2066:(e,a,s)=>{s.d(a,{Z:()=>r});var t=s(9859),n=s(5447);const r=async e=>{let{auth:a,url:s,signal:r}=e;const l=await(0,t.Z)({operation:{operation:"list_users"},auth:a,url:s,signal:r}),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 n.Z.update((e=>{e.users=i})),i}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[759],{6578:(e,t,r)=>{r.r(t),r.d(t,{default:()=>C});var s=r(7313),n=r(6782),a=r(5399),o=r(8467),c=r(238),i=r(3516),l=r(1781),u=r(9327),d=r(8212),f=r(3672),p=r.n(f),h=r(7387),m=r(9842),y=r(5447),b=r(9481),v=r(1891),g=r(3517),x=r(4220),j=r(2261),w=r(5200),O=r(6417);const Z=function(e){let{setLastUpdate:t}=e;const r=(0,h.Kw)(y.Z,(e=>e.auth)),n=(0,h.Kw)(y.Z,(e=>e.url)),a=(0,h.Kw)(y.Z,(e=>e.users)),o=(0,h.Kw)(y.Z,(e=>e.roles)),f=(0,h.Kw)(y.Z,(e=>{var t;return parseFloat(null===(t=e.registration)||void 0===t?void 0:t.version)<3})),[Z,N]=(0,s.useState)({}),[S,k]=(0,s.useState)({}),C="224px";return p()((async()=>{const{submitted:e}=Z;if(e){const{username:e,password:s,role:o}=S;if(e&&o&&s)if((0,g.Z)(e))if(a.find((t=>t.username.toLowerCase()===e.toLowerCase())))N({error:"User already exists"});else{N({processing:!0});const a=await(0,b.Z)({auth:r,role:o,username:e,password:s,url:n});-1!==a.message.indexOf("successfully")?(t(Date.now()),N({success:a.message})):N({error:a.message})}else N({error:"usernames must have only letters, numbers, hyphens, and underscores"}),setTimeout((()=>N({})),2e3);else N({error:"All fields must be filled out"});setTimeout((()=>k({})),2e3)}}),[Z]),p()((()=>{N({})}),[S]),p()((()=>o&&k({...S,role:!1})),[o]),(0,s.useEffect)((()=>{(0,w.Z)({auth:r,url:n})}),[r,n]),(0,O.jsxs)(m.SV,{onError:(e,t)=>(0,j.Z)({error:{message:e.message,componentStack:t}}),FallbackComponent:x.Z,children:[(0,O.jsx)("span",{className:"floating-card-header",children:"add user"}),Z.processing?(0,O.jsx)(v.Z,{className:"my-3",height:C,status:"processing",header:"Adding User",subhead:"The Account Airedale Is A Good Boy"}):Z.success?(0,O.jsx)(v.Z,{className:"my-3",height:C,status:"success",header:"Success!",subhead:Z.success}):Z.error?(0,O.jsx)(v.Z,{className:"my-3",height:C,status:"error",header:Z.error,subhead:"Please try again"}):(0,O.jsx)(c.Z,{className:"my-3",children:(0,O.jsxs)(i.Z,{children:[(0,O.jsx)(l.Z,{id:"username",type:"text",className:"mb-2 text-center",name:"username",placeholder:"username",value:S.username||"",onChange:e=>k({...S,username:e.target.value})}),(0,O.jsx)(l.Z,{id:"password",type:"text",className:"mb-2 text-center",name:"password",placeholder:"password",value:S.password||"",onChange:e=>k({...S,password:e.target.value})}),(0,O.jsx)(d.ZP,{className:"react-select-container",classNamePrefix:"react-select",onChange:e=>{let{value:t}=e;return k({...S,role:t})},options:o&&o.map((e=>({label:e.role,value:f?e.id:e.role}))),value:o&&S.role&&o.find((e=>e.value===S.role)),isSearchable:!1,isClearable:!1,isLoading:!o,placeholder:"select a role",styles:{placeholder:e=>({...e,textAlign:"center",width:"100%",color:"#BCBCBC"})}}),(0,O.jsx)(u.Z,{id:"addInstanceUser",color:"success",className:"mt-3",block:!0,onClick:()=>N({submitted:!0}),children:"Add User"})]})})]})};var N=r(7377);const S=(0,s.lazy)((()=>Promise.all([r.e(110),r.e(196)]).then(r.bind(r,8351)))),k=(0,s.lazy)((()=>r.e(40).then(r.bind(r,7211))));const C=function(){const{username:e}=(0,o.UO)(),[t,r]=(0,s.useState)(!0);return(0,O.jsxs)(n.Z,{children:[(0,O.jsx)(a.Z,{xl:"3",lg:"4",md:"5",xs:"12",children:(0,O.jsx)(Z,{setLastUpdate:r})}),(0,O.jsx)(a.Z,{xl:"9",lg:"8",md:"7",xs:"12",className:"pb-5",children:(0,O.jsx)(s.Suspense,{fallback:(0,O.jsx)(N.Z,{header:" ",spinner:!0}),children:e?(0,O.jsx)(k,{}):(0,O.jsx)(S,{lastUpdate:t,setLastUpdate:r})})})]})}},1891:(e,t,r)=>{r.d(t,{Z:()=>o});r(7313);var s=r(238),n=r(3516),a=r(6417);const o=function(e){let{header:t,subhead:r=" ",height:o,status:c,className:i}=e;return(0,a.jsx)(s.Z,{className:"form-status ".concat(i),children:(0,a.jsxs)(n.Z,{className:"text-center",style:{height:o},children:[(0,a.jsx)("div",{className:"text-bold",children:t}),(0,a.jsx)("div",{className:"py-4",children:(0,a.jsx)("i",{className:"fa fa-lg ".concat("processing"===c?"fa-spinner fa-spin text-purple":"success"===c?"fa-check-circle text-purple":"fa-exclamation-triangle text-danger")})}),(0,a.jsx)("div",{className:"text-grey",children:r})]})})}},9481:(e,t,r)=>{r.d(t,{Z:()=>n});var s=r(9859);const n=async e=>{let{auth:t,role:r,username:n,password:a,url:o}=e;return(0,s.Z)({operation:{operation:"add_user",role:r,username:n,password:a,active:!0},auth:t,url:o})}},5200:(e,t,r)=>{r.d(t,{Z:()=>a});var s=r(9859),n=r(5447);const a=async e=>{let{auth:t,url:r}=e;const a=await(0,s.Z)({operation:{operation:"list_roles"},auth:t,url:r}),o=[...Array.isArray(a)?a:[]].sort(((e,t)=>e.role.toLowerCase()>t.role.toLowerCase()?1:-1));return n.Z.update((e=>{e.roles=o})),o}},3517:(e,t,r)=>{r.d(t,{Z:()=>s});const s=e=>e.match(/^[-a-zA-Z0-9_]+$/)},1781:(e,t,r)=>{r.d(t,{Z:()=>x});var s=r(7313),n=r(5192),a=r.n(n),o=r(6123),c=r.n(o),i=r(986);function l(e){return l="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},l(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 r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},d.apply(this,arguments)}function f(e,t){if(null==e)return{};var r,s,n=function(e,t){if(null==e)return{};var r,s,n={},a=Object.keys(e);for(s=0;s<a.length;s++)r=a[s],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)r=a[s],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function p(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function m(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,s=b(e);if(t){var n=b(this).constructor;r=Reflect.construct(s,arguments,n)}else r=s.apply(this,arguments);return function(e,t){if(t&&("object"===l(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 v={children:a().node,type:a().string,size:a().oneOfType([a().number,a().string]),bsSize:a().string,valid:a().bool,invalid:a().bool,tag:i.iC,innerRef:a().oneOfType([a().object,a().func,a().string]),plaintext:a().bool,addon:a().bool,className:a().string,cssModule:a().object},g=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)}(o,e);var t,r,n,a=m(o);function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=a.call(this,e)).getRef=t.getRef.bind(y(t)),t.focus=t.focus.bind(y(t)),t}return t=o,(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,n=e.type,a=void 0===n?"text":n,o=e.bsSize,l=e.valid,p=e.invalid,h=e.tag,m=e.addon,y=e.plaintext,b=e.innerRef,v=f(e,u),g=["switch","radio","checkbox"].indexOf(a)>-1,x="select"===a,j="range"===a,w=h||(x||"textarea"===a?a:"input"),O="form-control";y?(O="".concat(O,"-plaintext"),w=h||"input"):j?O="form-range":x?O="form-select":g&&(O=m?null:"form-check-input"),v.size&&/\D/g.test(v.size)&&((0,i.O4)('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'),o=v.size,delete v.size);var Z=(0,i.mx)(c()(t,p&&"is-invalid",l&&"is-valid",!!o&&(x?"form-select-".concat(o):"form-control-".concat(o)),O),r);return("input"===w||h&&"function"===typeof h)&&(v.type="switch"===a?"checkbox":a),v.children&&!y&&"select"!==a&&"string"===typeof w&&"select"!==w&&((0,i.O4)('Input with a type of "'.concat(a,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete v.children),s.createElement(w,d({},v,{ref:b,className:Z,"aria-invalid":p}))}}])&&p(t.prototype,r),n&&p(t,n),Object.defineProperty(t,"prototype",{writable:!1}),o}(s.Component);g.propTypes=v;const x=g}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[896],{5920:(e,t,a)=>{a.r(t),a.d(t,{default:()=>de});var s=a(7313),r=a(8467),n=a(7387),o=a(6160),i=a(3672),l=a.n(i),c=a(4122),u=a(6449),d=a(5447),p=a(2190),m=a(5708),h=a(2742),v=a(1613),_=a(8212),b=a(2135),g=a(9842),f=a(4220),Z=a(2261),y=a(511),j=a(6417);const x=function(e){let{routes:t=[]}=e;const{compute_stack_id:a,customer_id:s}=(0,r.UO)(),[o]=(0,p.Z)({}),i=(0,r.s0)(),l=(0,r.TH)(),c=(0,n.Kw)(d.Z,(e=>e.defaultBrowseURL)),x=(0,n.Kw)(u.Z,(e=>{var t;return e.alarms&&(null===(t=e.alarms[a])||void 0===t?void 0:t.alarmCounts.total)}),[a]),{options:w,activeOption:k}=(0,n.Kw)(u.Z,(e=>{const t=e.instances&&e.instances.find((e=>e.compute_stack_id===a)),s=e.instances&&e.instances.filter((e=>e.compute_stack_id!==a));return{options:s&&s.map((e=>({label:(0,j.jsxs)("span",{children:[(0,j.jsx)("i",{className:"d-none d-sm-inline-block fa me-2 fa-".concat(e.is_local?"server":["CREATE_IN_PROGRESS","UPDATE_IN_PROGRESS","CONFIGURING_NETWORK"].includes(e.status)?"circle-exclamation":"cloud"," ").concat(["CREATE_IN_PROGRESS","UPDATE_IN_PROGRESS","CONFIGURING_NETWORK"].includes(e.status)&&"opacity-25")}),e.instance_name," ",["CREATE_IN_PROGRESS","UPDATE_IN_PROGRESS","CONFIGURING_NETWORK"].includes(e.status)&&"(".concat(e.status.replace(/_/g," ").toLowerCase(),")")]}),value:e.compute_stack_id,has_auth:o[e.compute_stack_id],is_unavailable:["CREATE_IN_PROGRESS","UPDATE_IN_PROGRESS","CONFIGURING_NETWORK"].includes(e.status)}))),activeOption:{label:(0,j.jsxs)("span",{children:[(0,j.jsx)("i",{className:"d-none d-sm-inline-block fa me-2 fa-".concat(t?null!==t&&void 0!==t&&t.is_local?"server":"cloud":"")}),null===t||void 0===t?void 0:t.instance_name]}),value:a}}}),[a]),N="/o/".concat(s,"/i/").concat(a),S=l.pathname.split("/i/".concat(a))[1].split("/")[1],E=null===t||void 0===t?void 0:t.find((e=>e.link===S));return(0,j.jsx)(g.SV,{onError:(e,t)=>(0,Z.Z)({error:{message:e.message,componentStack:t}}),FallbackComponent:f.Z,children:(0,j.jsxs)(m.Z,{className:"app-subnav",children:[!y.Z.is_local_studio&&(0,j.jsx)(h.Z,{navbar:!0,className:"instance-select",children:(0,j.jsx)(_.ZP,{className:"react-select-container",classNamePrefix:"react-select",onChange:e=>{let{value:t,has_auth:a,is_unavailable:r}=e;return!r&&i(a?"/o/".concat(s,"/i/").concat(t,"/").concat(null===E||void 0===E?void 0:E.link):"/o/".concat(s,"/instances/login"))},options:w||[],value:k,defaultValue:k.value,isSearchable:!1,isClearable:!1,isLoading:!w,noOptionsMessage:()=>"No other instances available"})}),(0,j.jsx)(h.Z,{navbar:!0,className:"instance-nav d-none d-lg-flex",children:null===t||void 0===t?void 0:t.map((e=>(0,j.jsx)(v.Z,{children:(0,j.jsxs)(b.OL,{title:e.link,className:"nav-link",to:"".concat(N,"/").concat("browse"===e.link&&c?"".concat(e.link,"/").concat(c):e.link),children:[(0,j.jsx)("i",{className:"d-none d-sm-inline-block fa me-2 fa-".concat(e.icon)}),e.label||e.link,!!x&&"status"===e.link&&(0,j.jsx)("span",{className:"badge",children:x})]})},e.path)))}),(0,j.jsx)(h.Z,{navbar:!0,className:"instance-nav-select d-flex d-lg-none",children:(0,j.jsx)(_.ZP,{className:"react-select-container",classNamePrefix:"react-select",width:"200px",onChange:e=>{let{value:t}=e;return i("".concat(N,"/").concat(t))},options:null===t||void 0===t?void 0:t.map((e=>({label:(0,j.jsxs)("span",{children:[(0,j.jsx)("i",{className:"d-none d-sm-inline-block fa me-2 fa-".concat(e.icon)}),e.label]}),value:e.link}))),isLoading:!(null!==E&&void 0!==E&&E.link),value:{label:(0,j.jsxs)("span",{children:[(0,j.jsx)("i",{className:"d-none d-sm-inline-block fa me-2 fa-".concat(null===E||void 0===E?void 0:E.icon)}),null===E||void 0===E?void 0:E.label]}),value:null===E||void 0===E?void 0:E.link},defaultValue:null===E||void 0===E?void 0:E.link,isSearchable:!1,isClearable:!1})})]})})};var w=a(238),k=a(3516),N=a(5192),S=a.n(N),E=a(6123),O=a.n(E),P=a(986),T=["className","cssModule","tag"];function R(){return R=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},R.apply(this,arguments)}function C(e,t){if(null==e)return{};var a,s,r=function(e,t){if(null==e)return{};var a,s,r={},n=Object.keys(e);for(s=0;s<n.length;s++)a=n[s],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++)a=n[s],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var A={className:S().string,cssModule:S().object,tag:P.iC};function I(e){var t=e.className,a=e.cssModule,r=e.tag,n=void 0===r?"div":r,o=C(e,T),i=(0,P.mx)(O()(t,"card-title"),a);return s.createElement(n,R({},o,{className:i}))}I.propTypes=A;const K=I;var z=a(6782),F=a(5399),U=a(9496),q=a(35),G=a(8659);const B=(0,s.lazy)((()=>Promise.all([a.e(110),a.e(849)]).then(a.bind(a,7962)))),D=(0,s.lazy)((()=>a.e(3).then(a.bind(a,6201)))),L=(0,s.lazy)((()=>Promise.all([a.e(424),a.e(641)]).then(a.bind(a,9716)))),W=(0,s.lazy)((()=>Promise.all([a.e(718),a.e(938)]).then(a.bind(a,638)))),V=(0,s.lazy)((()=>a.e(6).then(a.bind(a,2122)))),H={tableData:[],dataTableColumns:[],filtered:[],sorted:[],page:0,pageSize:20,autoRefresh:!1,showFilter:!1,newEntityAttributes:!1,hashAttribute:!1};function M(e){let{table:t}=e;return(0,j.jsx)(w.Z,{className:"my-3 missing-primary-key",children:(0,j.jsxs)(k.Z,{children:[(0,j.jsx)(K,{children:"No Primary Key"}),(0,j.jsx)("i",{className:"fa fa-warning mt-3"}),(0,j.jsxs)("span",{className:"mt-3",children:["The table ","'".concat(t,"'")," does not have a primary key. The HarperDB Studio does not currently support tables without a primary key defined. Please see the"," ",(0,j.jsx)("a",{href:"https://docs.harperdb.io/docs",target:"_blank",rel:"noreferrer",children:"HarperDB documention"})," ","to see the standard HarperDB querying options."]})]})})}const Y=function(){var e,t,a,o,i;const l=(0,r.s0)(),c=(0,r.TH)(),{schema:u,table:m,action:h,customer_id:v,compute_stack_id:_}=(0,r.UO)(),[b]=(0,p.Z)({}),y=b&&b[_],x=(0,n.Kw)(d.Z,(e=>e.url)),w=(0,n.Kw)(d.Z,(e=>e.registration)),k=null===w||void 0===w?void 0:w.version,[N,S]=(null===k||void 0===k?void 0:k.split("."))||[],E="".concat(N,".").concat(S),O=(0,n.Kw)(d.Z,(e=>e.structure)),[P,T]=(0,s.useState)({schemas:[],tables:[],activeTable:!1}),[R,C]=(0,s.useState)(H),A="/o/".concat(v,"/i/").concat(_,"/browse"),I=(null===(e=b[_])||void 0===e?void 0:e.super)||!0===(null===(t=b[_])||void 0===t?void 0:t.structure),K=I||(null===(a=b[_])||void 0===a?void 0:a.structure)&&(null===(o=b[_])||void 0===o||null===(i=o.structure)||void 0===i?void 0:i.includes(u)),Y=I?"Please ".concat(u&&P.tables&&!P.tables.length||!P.schemas.length?"create":"choose"," a ").concat(u?"table":"".concat(E>=4.2?"database":"schema")):"This user has not been granted access to any tables. A super-user must update this user's role.",[J,$]=(0,s.useState)(!0);return(0,s.useEffect)((()=>{!async function(){if(m){const e=await(0,U.Z)({auth:y,url:x,schema:u,table:m});$(Boolean(e.hash_attribute))}}()}),[y,x,u,m]),(0,s.useEffect)((()=>{if(O){const e=Object.keys(O),t=Object.keys((null===O||void 0===O?void 0:O[u])||{});if(!e.length&&"/browse"!==c.pathname)return T({schemas:[],tables:[],activeTable:!1}),void l("/o/".concat(v,"/i/").concat(_,"/browse"));if(e.length&&!e.includes(u))return void l("/o/".concat(v,"/i/").concat(_,"/browse/").concat(e[0]));if(t.length&&!t.includes(m))return void l("/o/".concat(v,"/i/").concat(_,"/browse/").concat(u,"/").concat(t[0]));P.activeTable!=="".concat(_,":").concat(u,":").concat(m)&&C(H),T({schemas:e,tables:t,activeTable:"".concat(_,":").concat(u,":").concat(m)})}}),[O,u,m,_]),(0,s.useEffect)((()=>{(0,G.Z)({auth:y,url:x})}),[y,x,u,m]),(0,j.jsxs)(z.Z,{id:"browse",children:[(0,j.jsx)(F.Z,{xl:"3",lg:"4",md:"5",xs:"12",children:(0,j.jsxs)(g.SV,{onError:(e,t)=>(0,Z.Z)({error:{message:e.message,componentStack:t}}),FallbackComponent:f.Z,children:[(0,j.jsx)(D,{activeItem:u,items:P.schemas,baseUrl:A,itemType:E>=4.2?"database":"schema",showForm:I}),u&&(0,j.jsx)(D,{activeItem:m,items:P.tables,activeSchema:u,baseUrl:"".concat(A,"/").concat(u),itemType:"table",showForm:K}),(0,j.jsx)(V,{centerText:!0,label:"refresh ".concat(E>=4.2?"databases":"schemas"," and tables")})]})}),(0,j.jsx)(F.Z,{xs:"12",className:"d-block d-md-none",children:(0,j.jsx)("hr",{})}),(0,j.jsx)(F.Z,{xl:"9",lg:"8",md:"7",xs:"12",children:(0,j.jsx)(g.SV,{onError:(e,t)=>(0,Z.Z)({error:{message:e.message,componentStack:t}}),FallbackComponent:f.Z,children:u&&m&&"csv"===h&&P.activeTable?(0,j.jsx)(W,{}):u&&m&&h&&P.activeTable?(0,j.jsx)(L,{newEntityAttributes:R.newEntityAttributes,hashAttribute:R.hashAttribute}):u&&m&&P.activeTable?(0,j.jsx)(B,{activeTable:P.activeTable,tableState:R,setTableState:C}):u&&m&&!J?(0,j.jsx)(M,{}):(0,j.jsx)(q.Z,{headline:Y,icon:(0,j.jsx)("i",{className:"fa fa-exclamation-triangle text-warning"})})})})]})},J=(0,s.lazy)((()=>Promise.all([a.e(446),a.e(60)]).then(a.bind(a,7606)))),$=(0,s.lazy)((()=>Promise.all([a.e(110),a.e(287),a.e(446),a.e(255)]).then(a.bind(a,9951)))),Q=(0,s.lazy)((()=>Promise.all([a.e(110),a.e(287),a.e(463)]).then(a.bind(a,1608)))),X=(0,s.lazy)((()=>Promise.all([a.e(723),a.e(490)]).then(a.bind(a,7535)))),ee=(0,s.lazy)((()=>a.e(25).then(a.bind(a,8244)))),te=(0,s.lazy)((()=>a.e(759).then(a.bind(a,6578)))),ae=(0,s.lazy)((()=>a.e(701).then(a.bind(a,7752)))),se=(0,s.lazy)((()=>Promise.all([a.e(110),a.e(424),a.e(442)]).then(a.bind(a,3218)))),re=e=>{let{super_user:t,version:a=null}=e;const s={element:(0,j.jsx)(Y,{}),path:"browse/:schema?/:table?/:action?/:hash?",link:"browse",label:"browse",icon:"list"},r={element:(0,j.jsx)($,{}),path:"query",link:"query",label:"query",icon:"search"},n={element:(0,j.jsx)(te,{}),path:"users/:username?",link:"users",label:"users",icon:"users"},o={element:(0,j.jsx)(ae,{}),path:"roles/:role_id?",link:"roles",label:"roles",icon:"check-square"},i={element:(0,j.jsx)(J,{}),path:"charts",link:"charts",label:"charts",icon:"chart-line"},l={element:(0,j.jsx)(Q,{}),path:"replication",link:"replication",label:"replication",icon:"cubes"},c={element:(0,j.jsx)(se,{}),path:"functions/:action?/:project?/:type?/:file?",link:"functions",label:"functions",icon:"project-diagram"},u={element:(0,j.jsx)(se,{}),path:"applications",link:"applications",label:"applications",icon:"project-diagram"},d={element:(0,j.jsx)(ee,{}),path:"status",link:"status",label:"status",icon:"tachometer-alt"},p={element:(0,j.jsx)(X,{}),path:"config",link:"config",label:"config",icon:"wrench"};let m=!1;if(a){const[e,t]=(null===a||void 0===a?void 0:a.split("."))||[],s=parseInt(e,10),r=parseInt(t,10);m=parseFloat("".concat(s,".").concat(r))>=4.2}return y.Z.is_local_studio&&t?[s,r,n,o,l,m?u:c,d,p]:t?[s,r,n,o,i,l,m?u:c,d,p]:y.Z.is_local_studio?[s,r,i]:[s,r]};var ne=a(7377),oe=a(3230),ie=a(6047),le=a(8751),ce=a(2230),ue=a(5491);const de=function(){const{compute_stack_id:e,customer_id:t}=(0,r.UO)(),a=(0,o.VY)(),i=(0,r.s0)(),[m,h]=(0,s.useState)(!0),[v,_]=(0,p.Z)({}),b=v&&v[e],g=(0,n.Kw)(u.Z,(e=>e.auth)),f=(0,n.Kw)(u.Z,(e=>{var a,s;return null===(a=e.auth)||void 0===a||null===(s=a.orgs)||void 0===s?void 0:s.find((e=>{var a;return(null===(a=e.customer_id)||void 0===a?void 0:a.toString())===t}))})),Z=(0,n.Kw)(u.Z,(e=>e.products)),w=(0,n.Kw)(u.Z,(e=>e.regions)),k=(0,n.Kw)(u.Z,(e=>e.subscriptions)),N=(0,n.Kw)(u.Z,(e=>e.instances)),S=(0,n.Kw)(u.Z,(t=>e&&t.instances&&t.instances.find((t=>t.compute_stack_id===e))),[e]),E=(0,n.Kw)(d.Z,(e=>e.url)),O=(0,n.Kw)(d.Z,(e=>e.restarting)),P=(0,n.Kw)(d.Z,(e=>e.registration)),T=re({customer_id:t,super_user:null===b||void 0===b?void 0:b.super,version:null===P||void 0===P?void 0:P.version}),[R,C]=(0,s.useState)(!1);return l()((()=>{!y.Z.is_local_studio&&g&&t&&(0,ie.Z)({auth:g,customer_id:t})}),[g,t,y.Z.is_local_studio]),l()((()=>{!y.Z.is_local_studio&&g&&t&&(0,le.Z)({auth:g,customer_id:t})}),[g,t,N,y.Z.is_local_studio]),l()((()=>{g&&Z&&w&&k&&t&&(null===N||void 0===N||!N.length)&&(0,oe.Z)({auth:g,customer_id:t,products:Z,regions:w,subscriptions:k,instanceCount:null===N||void 0===N?void 0:N.length})}),[g,Z,w,t,k,N]),l()((async()=>{if(S&&b){d.Z.update((()=>S));const{error:e}=await(0,G.Z)({auth:b,url:S.url});await(0,ue.Z)({auth:b,url:S.url}),h(!1),e&&setTimeout((()=>i("/o/".concat(t,"/instances"))),10)}}),[S]),l()((()=>{R&&E&&null!==b&&void 0!==b&&b.super?a.success("Your instance user role has been upgraded to super_user"):R&&E&&a.success("Your instance user role has been downgraded to standard")}),[a,null===b||void 0===b?void 0:b.super]),l()((()=>C(!0)),(()=>C(!1)),[]),(0,c.Z)((async()=>{if(E){var s,r;const l=await(0,ce.Z)({auth:b,url:E});if(l.error&&"Network request failed"!==l.message&&!O)a.error("Unable to connect to instance."),i("/o/".concat(t,"/instances"));else if(!l.error&&O)d.Z.update((e=>{e.restarting=!1}));else if(!l.error&&(null===b||void 0===b?void 0:b.super)!==(null===(s=l.role)||void 0===s||null===(r=s.permission)||void 0===r?void 0:r.super_user)){var n,o;_({...v,[e]:{...b,super:null===(n=l.role)||void 0===n||null===(o=n.permission)||void 0===o?void 0:o.super_user}})}}}),y.Z.refresh_content_interval),(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(x,{routes:T}),(y.Z.is_local_studio||f&&N)&&!m?(0,j.jsx)(s.Suspense,{fallback:(0,j.jsx)(ne.Z,{header:" ",spinner:!0}),children:(0,j.jsxs)(r.Z5,{children:[T.map((e=>(0,j.jsx)(r.AW,{path:e.path,element:e.element},e.path))),(0,j.jsx)(r.AW,{path:"*",element:(0,j.jsx)(r.Fg,{to:T[0].path,replace:!0})})]})}):(0,j.jsx)(ne.Z,{header:"loading instance",spinner:!0})]})}},35:(e,t,a)=>{a.d(t,{Z:()=>o});a(7313);var s=a(238),r=a(3516),n=a(6417);const o=function(e){let{headline:t,description:a,icon:o,warning:i}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"floating-card-header text-end",children:"\xa0"}),(0,n.jsx)(s.Z,{className:"my-3",children:(0,n.jsx)(r.Z,{children:(0,n.jsxs)("div",{className:"empty-prompt narrow",children:[o,t&&(0,n.jsx)("div",{className:"mt-3",children:t}),(0,n.jsx)("div",{className:"mt-3",children:a}),i&&(0,n.jsxs)("div",{className:"warning-text mt-3",children:["Warning: ",i]})]})})})]})}},1343:(e,t,a)=>{a.d(t,{Z:()=>r});var s=a(9859);const r=async e=>{let{auth:t,url:a}=e;return(0,s.Z)({operation:{operation:"describe_all"},auth:t,url:a})}},9496:(e,t,a)=>{a.d(t,{Z:()=>r});var s=a(9859);const r=async e=>{let{auth:t,url:a,schema:r,table:n,signal:o}=e;return(0,s.Z)({operation:{operation:"describe_table",schema:r,table:n},auth:t,url:a,signal:o})}},5491:(e,t,a)=>{a.d(t,{Z:()=>n});var s=a(9859),r=a(5447);const n=async e=>{let{auth:t,url:a}=e;const n=await(0,s.Z)({operation:{operation:"registration_info"},auth:t,url:a,timeout:5e3});return r.Z.update((e=>{e.registration=n.error?{}:n})),n}},2230:(e,t,a)=>{a.d(t,{Z:()=>r});var s=a(9859);const r=async e=>{let{auth:t,url:a}=e;return(0,s.Z)({operation:{operation:"user_info"},auth:t,url:a,timeout:5e3})}},8751:(e,t,a)=>{a.d(t,{Z:()=>l});var s=a(576),r=a(6449),n=a(2261),o=a(511);const i=e=>{let{alarms:t}=e;return Object.values(t).reduce(((e,t)=>(e[t.type.trim()]=(e[t.type.trim()]||0)+1,e.total+=1,e)),{total:0})},l=async e=>{let{auth:t,customer_id:a,signal:l,currentAlarmsLength:c}=e,u=null;try{if(u=await(0,s.Z)({endpoint:"getAlarms",method:"POST",payload:{customer_id:a},signal:l,auth:t}),u.error&&c)return r.Z.update((e=>{e.alarmsError=!0}));if(!Array.isArray(u)||u.error)return r.Z.update((e=>{e.alarms=[],e.alarmsError=!0}));const e=[...u].sort(((e,t)=>t.date-e.date)),n=Object.assign({},...e.map((e=>{var t;const a=null===(t=u)||void 0===t?void 0:t.filter((t=>t.compute_stack_id===e.compute_stack_id));return{[e.compute_stack_id]:{alarms:a,alarmCounts:i({alarms:a.filter((e=>e.date+1e3*o.Z.alarm_badge_threshold>Date.now()))})}}})));return r.Z.update((e=>{e.alarms=n,e.alarmsError=!1}))}catch(d){return(0,n.Z)({type:"lms data",status:"error",url:o.Z.lms_api_url,operation:"getAlarms",request:{customer_id:a},error:{catch:d.toString()},customer_id:a})}}},6047:(e,t,a)=>{a.d(t,{Z:()=>l});var s=a(576),r=a(6449),n=a(2261),o=a(511),i=a(2174);const l=async e=>{let{auth:t,customer_id:a}=e,l=null;try{var c;return l=await(0,s.Z)({endpoint:"getCustomer",method:"POST",payload:{customer_id:a},auth:t}),(0,i.Z)({auth:t,customer_id:a,stripe_id:null===(c=l)||void 0===c?void 0:c.stripe_id}),l.error||r.Z.update((e=>{var t;e.customer={...l,customer_id:a},e.hasCard=null===(t=l.stripe_payment_methods)||void 0===t?void 0:t[0]})),l}catch(u){return(0,n.Z)({type:"lms data",status:"error",url:o.Z.lms_api_url,operation:"getCustomer",request:{customer_id:a},error:{catch:u.toString()},customer_id:a})}}},3230:(e,t,a)=>{a.d(t,{Z:()=>c});var s=a(576),r=a(6449),n=a(1842);const o=e=>{let{is_local:t,wavelength_zone_id:a,cloud_provider:s}=e;switch(!0){case a:return"wavelength_compute";case t:return"local_compute";case"akamai"===s:return"akamai_compute";default:return"cloud_compute"}};var i=a(2261),l=a(511);const c=async e=>{let{auth:t,customer_id:a,products:c,regions:u,subscriptions:d,instanceCount:p=0}=e,m=null;try{if(m=await(0,s.Z)({endpoint:"getInstances",method:"POST",payload:{customer_id:a,user_id:t.user_id},auth:t}),Array.isArray(m)){const e=m.map((e=>{const t=(e=>{let{instance:t,products:a,regions:s,subscriptions:r}=e;try{var i,l;const e=t.compute_subscription_id?r[o(t)]:a[o(t)],c=null===e||void 0===e?void 0:e.find((e=>e.value.stripe_plan_id===t.stripe_plan_id&&(!t.compute_subscription_id||e.value.compute_subscription_id===t.compute_subscription_id))),u=t.storage_subscription_id?r.cloud_storage:a.cloud_storage,d=!t.is_local&&(null===u||void 0===u?void 0:u.find((e=>e.value.data_volume_size===t.data_volume_size&&e.value.stripe_storage_plan_id===t.stripe_storage_plan_id&&(!t.storage_subscription_id||e.value.storage_subscription_id===t.storage_subscription_id)))),p=parseFloat((null===c||void 0===c||null===(i=c.value)||void 0===i?void 0:i.compute_price)||0)+parseFloat((null===d||void 0===d||null===(l=d.value)||void 0===l?void 0:l.storage_price)||0),m=p?"$".concat((0,n.Z)(p.toFixed(2))):"FREE",h=t.compute_subscription_id&&t.storage_subscription_id?"PREPAID":p?"".concat(m,"/").concat(c.value.compute_interval):"FREE",v=!t.is_local&&s.find((e=>e.value===t.instance_region));return{compute:null===c||void 0===c?void 0:c.value,storage:null===d||void 0===d?void 0:d.value,totalPrice:p,totalPriceString:m,totalPriceStringWithInterval:h,region:v}}catch(c){return console.log(c)}})({instance:e,products:c,regions:u,subscriptions:d});return{...e,...t}})),t=e.sort(((e,t)=>e.instance_name>t.instance_name?1:-1));return r.Z.update((e=>{e.instances=t})),t}return!p&&r.Z.update((e=>{e.instances=[]}))}catch(h){return(0,i.Z)({type:"lms data",status:"error",url:l.Z.lms_api_url,operation:"getInstances",request:{customer_id:a},error:{catch:h.toString()},customer_id:a})}}},2174:(e,t,a)=>{a.d(t,{Z:()=>c});var s=a(576),r=a(6449),n=a(2261),o=a(8329),i=a(9274),l=a(511);const c=async e=>{let{auth:t,customer_id:a,stripe_id:c}=e;try{const e=await(0,s.Z)({endpoint:"getPrepaidSubscriptions",method:"POST",payload:{customer_id:a,stripe_id:c},auth:t});return!e.error&&r.Z.update((t=>{t.subscriptions={cloud_storage:(0,i.Z)(e.cloud_storage||[]),cloud_compute:(0,o.Z)(e.cloud_compute||[]),wavelength_compute:(0,o.Z)(e.wavelength_compute||[]),local_compute:(0,o.Z)(e.local_compute||[])}}))}catch(u){return(0,n.Z)({type:"lms data",status:"error",url:l.Z.lms_api_url,operation:"getPrepaidSubscriptions",error:{catch:u.toString()}})}}},9859:(e,t,a)=>{a.d(t,{Z:()=>r});var s=a(8093);const r=async e=>{let{operation:t,auth:a,url:r,timeout:n=0,authType:o,signal:i}=e;try{const e=new AbortController,u=setTimeout((()=>n?e.abort():null),n),d=await(0,s.he)(r,{signal:i||e.signal,method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json",authorization:"token"===o?"Bearer ".concat(a.token):"Basic ".concat(btoa("".concat(a.user,":").concat(a.pass)))}});clearTimeout(u);const p=await d.json();var l,c;return p.error?{error:!0,message:p.error,type:"response",role_errors:null===(l=p.main_permissions)||void 0===l?void 0:l.join(", "),access_errors:null===(c=p.unauthorized_access)||void 0===c?void 0:c.map((e=>{var t,a,s,r,n,o;return{schema:e.schema,table:e.table,type:null!==(t=e.required_attribute_permissions)&&void 0!==t&&t.length?"attribute":"table",entity:null!==(a=e.required_attribute_permissions)&&void 0!==a&&a.length?null===(s=e.required_attribute_permissions[0])||void 0===s?void 0:s.attribute_name:e.table,permission:null!==(r=e.required_attribute_permissions)&&void 0!==r&&r.length?null===(n=e.required_attribute_permissions[0])||void 0===n?void 0:n.required_permissions.join(", "):null===(o=e.required_table_permissions)||void 0===o?void 0:o.join(", ")}}))}:200!==d.status?{error:!0,message:"Error of type ".concat(d.status),type:"status"}:p}catch(u){return{error:!0,message:u.message,type:"catch"}}}},3708:(e,t,a)=>{a.d(t,{Z:()=>s});const s=e=>{const t={},a=[];return e.error||Object.keys(e).sort().forEach(((s,r)=>{t[s]={},0===r&&a.push(s),Object.keys(e[s]).sort().forEach(((n,o)=>{0===o&&0===r&&a.push(n),t[s][n]={record_count:e[s][n].record_count,hashAttribute:e[s][n].hash_attribute}}))})),{structure:t,defaultBrowseURL:a.join("/")}}},8659:(e,t,a)=>{a.d(t,{Z:()=>i});var s=a(5447),r=a(1343),n=a(3708),o=a(5491);const i=async e=>{let{auth:t,url:a}=e;const i=await(0,r.Z)({auth:t,url:a}),l=await(0,o.Z)({auth:t,url:a});if(i.error)return{error:"Could not log into instance"};const{structure:c,defaultBrowseURL:u}=(0,n.Z)(i);return s.Z.update((e=>{e.auth=t,e.structure=c,e.defaultBrowseURL=u,e.loading=!1,e.registration=l})),{error:!1}}},2190:(e,t,a)=>{a.d(t,{Z:()=>s});const s=(0,a(8131).Z)("instanceAuths")},5447:(e,t,a)=>{a.d(t,{Z:()=>s});const s=new(a(7387).yh)({})},3672:(e,t,a)=>{var s=a(7313);function r(e,t,a){var r="function"===typeof t;s.useEffect((function(){var a,s=!0,n=e((function(){return s}));return Promise.resolve(n).then((function(e){a=e})),function(){s=!1,r&&t(a)}}),r?a:t)}e.exports=r,e.exports.useAsyncEffect=r},4122:(e,t,a)=>{a.d(t,{Z:()=>n});var s=a(7313),r=function(){};function n(e,t,a){var n=(0,s.useRef)(r);(0,s.useEffect)((function(){n.current=e})),(0,s.useEffect)((function(){a&&null!==t&&!1!==t&&n.current()}),[a]),(0,s.useEffect)((function(){if(null!==t&&!1!==t){var e=setInterval((function(){return n.current()}),t);return function(){return clearInterval(e)}}}),[t])}}}]);
|