harperdb
Version:
HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.
1 lines • 15.7 kB
JavaScript
;(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[138],{4244:(e,s,t)=>{t.r(s),t.d(s,{default:()=>d});var r=t(9950),a=t(5077),n=t(4414);const o=(0,r.lazy)((()=>Promise.all([t.e(11),t.e(138)]).then(t.bind(t,2670)))),i=[{element:(0,n.jsx)(o,{}),path:"",link:"profile",label:"profile",icon:"user",iconCode:"f007"}];var l=t(8651),c=t(4979);const d=function(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.A,{}),(0,n.jsx)(r.Suspense,{fallback:(0,n.jsx)(c.A,{header:" ",spinner:!0}),children:(0,n.jsxs)(a.BV,{children:[i.map((e=>(0,n.jsx)(a.qh,{path:e.path,element:e.element},e.path))),(0,n.jsx)(a.qh,{path:"*",element:(0,n.jsx)(a.C5,{to:"/profile",replace:!0})},"*")]})})]})}},2670:(e,s,t)=>{t.r(s),t.d(s,{default:()=>_});var r=t(9950),a=t(7176),n=t(6114),o=t(9379),i=t(4084),l=t(8156),c=t(5488),d=t(3452),u=t(6713),p=t(9435),m=t(5553),h=t(2714),f=t(3628),x=t(5996),b=t(3304);var g=t(8188),j=t(3150),A=t(2773),v=t(4414);const y=function(){const e=(0,u.O$)(m.A,(e=>e.auth)),[s,t]=(0,r.useState)({}),[y,w]=(0,r.useState)(e),N="314px";return(0,r.useEffect)((()=>{let s=!0;return s&&null!==e&&void 0!==e&&e.profileError?t({error:e.message}):s&&null!==e&&void 0!==e&&e.profileSuccess&&t({success:e.message}),()=>{s=!1}}),[e.profileError,e.profileSuccess]),(0,r.useEffect)((()=>{let e=!0;return(s.error||s.success)&&setTimeout((()=>{e&&t({})}),2e3),()=>{e=!1}}),[s.error,s.success]),(0,v.jsx)(p.tH,{onError:(e,s)=>(0,f.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:j.A,children:(0,v.jsx)("div",{className:"my-3",children:s.processing?(0,v.jsx)(g.A,{height:N,status:"processing",header:"Updating Profile",subhead:"The Profile Poodle is doing his thing."}):s.success?(0,v.jsx)(g.A,{height:N,status:"success",header:"Success!",subhead:s.success}):s.error?(0,v.jsx)(g.A,{height:N,status:"error",header:s.error,subhead:"Please try again"}):(0,v.jsx)(i.A,{className:"mb-3",children:(0,v.jsxs)(l.A,{children:[(0,v.jsxs)(a.A,{children:[(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:null===e||void 0===e||!e.email_bounced||null!==e&&void 0!==e&&e.profileSuccess?(0,v.jsx)("span",{children:e.email}):(0,v.jsx)("span",{className:"text-danger",children:"please provide a valid email address"})}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(c.A,{id:"email",type:"text",className:"mb-0 text-center ".concat(null===e||void 0===e||!e.email_bounced||null!==e&&void 0!==e&&e.profileSuccess?"":"error"),name:"email",placeholder:"email address",onChange:e=>w((0,o.A)((0,o.A)({},y),{},{email:e.target.value})),value:y.email||"",disabled:s.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"first name"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(c.A,{id:"firstname",type:"text",className:"mb-0 text-center",name:"fname",placeholder:"first name",onChange:e=>w((0,o.A)((0,o.A)({},y),{},{firstname:e.target.value})),value:y.firstname||"",disabled:s.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"last name"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(c.A,{id:"lastname",type:"text",className:"mb-0 text-center",name:"lname",placeholder:"last name",onChange:e=>w((0,o.A)((0,o.A)({},y),{},{lastname:e.target.value})),value:y.lastname||"",disabled:s.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"github repo"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(c.A,{id:"github_repo",type:"text",className:"mb-0 text-center",name:"github_repo",placeholder:"github repo",onChange:e=>w((0,o.A)((0,o.A)({},y),{},{github_repo:e.target.value})),value:y.github_repo||"",disabled:s.submitted})})]}),(0,v.jsx)("hr",{className:"mt-2 mb-4"}),(0,v.jsx)(d.A,{id:"saveProfile",color:"purple",block:!0,onClick:()=>{t({submitted:!0});const{firstname:s,lastname:r,github_repo:a,email:n}=y;s&&r&&n?a&&!(0,A.A)(a)?t({error:"github repo must be a valid URL"}):e.firstname===s&&e.lastname===r&&e.github_repo===a&&e.email===n?t({error:"Nothing seems to have changed"}):(t({processing:!0}),(async e=>{let{auth:s,firstname:t,lastname:r,customer_id:a,user_id:n,github_repo:i,email:l}=e,c=null;try{return c=await(0,h.A)({endpoint:"updateUser",method:"POST",payload:{firstname:t,lastname:r,customer_id:a,user_id:n,github_repo:i,email:l},auth:s}),c.error?m.A.update((e=>{e.auth=(0,o.A)((0,o.A)((0,o.A)({},s),c),{},{profileError:Date.now()})})):(m.A.update((e=>{e.auth=(0,o.A)((0,o.A)({},s),{},{profileSuccess:Date.now()},c)})),(0,b.A)({email:l,pass:s.pass,loggingIn:!0}))}catch(d){return(0,f.A)({type:"lms data",status:"error",url:x.A.lms_api_url,operation:"updateUser",request:{firstname:t,lastname:r,customer_id:a,user_id:n,github_repo:i},error:{catch:d.toString()},customer_id:a})}})({auth:e,firstname:s,lastname:r,user_id:e.user_id,github_repo:a,email:n})):t({error:"All fields are required"})},disabled:s.submitted,children:"Save Profile"})]})})})})};var w=t(4127),N=t(5283);const k=function(){const e=(0,u.O$)(m.A,(e=>e.auth)),[s,t]=(0,N.A)({}),[h,x]=(0,r.useState)({}),[b,A]=(0,r.useState)({}),y="259px";return(0,r.useEffect)((()=>{let e=!0;return(h.error||h.success)&&setTimeout((()=>{e&&x({})}),2e3),()=>{e=!1}}),[h.error,h.success]),(0,v.jsx)(p.tH,{onError:(e,s)=>(0,f.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:j.A,children:(0,v.jsx)("div",{className:"my-3",children:h.processing?(0,v.jsx)(g.A,{height:y,status:"processing",header:"Updating Password",subhead:"The Security Shepherd is mad-hashing."}):h.success?(0,v.jsx)(g.A,{height:y,status:"success",header:"Success!",subhead:h.success}):h.error?(0,v.jsx)(g.A,{height:y,status:"error",header:h.error,subhead:"Please try again"}):(0,v.jsx)(i.A,{children:(0,v.jsxs)(l.A,{children:[(0,v.jsxs)(a.A,{children:[(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"current password"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(c.A,{id:"oldpassword",type:"password",className:"mb-0 text-center",name:"current password",placeholder:"current password",onChange:e=>A((0,o.A)((0,o.A)({},b),{},{oldpassword:e.target.value})),value:b.oldpassword||"",disabled:h.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"new password"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(c.A,{id:"newpassword1",type:"password",className:"mb-0 text-center",name:"new password",placeholder:"new password",onChange:e=>A((0,o.A)((0,o.A)({},b),{},{newpassword:e.target.value})),value:b.newpassword||"",disabled:h.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"verify password"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(c.A,{id:"newpassword2",type:"password",className:"mb-0 text-center",name:"verify password",placeholder:"verify password",onChange:e=>A((0,o.A)((0,o.A)({},b),{},{newpassword2:e.target.value})),value:b.newpassword2||"",disabled:h.submitted})})]}),(0,v.jsx)("hr",{className:"mt-2 mb-4"}),(0,v.jsx)(d.A,{id:"updatePassword",color:"purple",block:!0,onClick:async()=>{x({submitted:!0});const{oldpassword:r,newpassword:a,newpassword2:n}=b;if(r!==e.pass)x({error:"old password is incorrect"}),A({});else if(a!==n)x({error:"new passwords do not match"}),A({});else if(r&&a&&n){x({processing:!0});const r=await(0,w.A)({auth:e,user_id:e.user_id,password:a});!r||r.passwordError?x({error:e.message}):(t((0,o.A)((0,o.A)({},s),{},{pass:a})),x({success:e.message}),A({}))}else x({error:"all fields are required"}),A({})},disabled:h.submitted,children:"Update Password"})]})})})})};const _=function(){return(0,v.jsxs)(a.A,{children:[(0,v.jsxs)(n.A,{md:"6",className:"mb-4",children:[(0,v.jsx)("span",{className:"floating-card-header",children:"profile"}),(0,v.jsx)(y,{})]}),(0,v.jsxs)(n.A,{md:"6",className:"mb-4",children:[(0,v.jsx)("span",{className:"floating-card-header",children:"password"}),(0,v.jsx)(k,{})]})]})}},8188:(e,s,t)=>{t.d(s,{A:()=>o});t(9950);var r=t(4084),a=t(8156),n=t(4414);const o=function(e){let{header:s,subhead:t=" ",height:o,status:i,className:l}=e;return(0,n.jsx)(r.A,{className:"form-status ".concat(l),children:(0,n.jsxs)(a.A,{className:"text-center",style:{height:o},children:[(0,n.jsx)("div",{className:"text-bold",children:s}),(0,n.jsx)("div",{className:"py-4",children:(0,n.jsx)("i",{className:"fa fa-lg ".concat("processing"===i?"fa-spinner fa-spin text-purple":"success"===i?"fa-check-circle text-purple":"fa-exclamation-triangle text-danger")})}),(0,n.jsx)("div",{className:"text-grey",children:t})]})})}},8651:(e,s,t)=>{t.d(s,{A:()=>m});var r=t(9379),a=(t(9950),t(2072)),n=t(8125),o=t(5746),i=t(8547),l=t(5077),c=t(9435),d=t(3150),u=t(3628),p=t(4414);const m=function(e){let{routes:s=[]}=e;const t=(0,l.Zp)(),m=(0,l.zy)(),h=(null===s||void 0===s?void 0:s.find((e=>e.link===m.pathname)))||s[0];return(0,p.jsx)(c.tH,{onError:(e,s)=>(0,u.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:d.A,children:(0,p.jsx)(a.A,{className:"app-subnav",children:h&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.A,{navbar:!0,className:"instance-nav d-none d-md-flex",children:s.map((e=>e.external?(0,p.jsx)("li",{className:"nav-item",children:(0,p.jsxs)("a",{className:"nav-link",href:e.url,target:"_blank",rel:"noreferrer",children:[(0,p.jsx)("i",{className:"d-none d-sm-inline-block fa me-1 fa-".concat(e.icon)}),e.label]})},e.path):(0,p.jsx)(o.A,{children:(0,p.jsxs)(l.k2,{title:e.link,className:"nav-link",to:e.link||e.path,children:[(0,p.jsx)("i",{className:"d-none d-sm-inline-block fa me-1 fa-".concat(e.icon)}),e.label]})},e.path)))}),(0,p.jsx)(n.A,{navbar:!0,className:"d-flex d-md-none",children:(0,p.jsx)(i.Ay,{className:"react-select-container",classNamePrefix:"react-select",width:"200px",onChange:e=>{let{value:s}=e;return t(s)},options:s.filter((e=>e.link!==h.link)).map((e=>({label:(0,p.jsxs)("span",{children:[(0,p.jsx)("i",{className:"d-none d-sm-inline-block fa me-1 fa-".concat(e.icon)}),e.label]}),value:e.link,iconCode:e.iconCode}))),value:(0,r.A)((0,r.A)({},h),{},{value:null===h||void 0===h?void 0:h.link}),defaultValue:null===h||void 0===h?void 0:h.link,isSearchable:!1,isClearable:!1})})]})})})}},4127:(e,s,t)=>{t.d(s,{A:()=>l});var r=t(9379),a=t(2714),n=t(5553),o=t(3628),i=t(5996);const l=async e=>{let{auth:s,user_id:t,password:l}=e,c=null;try{if(c=await(0,a.A)({endpoint:"updatePassword",method:"POST",payload:{user_id:t,password:l,loggingIn:!0},auth:s}),c.error){const e=(0,r.A)((0,r.A)((0,r.A)({},s),c),{},{passwordError:Date.now()});return n.A.update((s=>{s.auth=e})),e}const e=(0,r.A)((0,r.A)((0,r.A)({},s),{},{passwordSuccess:Date.now(),update_password:!1},c),{},{pass:l});return n.A.update((s=>{s.auth=e})),e}catch(d){return(0,o.A)({type:"lms data",status:"error",url:i.A.lms_api_url,operation:"updatePassword",request:{user_id:t},error:{catch:d.toString()}})}}},2773:(e,s,t)=>{t.d(s,{A:()=>r});const r=e=>!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)},5488:(e,s,t)=>{t.d(s,{A:()=>A});var r=t(9950),a=t(1942),n=t.n(a),o=t(8738),i=t.n(o),l=t(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 s=1;s<arguments.length;s++){var t=arguments[s];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},u.apply(this,arguments)}function p(e,s){if(null==e)return{};var t,r,a=function(e,s){if(null==e)return{};var t,r,a={},n=Object.keys(e);for(r=0;r<n.length;r++)t=n[r],s.indexOf(t)>=0||(a[t]=e[t]);return a}(e,s);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)t=n[r],s.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function m(e,s){for(var t=0;t<s.length;t++){var r=s[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,s){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,s){return e.__proto__=s,e},h(e,s)}function f(e){var s=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 t,r=b(e);if(s){var a=b(this).constructor;t=Reflect.construct(r,arguments,a)}else t=r.apply(this,arguments);return function(e,s){if(s&&("object"===c(s)||"function"===typeof s))return s;if(void 0!==s)throw new TypeError("Derived constructors may only return object or undefined");return x(e)}(this,t)}}function x(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:n().node,type:n().string,size:n().oneOfType([n().number,n().string]),bsSize:n().string,valid:n().bool,invalid:n().bool,tag:l.Wx,innerRef:n().oneOfType([n().object,n().func,n().string]),plaintext:n().bool,addon:n().bool,className:n().string,cssModule:n().object},j=function(e){!function(e,s){if("function"!==typeof s&&null!==s)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(s&&s.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),s&&h(e,s)}(o,e);var s,t,a,n=f(o);function o(e){var s;return function(e,s){if(!(e instanceof s))throw new TypeError("Cannot call a class as a function")}(this,o),(s=n.call(this,e)).getRef=s.getRef.bind(x(s)),s.focus=s.focus.bind(x(s)),s}return s=o,(t=[{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,s=e.className,t=e.cssModule,a=e.type,n=void 0===a?"text":a,o=e.bsSize,c=e.valid,m=e.invalid,h=e.tag,f=e.addon,x=e.plaintext,b=e.innerRef,g=p(e,d),j=["switch","radio","checkbox"].indexOf(n)>-1,A="select"===n,v="range"===n,y=h||(A||"textarea"===n?n:"input"),w="form-control";x?(w="".concat(w,"-plaintext"),y=h||"input"):v?w="form-range":A?w="form-select":j&&(w=f?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.'),o=g.size,delete g.size);var N=(0,l.qO)(i()(s,m&&"is-invalid",c&&"is-valid",!!o&&(A?"form-select-".concat(o):"form-control-".concat(o)),w),t);return("input"===y||h&&"function"===typeof h)&&(g.type="switch"===n?"checkbox":n),g.children&&!x&&"select"!==n&&"string"===typeof y&&"select"!==y&&((0,l.mc)('Input with a type of "'.concat(n,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete g.children),r.createElement(y,u({},g,{ref:b,className:N,"aria-invalid":m}))}}])&&m(s.prototype,t),a&&m(s,a),Object.defineProperty(s,"prototype",{writable:!1}),o}(r.Component);j.propTypes=g;const A=j}}]);