Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
import{R as Q,x as e,y as G,cI as z,V as g,bH as W,cJ as B,t as x,aH as F,cK as k,cL as V,cM as _,cN as $,cO as H,cP as J,aK as N,cQ as K,cR as X,cS as Y,cT as Z,cU as U,K as ee,cV as se,cW as ae,cX as te,cY as ne,aF as I,cZ as ie,c_ as le,c$ as re,L,I as oe,bU as ce,d0 as de,c5 as ue,c4 as xe,d1 as C,c0 as ge,d2 as P,af as T,bF as A,d3 as he,d4 as pe,a0 as me,d5 as je,d6 as M,bA as D,d7 as fe,d8 as ve,d9 as Ne,da as E}from"./index-DC3IUagG.js";var O=(s=>(s.STARTED="started",s.STOPPED="stopped",s))(O||{}),w=(s=>(s.ONLINE="online",s.OFFLINE="offline",s.UNKNOWN="unknown",s))(w||{});const ye=Q.forwardRef(function(n,t){return e.jsx(G,Object.assign({},n,{type:"radio",role:"radio",ref:t}))}),be=ye,Ce=()=>{const s=z();return e.jsx(e.Fragment,{children:e.jsx("div",{className:"space-y-8",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{children:"Session"}),e.jsxs("div",{children:["User ID: ",s??"unavailable"]}),e.jsx(g,{onClick:()=>{s===null?W():B()},children:s===null?"Login":"Logout"})]})})})},ke=()=>{const[s,n]=x.useState(!1),t=F();return e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 ",children:[e.jsx("p",{children:`Connection hook triggered: ${s.toString()}`}),e.jsx(g,{onClick:()=>{t.open(void 0,()=>{n(!0)})},children:"Open Connection Modal"})]})},Le=()=>{var o;const s=k(V),n=k(_),[t,c]=x.useState(s??""),[i,a]=$();x.useEffect(()=>{i(void 0)},[]);const l=x.useMemo(()=>{if(a.error!==void 0){if("message"in a.error&&typeof a.error.message=="string")return a.error.message;if("error"in a.error)return a.error.error}return"Unknown error"},[a.error]);return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{children:"Available playlists"}),a.isError?e.jsx(H,{type:"danger",title:"Manifest error",description:l}):null,Object.keys(((o=a.data)==null?void 0:o.playlists)??{}).map(r=>e.jsx(be,{disabled:a.isFetching||a.isError,label:r,name:"current_playlist",checked:r===n,value:r,onChange:()=>J(r)},r)),e.jsx(g,{loading:a.isFetching,onClick:()=>{i(void 0)},children:"Refetch manifest"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{children:"Manifest origin override"}),e.jsx(N,{label:"URL",fluid:!0,placeholder:"Example: http://localhost:4000/",helpText:s===void 0?"No override is set":`Override URL is set to ${s}`,size:"medium",value:t,onChange:r=>{c(r.target.value)}}),e.jsxs("div",{className:"flex gap-4 pt-4",children:[e.jsx(g,{onClick:()=>{K(t),i(void 0)},children:"Update URL"}),e.jsx(g,{color:"danger",onClick:()=>{c(""),X(),i(void 0)},children:"Reset URL"})]})]})]})};function p(s){return e.jsxs("div",{className:"bg-palette-neutral-bg-weak shadow-raised space-y-1 rounded-lg p-4",children:[e.jsx("h3",{className:"h3 pb-2",children:s.title}),s.children]})}const S=()=>`Neo4j ${(Math.random()+1).toString(36).substring(7)}`,we=()=>{const s={value:"5.16.0",label:"5.16.0"},[n,t]=x.useState(S()),[c,i]=x.useState(""),[a,l]=x.useState(""),[o,r]=x.useState(!1),[d,m]=x.useState(s),{data:j}=Y(),[f]=Z(),u=()=>{t(S()),i(""),m(s),r(!1)},v=()=>{if(c.length<8){l("Password must be at least 8 characters long");return}r(!0),l(""),f({name:n,version:d.value,credentials:c}).finally(()=>{u()})},b=(j??[]).filter(h=>U.gte(h.version,"5.0.0")).map(h=>({label:h.version,value:h.version})).sort((h,q)=>U.rcompare(h.value,q.value));return e.jsx(p,{title:"Create local instance",children:e.jsxs("form",{children:[e.jsx("div",{className:"mt-2",children:e.jsx(N,{disabled:o,autoFocus:!0,fluid:!0,label:"Name",type:"text",value:n,onChange:h=>t(h.target.value)})}),e.jsx("div",{className:"mt-2",children:e.jsx(N,{disabled:o,fluid:!0,label:"Password",type:"password",errorText:a,value:c,required:!0,onChange:h=>i(h.target.value)})}),e.jsx("div",{className:"mt-2",children:e.jsx(ee,{size:"small",label:"Neo4j version",type:"select",selectProps:{isDisabled:o,options:b,value:d,onChange:h=>m(h??d)}})}),e.jsx("div",{className:"flex flex-row justify-end pt-2",children:e.jsx(g,{type:"submit",onClick:v,loading:o,children:o?"Creating":"Create"})})]})})},Se=()=>{const[s]=se(),[n]=ae();return e.jsx(g,{"aria-label":"Link local instance",onClick:()=>{s({properties:["openDirectory"],title:"Select destination",message:"The Neo4j intallation will be created in the location selected."}).then(async t=>{"data"in t&&await n({externalPath:t.data,name:S()})})},children:"Link local instance"})},Te=({isStarted:s,isOnline:n,id:t,connectionUri:c,disabled:i})=>{const[a]=te(),[l]=ne(),[o,r]=x.useState(!1),[d,m]=x.useState(!1),j=I(),f=F(),{isConnected:u,isDisconnected:v}=j.status;x.useEffect(()=>{r(!1)},[s]),x.useEffect(()=>{d&&n&&v&&(f.open(),m(!1))},[d,n,u]),x.useEffect(()=>{d&&!n&&u&&(j.disconnect(),m(!1))},[d,n,v]);const b=s?l:a;let h=s?"Stop":"Start";return o&&(h=h==="Stop"?"Stopping":"Starting"),e.jsxs(e.Fragment,{children:[!o&&n&&v&&e.jsx(g,{disabled:i,className:"mr-2",onClick:()=>{f.open()},children:"Connect"}),e.jsx(g,{disabled:i,loading:o,fill:s?"filled":"outlined",onClick:()=>{r(!0),b(t),m(!0)},children:h})]})},Ee=()=>{const{data:s,isLoading:n}=ie(),{data:t}=le(),[c,i]=re();return e.jsxs(p,{title:"Local instances",children:[e.jsxs("div",{className:"flex w-full flex-col items-center",children:[n&&e.jsx(L,{size:"large"}),!n&&s&&s.length>0?e.jsx("ul",{className:"w-full",children:s.map(a=>{if(t){const l=t.entities[a.id],o=(l==null?void 0:l.status)===O.STARTED,r=(l==null?void 0:l.serverStatus)===w.UNKNOWN;return e.jsxs("li",{className:"mt-2 flex flex-row items-center",children:[r&&e.jsx(L,{size:"small"})," ",a.name," - ",l==null?void 0:l.version,e.jsxs("div",{className:"ml-auto flex flex-row",children:[e.jsx(Te,{isStarted:o,isOnline:(l==null?void 0:l.serverStatus)===w.ONLINE,id:a.id,connectionUri:a.connectionUri,disabled:r||i.originalArgs===a.id&&i.isLoading}),e.jsx(oe,{"aria-label":"Uninstall",className:"ml-2",danger:!0,disabled:r||o||i.originalArgs!==a.id&&i.isLoading,loading:i.originalArgs===a.id&&i.isLoading,onClick:()=>{c(a.id).then(async()=>{await globalThis.neo4jWorkspaceDesktop.credentialsManager.delete(a.id)})},children:e.jsx(ce,{})})]})]},`instance-${a.id}`)}return null})}):null]}),e.jsx("div",{className:"flex flex-row justify-end pt-2",children:e.jsx(Se,{})})]})},Ue=()=>{const{isSuccess:s}=de();return s?e.jsxs(e.Fragment,{children:[e.jsx(we,{}),e.jsx(Ee,{})]}):null},Re=()=>{const{openGuide:s,setGuideCurrentPage:n}=ue(),{isLoading:t,isError:c,data:i}=xe(),[a,l]=x.useState("https://neo4j.github.io/workspace-guides/guides-writing-guidance.workspace.json");if(t)return e.jsx(L,{});const o=i==null?void 0:i.guides;if(c||!o)return e.jsx("p",{children:"Error: Can't load guides manifest"});const r={id:C.NX_INTERNAL_TEST,title:"Custom guide preview",url:a};return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("h4",{children:"Available guides"}),e.jsx("ul",{className:"mb-2 grid grid-cols-2 gap-4",children:Object.keys(o).map(d=>e.jsx("li",{children:e.jsx(g,{className:"w-full",fill:"outlined",onClick:()=>{var m;s({id:d,title:d.replace("-"," "),url:((m=o[d])==null?void 0:m.url)??"",target:"sidebar"})},children:d})},d))}),e.jsx("h4",{children:"Preview guide"}),e.jsxs("div",{children:[e.jsx(N,{label:"URL",fluid:!0,size:"medium",value:a,onChange:d=>l(d.target.value)}),e.jsx(g,{className:"mt-4",onClick:()=>{s({id:C.NX_INTERNAL_TEST,url:r.url,title:r.title,target:"sidebar"}),n({id:C.NX_INTERNAL_TEST,pageNumber:0})},children:"Preview"})]})]})},Fe=()=>{const{addNotification:s,notifications:n}=ge();return e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 ",children:[e.jsx("pre",{className:"h-[240px] w-full overflow-scroll text-xs",children:JSON.stringify(n,null,2)}),e.jsxs("div",{children:[["info","success","warning","danger","neutral"].map(t=>e.jsx(g,{className:"mr-2 mt-2",onClick:()=>{s({type:t,title:`${t} notification`,description:"This is a test notification"})},children:t},t)),e.jsx(g,{className:"mr-2 mt-2",onClick:()=>{s({type:"info",title:"Timeout notification",description:"This is a test notification",timeout:2e3})},children:"timeout"},"timeout")]})]})};function y({query:s,children:n}){const[t,c]=x.useState(!0),[i,a]=P({query:s},{metadata:{appScope:T.example,queryType:A.UserAction},paused:t});return e.jsxs("div",{className:"flex p-2",children:[e.jsxs("div",{className:"mr-10 flex w-56 flex-shrink-0 flex-col",children:[e.jsx(g,{loading:i.fetching,size:"small",onClick:()=>{c(!1)},children:n}),i.fetching&&e.jsx(g,{size:"small",onClick:()=>{c(!0)},children:"Cancel"}),!t&&!i.fetching?e.jsx(g,{size:"small",onClick:()=>{a()},children:"Re-run"}):null]}),e.jsxs("div",{className:"max-h-32 overflow-auto",children:[e.jsx("pre",{className:"query-result whitespace-pre-wrap",children:JSON.stringify(i.records,null,2)}),i.error?e.jsx("span",{className:"query-error",children:i.error.message}):null]})]})}function Ie(){return e.jsxs("div",{className:"grid items-start",style:{gridTemplateColumns:"repeat(auto-fit, minmax(calc(100% / 2), 1fr))"},children:[e.jsx(y,{query:"WITH range(1,500) as range UNWIND range as item RETURN item",children:"async query"}),e.jsx(y,{query:"CALL apoc.util.sleep(30000)",children:"async query long"}),e.jsx(y,{query:"WITH range(1,500) as range UNWIND range as item RETURN item",children:"rx query"}),e.jsx(y,{query:"CALL apoc.util.sleep(30000)",children:"rx query long"})]})}const R=!1,Pe="example:hello-world";function Ae(s){const[n,t]=M(s.name);return e.jsx(E,{checked:n,label:s.name,onChange:()=>t()})}function Me(s){const[n,t]=D(s.flag);return e.jsx(E,{checked:n,label:s.flag,onChange:()=>t()})}const De={appScope:T.example,queryType:A.System};function qe(){var f;const s=he(),n=pe(),t=I(),[c]=P({query:"CALL apoc.util.sleep(1) RETURN 1"},{metadata:De,transactionMode:"read"}),[i,a]=me("global","usageTracking");je(T.example).debug("isDev",R);const o=c.error!==void 0&&c.records!==void 0&&c.records.length>0,[r]=M("framework:relate-api"),[d]=D(Pe,R),m=k(fe),j=x.useMemo(()=>{const u=new URL("/",window.location.origin);for(const v of m)u.searchParams.append("enableFlag",v);return u.toString()},[m]);return e.jsxs("main",{className:"mb-60 p-4","data-testid":"example-app",children:[e.jsx("h2",{className:"pb-4",children:"Example app"}),e.jsxs("h3",{className:"pb-4",children:["Version: ","apps/query/2024.06.07+0"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(p,{title:"Feature Flags",children:[d&&e.jsx("div",{children:"I'm only shown in development!"}),"Available flags (click to load feature flag):",e.jsx("div",{className:"space-y-2 p-2 text-left",children:ve.map(u=>e.jsx(Me,{flag:u},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(N,{"aria-label":"Feature flag URL",className:"flex-grow",fluid:!0,defaultValue:j,onClick:u=>u.currentTarget.select()}),e.jsx(g,{onClick:()=>{navigator.clipboard.writeText(j)},children:"Copy"})]})]}),r&&e.jsx(p,{title:"Desktop",children:e.jsx(Ue,{})}),e.jsx(p,{title:"Capabilities",children:e.jsx("div",{className:"space-y-2 p-2 text-left",children:Ne.map(u=>e.jsx(Ae,{name:u},u))})}),e.jsxs(p,{title:"Configuration",children:[e.jsx("h4",{children:"Internal configuration"}),e.jsx("code",{children:e.jsx("pre",{children:JSON.stringify(s,null,2)})}),e.jsx("h4",{children:"Tool configurations"}),e.jsx("code",{children:e.jsx("pre",{children:JSON.stringify(n,null,2)})})]}),e.jsx(p,{title:"Guides",children:e.jsx(Re,{})}),e.jsx(p,{title:"Playlist Preview",children:e.jsx(Le,{})}),e.jsx(p,{title:"Authentication",children:e.jsx(Ce,{})}),e.jsxs(p,{title:"Context",children:[e.jsxs("div",{children:["Bolt URL: ",(f=t.metadata)==null?void 0:f.url]}),e.jsxs("div",{children:["Has APOC: ",e.jsx("span",{"data-testid":"has-apoc",children:o.toString()})]})]}),e.jsx(p,{title:"Settings",children:e.jsx("div",{className:"space-y-2",children:e.jsx(E,{label:"Allow usage tracking",name:"usageTracking",checked:i,value:"allowed",onChange:()=>a(u=>!u)})})}),e.jsx(p,{title:"Queries",children:e.jsx(Ie,{})}),e.jsx(p,{title:"Connection Callback Example",children:e.jsx(ke,{})}),e.jsx(p,{title:"Notifications",children:e.jsx(Fe,{})}),e.jsx("div",{className:"border-palette-primary-border-weak hidden border-2 sm:block",children:"I'm hidden on small screens"})]})]})}export{qe as default};