(this.webpackJsonphalin=this.webpackJsonphalin||[]).push([[0],{140:function(e){e.exports=JSON.parse('{"name":"halin","description":"Halin helps you monitor and improve your Neo4j graph","version":"0.16.0","neo4jDesktop":{"apiVersion":"^1.2.0"},"license":"Apache-2.0","icons":[{"src":"./public/img/halin-icon.png","type":"png"}],"repository":{"type":"git","url":"https://github.com/moxious/halin.git"},"homepage":"http://halin.graphapp.io/","private":false,"dependencies":{"@sentry/browser":"^5.15.5","autobind-decorator":"2.2.1","bluebird":"^3.7.2","generic-pool":"^3.6.1","lodash":"^4.17.21","mathjs":"^5.4.0","moment":"^2.29.1","neo4j-driver":"^4.3.1","pondjs":"^0.9.0","prop-types":"^15.6.0","react":"^16.12.0","react-csv":"^1.1.1","react-d3-components":"^0.9.1","react-dom":"^16.12.0","react-graph-vis":"^1.0.2","react-minimal-pie-chart":"^4.0.0","react-scripts":"^3.4.4","react-sortable-tree":"^2.2.0","react-table":"^6.8.6","react-timeseries-charts":"^0.16.1","react-toastify":"^5.5.0","ringjs":"^0.0.1","semantic-ui-css":"^2.4.1","semantic-ui-react":"^0.88.2","source-map-explorer":"^1.6.0","uri-parser":"^1.0.1","uuid":"^3.3.2","yargs":"^12.0.5"},"scripts":{"analyze":"./node_modules/.bin/source-map-explorer dist/static/js/main.*","start":"./node_modules/.bin/react-scripts start","build":"./node_modules/.bin/react-scripts build","gather":"./node_modules/.bin/babel-node --presets @babel/env,@babel/react --plugins @babel/plugin-proposal-class-properties src/scripts/gather.js","test":"./node_modules/.bin/react-scripts test --env=jsdom --coverage --watchAll=false","eject":"./node_modules/.bin/react-scripts eject","postbuild":"rm -rf dist && mv build dist","prepublishOnly":"npm run build","lint":"eslint src/**/*.js"},"devDependencies":{"@babel/cli":"^7.2.0","@babel/core":"^7.2.0","@babel/node":"^7.2.0","@babel/plugin-proposal-class-properties":"^7.2.1","@babel/preset-env":"^7.2.0","@babel/preset-react":"^7.0.0","jest-expect-message":"^1.0.2","react-test-renderer":"^16.8.3","sinon":"^7.2.6"},"browserslist":[">0.2%","not dead","not ie <= 11","not op_mini all"]}')},1497:function(e,t,n){},1499:function(e,t,n){},1502:function(e,t,n){},1503:function(e,t,n){},1523:function(e,t,n){},1546:function(e,t,n){},1547:function(e,t,n){},1551:function(e,t,n){},1552:function(e,t,n){},1553:function(e,t,n){},1554:function(e,t,n){},1555:function(e,t,n){},1563:function(e,t,n){},1574:function(e,t,n){},1575:function(e,t,n){},1576:function(e,t,n){},1577:function(e,t,n){},1578:function(e,t,n){},1579:function(e,t,n){},159:function(e){e.exports=JSON.parse('{"build":"480","branch":"master","date":1624029125000}')},1645:function(e,t,n){},1647:function(e,t,n){},1648:function(e,t,n){},1649:function(e,t,n){},1650:function(e,t,n){},1651:function(e,t,n){"use strict";n.r(t);var a=n(0),r=n.n(a),s=n(61),i=n.n(s),o=(n(841),n(842),n(843),n(1676)),l=n(112),c=n(140),u=n(2),d=n.n(u),m=function(e){return"".concat(e)},h=function(e){return function(t){return m(t).toLowerCase().indexOf(e.toLowerCase())>-1}},p=h("permission denied"),f=h("no procedure with the name"),g=h("unauthorized"),v=h("Supplied bookmark"),b=h("failed to establish connection in"),y=h("security constraints in your web browser"),E=h("active database"),C=h("insecure websocket connection may not be initiated from a page loaded over HTTPS"),S=h("incorrect authentication details too many times in a row"),w=h("java.io.FileNotFoundException"),T=h("ERR_CONNECTION_REFUSED"),k=h("apoc.import.file.enabled"),O=h("database not up to requested version"),R=h("LDAP authorization info expired"),A={isNeo4jError:function(e){return b(e)||y(e)||p(e)||f(e)||g(e)||v(e)||E(e)||C(e)||S(e)||w(e)||T(e)||O(e)||R(e)},isAPOCError:function(e){return k(e)},matches:h,permissionDenied:p,noProcedure:f,unauthorized:g,bookmarks:v,failedToEstablishConnection:b,browserSecurityConstraints:y,noActiveDatabase:E,contains:function(e,t){return m(e).toLowerCase().indexOf(t.toLowerCase())>-1},insecureWSFromHTTPS:C,repeatedAuthFailure:S,fileNotFound:w,connectionRefused:T,apocFileImportNotEnabled:k,notUpToRequestedVersion:O,ldapExpired:R},j=!1,D=!1,N=function(){return j=!0,o.a({dsn:"https://82705ec41177415dbf13621167480fd8@sentry.io/1297023",maxBreadcrumbs:10,debug:!1,release:c.version})},M=function(e){var t=d.a.get(window,"location.href");return!(t&&t.indexOf("localhost")>-1)&&!A.isNeo4jError(e)},I={init:N,reportError:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return j||N(),D?M(e)?(l.a(e),t&&console.error(t,e),e):e:null},context:function(e){var t={neo4j:e?e.getVersion():null,clustered:e?e.isCluster():null,base:e?e.getBaseURI():null};Object.keys(t).forEach((function(e){l.b(e,t[e])}))},info:function(){for(var e,t=arguments.length,n=new Array(t),a=0;a2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(!(n="string"===typeof t?t:t.accessor))throw new Error("Cannot determine which field to extract from record given ".concat(JSON.stringify(t)));var s=n.indexOf(".")>-1,i=s?n.substring(0,n.indexOf(".")):n,o=s?n.substring(n.indexOf(".")+1):null;try{var l=e.get(i);return o?d.a.get(l,o):l}catch(c){if(a)throw c;return d.a.get(t,"absentValue")||r}},re={};$.a.unpackResults=function(e,t){return e.records.map((function(e,n){var a={index:n};if(!t||!t.required&&!t.optional)throw new Error("Unpack results was passed an invalid schema");return(t.required||[]).forEach((function(t){var n=ae(e,t,!0);a[t]=te(n)?ne(n):n})),(t.optional||[]).forEach((function(t){var n=ae(e,t,!1);a[t]=te(n)?ne(n):n})),a}))},$.a.isNeo4jInt=te,$.a.handleNeo4jInt=ne,$.a.getSessionPool=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:15;if(re[e])return I.fine("RECYCLE pool for ",e),re[e];var a={create:function(){return t.session()},destroy:function(e){return e.close()},validate:function(e){return e.run("RETURN 1;",{}).then((function(){return!0})).catch((function(){return!1}))}},r={min:3,max:Math.max(3,n)},s=ee.a.createPool(a,r);return s.on("factoryCreateError",(function(e){return I.reportError("SESSION POOL ERROR",e)})),s.on("factoryDestroyError",(function(e){return I.reportError("SESSION POOL DESTROY ERROR",e)})),s.start(),re[e]=s,s},$.a.SYSTEM_DB="system",$.a.systemRoles=["admin","reader","architect","publisher","editor","PUBLIC"];var se=$.a,ie=n(15),oe=n(29),le=n.n(oe),ce=n(28),ue=n.n(ce),de=n(285),me=n.n(de),he=function(){function e(t){if(Object(_.a)(this,e),!t.query||!t.columns)throw new Error("All queries require columns and query");if(this.description=t.description||null,this.query=t.bare?t.query:e.disclaim(t.query),this.columns=t.columns,this.dependency=t.dependency||function(){return{pass:!0,description:"No dependencies"}},this.rate=d.a.isNil(t.rate)?1e3:t.rate,this.parameters=t.parameters||{},this.legendOnlyColumns=t.legendOnlyColumns||[],this.exampleResult=t.exampleResult||[],this.void=t.void||!1,this.filter=t.filter,!this.query)throw new Error("Missing query");if(d.a.isNil(this.columns))throw new Error("Missing columns")}return Object(x.a)(e,[{key:"getDependency",value:function(){return this.dependency}},{key:"getParameters",value:function(){return this.parameters}},{key:"getDescription",value:function(){return this.description}},{key:"getQuery",value:function(){return this.query}},{key:"getColumns",value:function(){return this.columns}},{key:"getRate",value:function(){return this.rate}},{key:"getExample",value:function(){return this.exampleResult}}],[{key:"disclaim",value:function(t){return t.indexOf(e.disclaimer)>-1?t:"WITH ".concat(e.disclaimer," ").concat(t)}},{key:"isDisclaimed",value:function(t){return t.indexOf(e.disclaimer)>-1}}]),e}();he.disclaimer="'This query was run by Halin v".concat(c.version,"' AS disclaimer\n"),he.transactionConfig={timeout:5e3,metadata:{app:"halin-v".concat(c.version),type:"user-direct"}};var pe=he,fe=function(e){var t;return(t="string"===typeof e?{accessor:e}:d.a.cloneDeep(e)).Header||(t.Header=t.accessor.charAt(0).toUpperCase()+t.accessor.slice(1)),t.renderWith=function(e){return d.a.set(t,"Cell",e)},t},ge=new pe({description:"Fetches all JMX observations tracked by the database",dependency:null,query:"\n CALL dbms.queryJmx('*:*') \n YIELD name, description, attributes \n RETURN name, description, attributes;\n ",columns:["name","description","attributes"].map(fe),exampleResult:[{name:"org.neo4j:instance=kernel#0,name=Kernel",description:"Information about the Neo4j kernel",attributes:{ReadOnly:{description:"Whether this is a read only instance",value:!1},KernelVersion:{description:"The version of Neo4j",value:"neo4j-kernel, version: 3.5.2,7878bd2465405ceac0335894f82ec11e39d154c2"},StoreId:{description:"An identifier that, together with store creation time, uniquely identifies this Neo4j graph store.",value:"d177cf88f9d76d85"},KernelStartTime:{description:"The time from which this Neo4j instance was in operational mode.",value:1551702440542},DatabaseName:{description:"The name of the mounted database",value:"graph.db"},MBeanQuery:{description:"An ObjectName that can be used as a query for getting all management beans for this Neo4j instance.",value:"org.neo4j:instance=kernel#0,name=*"},StoreLogVersion:{description:"The current version of the Neo4j store logical log.",value:0},StoreCreationDate:{description:"The time when this Neo4j graph store was created.",value:1550434566569}}}]}),ve=new pe({description:"Fetches statistics about garbage collection performance",query:"\n WITH 'generic' AS variant\n CALL dbms.queryJmx('java.lang:name=G1 Young Generation,type=GarbageCollector') \n YIELD name, attributes \n WHERE name =~ '(?i).*garbage.*' \n WITH attributes.LastGcInfo.value.properties as lastGC \n \n RETURN \n lastGC.startTime as startTime,\n lastGC.duration as duration,\n lastGC.GcThreadCount as threadCount\n LIMIT 1",columns:["duration","threadCount","startTime"].map(fe),filter:function(e,t){return d.a.get(e,"startTime")!==d.a.get(t,"startTime")},exampleResult:[{startTime:se.int(320938),duration:se.int(18),threadCount:se.int(18)}]}),be=new pe({description:"Fetches memory utilization statistics using JMX",query:"\n WITH 'generic' AS variant\n CALL dbms.queryJmx('java.lang:type=Memory') yield attributes \n WITH \n attributes.HeapMemoryUsage as heap, \n attributes.NonHeapMemoryUsage as nonHeap\n\n WITH \n heap.value.properties as heapProps,\n nonHeap.value.properties as nonHeapProps\n \n return \n heapProps.init as heapInit, \n heapProps.committed as heapCommitted,\n heapProps.used as heapUsed, \n heapProps.max as heapMax,\n nonHeapProps.init as nonHeapInit,\n nonHeapProps.committed as nonHeapCommitted,\n nonHeapProps.used as nonHeapUsed,\n nonHeapProps.max as nonHeapMax,\n heapProps.used + nonHeapProps.used as totalMem",columns:[{Header:"Total Memory",accessor:"totalMem"},{Header:"Heap Used",accessor:"heapUsed"},{Header:"Heap Committed",accessor:"heapCommitted"},{Header:"Nonheap Used",accessor:"nonHeapUsed"}],exampleResult:[{heapInit:se.int(536870912),heapCommitted:se.int(536870912),heapUsed:se.int(341835784),heapMax:se.int(1073741824),nonHeapInit:se.int(2555904),nonHeapCommitted:se.int(165609472),nonHeapUsed:se.int(161623152),nonHeapMax:se.int(-1),totalMem:se.int(503458936)}]}),ye=new pe({description:"Fetches system and process load averages using JMX",query:"\n WITH 'generic' AS variant\n CALL dbms.queryJmx('java.lang:type=OperatingSystem') \n YIELD attributes \n WITH \n attributes.SystemLoadAverage as SystemLoad, \n attributes.ProcessCpuLoad as ProcessLoad \n RETURN \n SystemLoad.value as systemLoad, \n ProcessLoad.value as processLoad",columns:[{Header:"System Load",accessor:"systemLoad"},{Header:"Process Load",accessor:"processLoad"}],exampleResult:[{systemLoad:3.359375,processLoad:.0013729}]}),Ee=new pe({description:"Fetches operating system memory statistics using JMX",query:"\n WITH 'generic' AS variant\n CALL dbms.queryJmx(\"java.lang:type=OperatingSystem\") \n YIELD attributes \n WITH\n attributes.OpenFileDescriptorCount.value as fdOpen,\n attributes.MaxFileDescriptorCount.value as fdMax,\n\n attributes.FreePhysicalMemorySize.value as physFree,\n attributes.TotalPhysicalMemorySize.value as physTotal,\n\n attributes.CommittedVirtualMemorySize.value as virtCommitted,\n attributes.FreeSwapSpaceSize.value as swapFree,\n attributes.TotalSwapSpaceSize.value as swapTotal,\n\n attributes.Name.value as osName,\n attributes.Version.value as osVersion,\n attributes.Arch.value as arch,\n attributes.AvailableProcessors.value as processors\n RETURN \n fdOpen, fdMax,\n physFree, physTotal,\n virtCommitted, swapFree, swapTotal,\n osName, osVersion, arch, processors",columns:[{Header:"Open FDs",accessor:"fdOpen"},{Header:"Max FDs",accessor:"fdMax"},{Header:"Physical Memory (Free)",accessor:"physFree"},{Header:"Physical Memory (Total)",accessor:"physTotal"},{Header:"Virtual Memory (Committed)",accessor:"virtCommitted"},{Header:"Swap memory (Free)",accessor:"swapFree"},{Header:"Swap memory (Total)",accessor:"swapTotal"},{Header:"OS Name",accessor:"osName"},{Header:"OS Version",accessor:"osVersion"},{Header:"Arch",accessor:"arch"},{Header:"Processors",accessor:"processors"}],rate:1e3,exampleResult:[{fdOpen:se.int(622),fdMax:se.int(10240),physFree:se.int(1044156416),physTotal:se.int(17179869184),virtCommitted:se.int(7469420544),swapFree:se.int(759169024),swapTotal:se.int(3221225472),osName:"Mac OS X",osVersion:"10.13.6",arch:"x86_64",processors:se.int(8)}]}),Ce=new pe({description:"Inspects number of open file descriptors at the OS level",query:"\n WITH 'generic' AS variant\n CALL dbms.queryJmx(\"java.lang:type=OperatingSystem\") \n YIELD attributes \n WITH\n attributes.OpenFileDescriptorCount.value as fdOpen,\n attributes.MaxFileDescriptorCount.value as fdMax\n RETURN \n fdOpen, fdMax\n ",columns:["fdOpen","fdMax"].map(fe),rate:2e3,exampleResult:[{fdOpen:622,fdMax:10240}]}),Se={humanDataSize:function(e){var t=e;if(Math.abs(t)<1024)return t+" B";var n=["kB","MB","GB","TB","PB","EB","ZB","YB"],a=-1;do{t/=1024,++a}while(Math.abs(t)>=1024&&a=1e3&&a1&&void 0!==arguments[1]?arguments[1]:2;return Math.round(e*Math.pow(10,t))/Math.pow(10,t)},roundPct:function(e){return Math.round(100*e)},signalStrengthFromFreshRatio:function(e,t){return 100*(e/Math.max(t,1))},timeAbbreviation2Milliseconds:function(e){return e?e.endsWith("ms")?1*e.slice(0,e.length-2):e.endsWith("s")?1e3*e.slice(0,e.length-1):e.endsWith("m")?1e3*e.slice(0,e.length-1)*60:(I.warn("Unrecognized time suffix ".concat(e)),e):0},signalStrengthFromPing:function(e,t){return t?0:e>=300?25:e>=200?50:e>100?75:100}},we={jsonField:function(e){return r.a.createElement("div",{className:"_jsonField"},JSON.stringify(e.value))},numField:function(e){return r.a.createElement("div",{className:"_numberField"},(t=e.value,d.a.isNil(t)?"n/a":se.isNeo4jInt(t)?Number(se.handleNeo4jInt(t)).toLocaleString():parseInt(t,10).toLocaleString()));var t},dataSizeField:function(e){return r.a.createElement("div",{className:"_dataSizeField"},Se.humanDataSize(e.value,!0))},pctField:function(e){if(d.a.isNil(e.value))return"n/a %";var t,n=100*(t=e.value,d.a.isNil(t)?"n/a":parseFloat(t,10)),a=Math.round(100*n)/100;return r.a.createElement("div",{className:"_pctField"},a," %")},timeField:function(e){return r.a.createElement("div",{className:"_timeField"},function(e){if(d.a.isNil(e))return"n/a";var t=Math.floor(e/36e5%60),n=Math.floor(e/6e4%60),a=Math.floor(e/1e3%60),r=(a<10?"0"+a:a)+"s";return n>0&&(r=(n<10?"0"+n:n)+" "+r),t>0&&(r=(t<10?"0"+t:t)+" "+r),r}(e.value))},mappedValueField:function(e){return function(t){return e[t.value]||t.value}}},Te=we,ke=new pe({description:"Fetches page cache statistics for running Neo4j",query:"\n WITH 'generic' AS variant\n CALL dbms.queryJmx('org.neo4j:instance=kernel#0,name=Page cache')\n YIELD attributes \n WITH \n attributes.Faults.value as faults, \n attributes.EvictionExceptions.value as evictionExceptions, \n attributes.BytesWritten.value as bytesWritten, \n attributes.Flushes.value as flushes, \n attributes.UsageRatio.value as usageRatio, \n attributes.Evictions.value as evictions, \n attributes.FileUnmappings.value as fileUnmappings, \n attributes.BytesRead.value as bytesRead, \n attributes.FileMappings.value as fileMappings, \n attributes.HitRatio.value as hitRatio \n RETURN \n hitRatio, bytesRead, fileMappings, fileUnmappings,\n flushes, usageRatio, bytesWritten, \n faults, evictions, evictionExceptions",columns:[{Header:"Usage Ratio",accessor:"usageRatio",Cell:Te.pctField},{Header:"Hit Ratio",accessor:"hitRatio",Cell:Te.pctField},{Header:"Read",accessor:"bytesRead",Cell:Te.dataSizeField},{Header:"Written",accessor:"bytesWritten",Cell:Te.dataSizeField},{Header:"Faults",accessor:"faults",Cell:Te.numField},{Header:"Flushes",accessor:"flushes",Cell:Te.numField,show:!1},{Header:"Evictions",accessor:"evictions",Cell:Te.numField,show:!1},{Header:"Eviction Except.",accessor:"evictionExceptions",Cell:Te.numField,show:!1},{Header:"File Mappings",accessor:"fileMappings",Cell:Te.numField,show:!1},{Header:"File Unmappings",accessor:"fileUnmappings",Cell:Te.numField,show:!1}],rate:2e3,exampleResult:[{hitRatio:.9945,bytesRead:237650,bytesWritten:237650,fileMappings:40,fileUnmappings:22,flushes:16,usageRatio:1313e-7,bytesWRitten:163790,faults:35,evictions:0,evictionExceptions:0}]}),Oe=new pe({description:"Fetches statistics on overall disk utilization by the database",query:"\n WITH 'generic' AS variant\n CALL dbms.queryJmx('org.neo4j:instance=kernel#0,name=Store sizes') \n YIELD attributes \n WITH\n attributes.CountStoreSize.value as countStore,\n attributes.IndexStoreSize.value as indexStore,\n attributes.LabelStoreSize.value as labelStore,\n attributes.NodeStoreSize.value as nodeStore,\n attributes.PropertyStoreSize.value as propStore, \n attributes.RelationshipStoreSize.value as relStore, \n attributes.SchemaStoreSize.value as schemaStore,\n attributes.StringStoreSize.value as stringStore, \n attributes.TotalStoreSize.value as total, \n attributes.TransactionLogsSize.value as txLogs, \n attributes.ArrayStoreSize.value as arrayStore\n WITH countStore, indexStore, labelStore, nodeStore, \n propStore, relStore, schemaStore, stringStore, total,\n txLogs, arrayStore, \n (total - (countStore + indexStore + labelStore + nodeStore + \n propStore + relStore + schemaStore + stringStore + \n txLogs + arrayStore)) as otherStore\n RETURN \n countStore, indexStore, labelStore,\n schemaStore, txLogs,\n stringStore, arrayStore, \n relStore, propStore, total, nodeStore,\n otherStore; \n ",columns:[{Header:"Total Disk",accessor:"total"},{Header:"Nodes",accessor:"nodeStore"},{Header:"Rels",accessor:"relStore"},{Header:"Props",accessor:"propStore"},{Header:"Index",accessor:"indexStore"},{Header:"Schema",accessor:"schemaStore"},{Header:"TXs",accessor:"txLogs"},{Header:"Strings",accessor:"stringStore"},{Header:"Arrays",accessor:"arrayStore"},{Header:"Other",accessor:"otherStore"}],rate:1e3,exampleResult:[{countStore:se.int(96),indexStore:se.int(40960),labelStore:se.int(16400),schemaStore:se.int(8201),txLogs:se.int(628),stringStore:se.int(8201),arrayStore:se.int(8201),relStore:se.int(24610),propStore:se.int(16409),total:se.int(140474),nodeStore:se.int(8210),otherStore:se.int(8558)}]}),Re=new pe({description:"Fetches statistics on overall disk utilization by the database",query:' \n WITH \'generic\' AS variant\n CALL dbms.queryJmx(\'org.neo4j:instance=kernel#0,name=Store sizes\') \n YIELD attributes \n WITH\n attributes.CountStoreSize.value as countStore,\n attributes.IndexStoreSize.value as indexStore,\n attributes.LabelStoreSize.value as labelStore,\n attributes.NodeStoreSize.value as nodeStore,\n attributes.PropertyStoreSize.value as propStore, \n attributes.RelationshipStoreSize.value as relStore, \n attributes.SchemaStoreSize.value as schemaStore,\n attributes.StringStoreSize.value as stringStore, \n attributes.TotalStoreSize.value as total, \n attributes.TransactionLogsSize.value as txLogs, \n attributes.ArrayStoreSize.value as arrayStore\n WITH countStore, indexStore, labelStore, nodeStore, \n propStore, relStore, schemaStore, stringStore, total,\n txLogs, arrayStore, \n (total - (countStore + indexStore + labelStore + nodeStore + \n propStore + relStore + schemaStore + stringStore + \n txLogs + arrayStore)) as otherStore,\n 1024 * 1024 * 1024 as GB\n WITH [\n {\n label: "Counts",\n units: "GB",\n value: toFloat(countStore) / GB\n },\n {\n label: "Indexes",\n units: "GB",\n value: toFloat(indexStore) / GB \n },\n {\n label: "Labels",\n units: "GB",\n value: toFloat(labelStore) / GB\n },\n {\n label: "Nodes",\n units: "GB",\n value: toFloat(nodeStore) / GB\n },\n {\n label: "Properties",\n units: "GB",\n value: toFloat(propStore) / GB\n },\n {\n label: "Relationships",\n units: "GB",\n value: toFloat(relStore) / GB\n },\n {\n label: "Schema",\n units: "GB",\n value: toFloat(schemaStore) / GB\n },\n {\n label: "Strings",\n units: "GB",\n value: toFloat(stringStore) / GB\n },\n {\n label: "Transaction Logs",\n units: "GB",\n value: toFloat(txLogs) / GB\n },\n {\n label: "Arrays",\n units: "GB",\n value: toFloat(arrayStore) / GB\n },\n {\n label: "Other",\n units: "GB",\n value: toFloat(otherStore) / GB\n }\n ] as observations\n UNWIND observations as observation\n RETURN \n observation.label as label, \n observation.units as units,\n observation.value as value;\n ',columns:[{Header:"Label",accessor:"value"}],rate:1e3,exampleResult:[{label:"Other",value:1.14}]}),Ae=new pe({description:"Fetches transaction statistics of how much work the database is processing",query:"\n WITH 'generic' AS variant\n CALL dbms.queryJmx(\"org.neo4j:instance=kernel#0,name=Transactions\") \n YIELD attributes WITH attributes as a \n RETURN \n a.NumberOfRolledBackTransactions.value as rolledBack, \n a.NumberOfOpenTransactions.value as open, \n a.LastCommittedTxId.value as lastCommittedId, \n a.NumberOfOpenedTransactions.value as opened, \n a.PeakNumberOfConcurrentTransactions.value as concurrent, \n a.NumberOfCommittedTransactions.value as committed",columns:[{Header:"Rolled Back",accessor:"rolledBack"},{Header:"Open",accessor:"open"}],legendOnlyColumns:[{Header:"Peak Concurrent",accessor:"concurrent"},{Header:"Opened",accessor:"opened"},{Header:"Committed",accessor:"committed"},{Header:"Last Committed",accessor:"lastCommittedId"}],rate:2e3,exampleResult:[{rolledBack:283,open:1,lastCommittedId:7,opened:42929,concurrent:8,committed:42645}]}),je=new pe({description:"Fetches last committed transaction ID",query:'\n WITH \'generic\' AS variant\n CALL dbms.queryJmx("org.neo4j:instance=kernel#0,name=Transactions") \n YIELD attributes \n RETURN attributes["LastCommittedTxId"].value as value',columns:[{Header:"Last Committed TX ID",accessor:"value"}],exampleResult:[{value:se.int(77942)}]}),De=new pe({description:"Fetches total size of the database as stored on disk",query:'\n WITH 4.0 as variant\n CALL dbms.queryJmx("neo4j.metrics:name=neo4j." + $db + ".store.size.total") \n YIELD attributes \n RETURN attributes.Value.value AS sizeInBytes\n ',parameters:{db:"Database name"},columns:[{Header:"Size in Bytes",accessor:"sizeInBytes"}],rate:1e3,exampleResult:[{sizeInBytes:1024}]}),Ne=new pe({description:"Runs a trivial query, used to measure round-trip latency",query:"RETURN true AS value",columns:[{Header:"Value",accessor:"value"}],rate:1e3,exampleResult:[{value:!0}]}),Me=new pe({description:"Determines the cluster member's role, if in a clustered configuration",dependency:function(e){return{pass:e.isCluster(),description:"Requires clustered configuration"}},query:"CALL dbms.cluster.role() YIELD role RETURN role",columns:[{Header:"Role",accessor:"role"}],exampleResult:[{role:"FOLLOWER"}],rate:5e3}),Ie=new pe({description:"Provides an overview of cluster topology",dependency:function(e){return{pass:e.isCluster(),description:"Requires clustered configuration"}},bare:!0,query:"\n CALL dbms.cluster.overview()\n ",columns:[{Header:"Role",accessor:"role"}],exampleResult:[{id:"414afeff-ddb5-4d34-b6b9-ae400e57a7f3",addresses:["bolt://node1.cluster.graph.center:7687","http://node1.cluster.graph.center:7474","https://node1.cluster.graph.center:7473"],role:"FOLLOWER",groups:[],database:"default"},{id:"d93a0d8d-d9f6-4c86-9bbf-8f05b20abd24",addresses:["bolt://node2.cluster.graph.center:7687","http://node2.cluster.graph.center:7474","https://node2.cluster.graph.center:7473"],role:"FOLLOWER",groups:[],database:"default"},{id:"ef1ba51b-f929-46f4-a910-9e7525bddb09",addresses:["bolt://node3.cluster.graph.center:7687","http://node3.cluster.graph.center:7474","https://node3.cluster.graph.center:7473"],role:"LEADER",groups:[],database:"default"}],rate:5e3}),_e=new pe({description:"Fetches a list of graph schema constraints",dependency:null,query:"\n WITH 'generic' AS variant\n CALL db.constraints()\n YIELD description\n RETURN description\n ",columns:[{Header:"Description",accessor:"description"}],exampleResult:[{description:"CONSTRAINT ON ( person:Person ) ASSERT exists(person.name)"},{description:"CONSTRAINT ON ( person:Person ) ASSERT person.id IS UNIQUE"}]}),xe=new pe({description:"Fetches a list of APOC metrics, if supported",dependency:function(e){return{pass:e.supportsMetrics(),description:"Requires CSV Metrics Support (present in recent APOC releases)"}},query:"\n WITH 'generic' AS variant\n CALL apoc.metrics.list() YIELD name, lastUpdated\n RETURN name, lastUpdated\n ORDER BY lastUpdated ASC;\n ",columns:[{Header:"Name",accessor:"name"},{Header:"Last Updated",accessor:"lastUpdated"}],exampleResult:[{name:"neo4j.bolt.sessions_started",lastUpdated:se.int(155171807e4)},{name:"vm.memory.pool.metaspace",lastUpdated:se.int(155171807e4)}]}),Le=new pe({description:"Fetches an APOC metric by name, if supported",dependency:function(e){return{pass:e.supportsMetrics(),description:"Requires CSV Metrics Support (present in recent APOC releases)"}},query:"\n WITH 'generic' AS variant\n CALL apoc.metrics.get($metric)\n YIELD timestamp, metric, map\n RETURN timestamp, metric, map\n ORDER BY timestamp DESC LIMIT $last\n ",columns:["timestamp","metric","map"].map(fe),parameters:{last:"Count of most recent items to fetch from the file",metric:"Name of the metric to fetch"},exampleResult:[{timestamp:1111,map:{count:"406022"},metric:"neo4j.bolt.accumulated_processing_time"}]}),Pe=new pe({description:"Determines whether or not the database has CSV metrics enabled",dependency:function(e){return{pass:e.supportsMetrics(),description:"Requires CSV Metrics Support (present in recent APOC releases)"}},query:"\n WITH 'generic' AS variant\n CALL dbms.listConfig() \n YIELD name, value \n WHERE name='metrics.csv.enabled' \n return value;\n ",columns:["value"].map(fe),exampleResult:[{value:!0}]}),He=we,Fe=new pe({description:"Fetches storage metrics from APOC, if supported",dependency:function(e){return{pass:e.supportsMetrics(),description:"Requires CSV Metrics Support (present in recent APOC releases)"}},query:"\n WITH 'generic' AS variant\n CALL apoc.metrics.storage(null)\n YIELD setting, freeSpaceBytes, totalSpaceBytes, usableSpaceBytes, percentFree\n RETURN setting, freeSpaceBytes, totalSpaceBytes, usableSpaceBytes, percentFree\n ",columns:[{Header:"Location",accessor:"setting",Cell:He.mappedValueField({"dbms.directories.certificates":"SSL Certificates","dbms.directories.data":"Data Files","dbms.directories.import":"Import Data","dbms.directories.lib":"Libraries","dbms.directories.logs":"Log Files","dbms.directories.metrics":"Metrics","dbms.directories.plugins":"Plugins","dbms.directories.run":"Binaries","dbms.directories.tx_log":"Transaction Logs","unsupported.dbms.directories.neo4j_home":"Neo4j Home"},(function(e){return e.value}))},{Header:"Free",accessor:"freeSpaceBytes",Cell:He.dataSizeField},{Header:"Total",accessor:"totalSpaceBytes",Cell:He.dataSizeField},{Header:"Usable",accessor:"usableSpaceBytes",Cell:He.dataSizeField},{Header:"% Free",accessor:"percentFree",Cell:He.pctField}],exampleResult:[{setting:"dbms.directories.certificates",freeSpaceBytes:se.int(167096918016),totalSpaceBytes:se.int(499963170816),usableSpaceBytes:se.int(162099400704),percentFree:.3342184540178784}]}),qe=we,Be=new pe({description:"Returns database query statistics from DB internal records",dependency:function(e){var t=e.getVersion();return{pass:t.major>=3&&t.minor>=5&&t.patch>=2,description:"Requires Neo4j >= 3.5.2"}},query:"\n WITH 'generic' AS variant \n CALL db.stats.retrieve(\"QUERIES\") \n YIELD data \n WITH \n data.queryExecutionPlan as qep, \n data.estimatedRows as estimatedRows,\n data.invocationSummary.invocationCount as invocationCount,\n data.invocationSummary.compileTimeInUs as compileTime,\n data.invocationSummary.executionTimeInUs as executionTime,\n data.query as query,\n data.invocations as invocations\n\n RETURN \n query,\n qep, \n invocationCount,\n compileTime.min as compileMin,\n compileTime.max as compileMax,\n compileTime.avg as compileAvg,\n executionTime.min as executeMin,\n executionTime.max as executeMax,\n executionTime.avg as executeAvg,\n estimatedRows,\n invocations\n ORDER BY query ASC\n ",columns:[{Header:"Query",accessor:"query",style:{whiteSpace:"unset",textAlign:"left"}},{Header:"Plan",accessor:"qep",show:!1},{Header:"Count",width:120,accessor:"invocationCount",Cell:qe.numField},{Header:"Compile(min)",width:120,accessor:"compileMin",show:!1,Cell:qe.numField},{Header:"Compile(max)",width:120,accessor:"compileMax",show:!1,Cell:qe.numField},{Header:"Compile(avg)",width:120,accessor:"compileAvg",Cell:qe.numField},{Header:"Execute(min)",width:120,accessor:"executeMin",show:!1,Cell:qe.numField},{Header:"Execute(max)",width:120,accessor:"executeMax",show:!1,Cell:qe.numField},{Header:"Execute(avg)",width:120,accessor:"executeAvg",Cell:qe.numField},{Header:"Estimated Rows",width:120,accessor:"estimatedRows",Cell:qe.numField},{Header:"Timings",accessor:"invocations",show:!1}],exampleResult:[{query:'call db.stats.collect("QUERIES")',qep:{operator:"ProcedureCall",id:0},invocationCount:se.int(1),compileMin:se.int(83),compileMax:se.int(181),compileAvg:se.int(132),executeMin:se.int(14458),executeMax:se.int(15544),executeAvg:se.int(15001),estimatedRows:[se.int(1),se.int(1),se.int(1e3)],invocations:[{elapsedExecutionTimeInUs:se.int(14458),elapsedCompileTimeInUs:se.int(181)}]}]}),Ue=new pe({description:"Determines whether or not the db.stats.* procedures are available to collect query statistics (generally only available in Neo4j >= 3.5.2)",dependency:function(e){var t=e.getVersion();return{pass:t.major>=3&&t.minor>=5&&t.patch>=2,description:"Requires Neo4j >= 3.5.2"}},query:"\n WITH 'generic' AS variant \n CALL dbms.procedures() \n YIELD name \n WHERE name =~ 'db.stats.clear'\n RETURN name\n ",columns:[{Header:"Name",accessor:"name"}],exampleResult:[{name:"db.stats.clear"}]}),We=new pe({description:"Clears the DB stats buffer and starts collection",dependency:function(e){var t=e.getVersion();return{pass:t.major>=3&&t.minor>=5&&t.patch>=2,description:"Requires Neo4j >= 3.5.2"}},query:"\n WITH 'generic' AS variant\n CALL db.stats.clear('QUERIES') \n YIELD section \n RETURN section \n \n UNION ALL \n \n CALL db.stats.collect('QUERIES') \n YIELD section \n RETURN section;\n ",columns:[{Header:"Section",accessor:"section"}],exampleResult:[{section:"QUERIES"},{section:"QUERIES"}]}),ze=new pe({description:"Stops collection of DBStats in the database",dependency:function(e){var t=e.getVersion();return{pass:t.major>=3&&t.minor>=5&&t.patch>=2,description:"Requires Neo4j >= 3.5.2"}},query:"\n WITH 'generic' AS variant \n CALL db.stats.stop(\"QUERIES\") \n YIELD section, success, message \n RETURN section, success, message;\n ",columns:[{Header:"Section",accessor:"section"},{Header:"Success",accessor:"success"},{Header:"Message",accessor:"message"}],exampleResult:[{section:"QUERIES",success:!0,message:"Collector is idle, no collection ongoing"}]}),Ge=new pe({description:"Determines basics about the database such as version of Neo4j and Edition (enterprise or community)",query:"\n WITH 'generic' AS variant\n CALL dbms.components()\n YIELD name, versions, edition\n RETURN name, versions, edition\n ",columns:[{Header:"Name",accessor:"name"},{Header:"Versions",accessor:"versions"},{Header:"Edition",accessor:"edition"}],exampleResult:[{name:"Neo4j Kernel",versions:["3.5.3"],edition:"enterprise"}]}),Ye=new pe({description:"Determines whether or not authorization is enabled on the database",query:"\n WITH 'generic' AS variant\n CALL dbms.listConfig() YIELD name, value\n WHERE name =~ 'dbms.security.auth_enabled'\n RETURN value;\n ",columns:[{Header:"Value",accessor:"value"}],exampleResult:[{value:"true"}]}),Ve=new pe({description:"Gets the authorization provider of the database, e.g. native or LDAP",query:"\n WITH 'generic' AS variant\n CALL dbms.listConfig() YIELD name, value \n WHERE name =~ 'dbms.security.auth_provider.*' OR /* < 4.0 */\n name =~ 'dbms.security.authentication_provider.*' /* >= 4.0 */\n RETURN value;\n ",columns:[{Header:"Value",accessor:"value"}],exampleResult:[{value:"native"}]}),Je=new pe({description:"Get Neo4j Configuration",dependency:null,query:"\n WITH 'generic' AS variant\n CALL dbms.listConfig() \n YIELD name, value \n WHERE name='dbms.memory.heap.max_size'\n RETURN name, value\n ",columns:[{Header:"Name",accessor:"name"},{Header:"Value",accessor:"value"}],exampleResult:[{name:"dbms.memory.heap.max_size",value:"1G"}]}),Qe=new pe({description:"Fetches a list of supported functions",dependency:null,query:"\n WITH 'generic' AS variant\n CALL dbms.functions()\n YIELD name, signature, description\n RETURN name, description, signature\n ",columns:[{Header:"Name",accessor:"name"},{Header:"Signature",accessor:"signature"},{Header:"Description",accessor:"description"}],exampleResult:[{name:"time.transaction",signature:"time.transaction(timezone = DEFAULT_TEMPORAL_ARGUMENT :: ANY?) :: (TIME?)",description:"Get the current Time instant using the transaction clock."}]}),Ke=new pe({description:"Fetches a list of supported procedures",dependency:null,query:"\n WITH 'generic' AS variant \n CALL dbms.procedures()\n YIELD name, signature, description, mode\n RETURN name, description, signature, mode\n ",columns:[{Header:"Name",accessor:"name"},{Header:"Signature",accessor:"signature"},{Header:"Description",accessor:"description"},{Header:"Mode",accessor:"mode"}],exampleResult:[{name:"dbms.getTXMetaData",signature:"dbms.getTXMetaData() :: (metadata :: MAP?)",description:"Provides attached transaction metadata.",mode:"DBMS"}]}),Xe=new pe({description:"Get Neo4j Configuration",dependency:null,query:"\n WITH 'generic' AS variant\n CALL dbms.listConfig() \n YIELD name, description, value \n RETURN name, description, value\n ",columns:[{Header:"Name",accessor:"name"},{Header:"Value",accessor:"value"},{Header:"Description",accessor:"description",style:{whiteSpace:"unset"}}],exampleResult:[{name:"bolt.ssl_policy",description:"Specify the SSL policy to use for the encrypted bolt connections.",value:"legacy"},{name:"browser.credential_timeout",description:"Configure the Neo4j Browser to time out logged in users after this idle period. Setting this to 0 indicates no limit.",value:"0ms"}]}),$e=new pe({description:"Lists database indexes",query:"\n WITH 'generic' AS variant \n CALL db.indexes() \n YIELD id, name, state, populationPercent, uniqueness, type, \n entityType, labelsOrTypes, properties, provider\n RETURN id, name, state, populationPercent, uniqueness, type,\n entityType, labelsOrTypes, properties, provider\n ORDER BY name asc;\n ",columns:[{Header:"ID",accessor:"id"},{Header:"Name",accessor:"name"},{Header:"State",accessor:"state"},{Header:"Population",accessor:"populationPercent"},{Header:"Uniqueness",accessor:"uniqueness"},{Header:"Type",accessor:"type"},{Header:"Entity",accessor:"entityType"},{Header:"Labels/Types",accessor:"labelsOrTypes"},{Header:"Properties",accessor:"properties"},{Header:"Provider",accessor:"provider"}],exampleResult:[{id:1,name:"index_70bffdb",state:"ONLINE",populationPercent:100,uniqueness:"NONUNIQUE",type:"BTREE",entityType:"NODE",labelsOrTypes:["Label"],properties:["name"],provider:"native-btree-1.0"}]}),Ze=new pe({description:"Gets roles for a certain user",dependency:null,bare:!0,query:"\n CALL dbms.security.listRolesForUser($username) \n YIELD value \n RETURN value;\n ",parameters:{username:"The username whose roles you want"},columns:[{Header:"Value",accessor:"value"}],exampleResult:[{value:"admin"}]}),et=we,tt=new pe({description:"Fetches a list of running transactions on the database at this moment",query:"\n WITH 'generic' AS variant \n CALL dbms.listTransactions()\n YIELD transactionId, username, metaData, startTime, protocol,\n clientAddress, requestUri, currentQueryId, currentQuery, \n activeLockCount, status, resourceInformation, elapsedTimeMillis,\n cpuTimeMillis, waitTimeMillis, idleTimeMillis, connectionId\n RETURN transactionId, username, metaData, startTime, protocol,\n clientAddress, requestUri, currentQueryId, currentQuery, \n activeLockCount, status, resourceInformation, elapsedTimeMillis,\n cpuTimeMillis, waitTimeMillis, idleTimeMillis, connectionId\n ",columns:[{Header:"ID",accessor:"transactionId"},{Header:"CID",accessor:"connectionId"},{Header:"User",accessor:"username"},{Header:"Metadata",accessor:"metaData",show:!1,Cell:et.jsonField},{Header:"Start Time",accessor:"startTime",show:!1},{Header:"Protocol",accessor:"protocol",show:!1},{Header:"Client Addr",accessor:"clientAddress",show:!1},{Header:"Request URI",accessor:"requestUri",show:!1},{Header:"QueryId",accessor:"currentQueryId",show:!1},{Header:"Query",accessor:"currentQuery",style:{whiteSpace:"unset",textAlign:"left"}},{Header:"Locks",accessor:"activeLockCount",Cell:et.numField},{Header:"Status",accessor:"status"},{Header:"Resource Info",accessor:"resourceInformation",show:!1,Cell:et.jsonField},{Header:"Idle",accessor:"idleTimeMillis",Cell:et.timeField,show:!1},{Header:"Wait",accessor:"waitTimeMillis",Cell:et.timeField},{Header:"CPU",accessor:"cpuTimeMillis",Cell:et.timeField,show:!1},{Header:"Elapsed",accessor:"elapsedTimeMillis",Cell:et.timeField}],exampleResult:[{transactionId:"transaction-136",username:"neo4j",metaData:{type:"user-direct",app:"neo4j-browser_v3.2.17"},startTime:"2019-03-04T12:35:40.692Z",protocol:"bolt",clientAddress:"127.0.0.1:55535",requestUri:"127.0.0.1:7687",currentQueryId:"query-131",currentQuery:"call dbms.listTransactions()",activeLockCount:se.int(0),status:"running",resourceInformation:{},elapsedTimeMillis:se.int(17),cpuTimeMillis:se.int(0),waitTimeMillis:se.int(0),idleTimeMillis:se.int(17),connectionId:"bolt-12"}]}),nt=new pe({description:"Lists active connections to the database",query:"\n WITH 'generic' AS variant \n CALL dbms.listConnections()\n YIELD connectionId, connectTime, connector, username, userAgent,\n serverAddress, clientAddress\n RETURN connectionId, connectTime, connector, username, userAgent,\n serverAddress, clientAddress\n ORDER BY userAgent, connectTime ASC\n ",columns:["connectionId","connectTime","connector","username","userAgent","serverAddress","clientAddress"].map(fe),exampleResult:[{connectionId:"bolt-180",connectTime:"2019-03-04T19:41:00.77Z",connector:"bolt",username:"neo4j",userAgent:"neo4j-javascript/1.7.2",serverAddress:"127.0.0.1:7687",clientAddress:"127.0.0.1:55321"}]}),at=new pe({description:"Fetches a list of active locks for a given query",query:"\n WITH 'generic' AS variant\n CALL dbms.listActiveLocks($queryId) \n YIELD mode, queryId, resourceType, resourceId\n RETURN mode, queryId, resourceType, resourceId\n ",parameters:{queryId:"the Query ID to check"},columns:["mode","resourceType","resourceId"].map(fe),exampleResult:[{mode:"SHARED",queryId:"query-67811",resourceId:se.int(0),resourceType:"LABEL"}]}),rt=new pe({description:"Lists active tasks the database",dependency:function(e){var t=e.getVersion();return{pass:t.major>=3&&t.minor>=5,description:"Requires Neo4j >= 3.4"}},query:"\n WITH 3.5 as variant\n CALL dbms.listTransactions()\n \n YIELD transactionId, username, metaData, startTime, protocol,\n clientAddress, requestUri, currentQueryId, currentQuery, \n activeLockCount, status, resourceInformation, elapsedTimeMillis,\n cpuTimeMillis, waitTimeMillis, idleTimeMillis, connectionId\n \n WITH collect({\n id: transactionId,\n metaData: metaData,\n startTime: startTime,\n protocol: protocol,\n clientAddress: clientAddress,\n requestUri: requestUri,\n currentQueryId: currentQueryId,\n currentQuery: currentQuery,\n activeLockCount: activeLockCount,\n status: status,\n resourceInformation: resourceInformation,\n elapsedTimeMillis: elapsedTimeMillis,\n cpuTimeMillis: cpuTimeMillis,\n waitTimeMillis: waitTimeMillis,\n idleTimeMillis: idleTimeMillis,\n connectionId: connectionId\n }) as transactions\n \n /* Grab queries */\n CALL dbms.listQueries()\n YIELD queryId, username, metaData, query, parameters, planner, runtime, indexes,\n startTime, protocol, clientAddress, requestUri, status, resourceInformation, \n activeLockCount, elapsedTimeMillis, cpuTimeMillis, waitTimeMillis, idleTimeMillis,\n allocatedBytes, pageHits, pageFaults, connectionId\n \n WITH transactions, collect({\n id: queryId,\n query: query,\n parameters: parameters,\n planner: planner,\n runtime: runtime,\n indexes: indexes,\n startTime: startTime,\n protocol: protocol,\n clientAddress: clientAddress,\n requestUri: requestUri,\n status: status,\n resourceInformation: resourceInformation,\n activeLockCount: activeLockCount,\n elapsedTimeMillis: elapsedTimeMillis,\n cpuTimeMillis: cpuTimeMillis,\n waitTimeMillis: waitTimeMillis,\n idleTimeMillis: idleTimeMillis,\n allocatedBytes: allocatedBytes,\n pageHits: pageHits,\n pageFaults: pageFaults,\n connectionId: connectionId\n }) as queries\n \n /* Fetch connections */\n CALL dbms.listConnections()\n YIELD connectionId, connectTime, connector, username, userAgent,\n serverAddress, clientAddress\n \n /* Rename fields */\n WITH transactions, queries, collect({\n connectionId: connectionId,\n connectTime: connectTime,\n connector: connector,\n username: username,\n userAgent: userAgent,\n serverAddress: serverAddress,\n clientAddress: clientAddress\n }) as connections\n\n UNWIND transactions AS transaction\n RETURN \n transaction,\n [q IN queries WHERE q.id = transaction.currentQueryId][0] as query,\n [c IN connections WHERE c.connectionId = transaction.connectionId][0] as connection\n\n ORDER BY transaction.elapsedTimeMillis DESC\n LIMIT 500\n ",columns:[{Header:"ID",accessor:"id"},{Header:"Connection",accessor:"connection",Cell:function(e){return"".concat(e.value)}},{Header:"Transaction",accessor:"transaction",Cell:function(e){return"".concat(e.value)}},{Header:"Query",accessor:"query",Cell:function(e){return"".concat(e.value)}}],exampleResult:[{id:"bolt-17:transaction-33:query-33",connection:{connector:"bolt",connectTime:"2019-03-05T20:43:22.428Z",serverAddress:"127.0.0.1:7687",userAgent:"neo4j-javascript/1.7.2",id:"bolt-17",clientAddress:"127.0.0.1:64239",username:"neo4j"},transaction:{activeLockCount:0,currentQueryId:"query-33",currentQuery:"RETURN 1;",requestUri:"127.0.0.1:7687",clientAddress:"127.0.0.1:64239",elapsedTimeMillis:0,metaData:{type:"user-direct",app:"neo4j-browser_v3.2.17"},protocol:"bolt",cpuTimeMillis:0,waitTimeMillis:0,idleTimeMillis:0,resourceInformation:{},connectionId:"bolt-17",startTime:"2019-03-05T20:43:30.246Z",id:"transaction-33",status:"Running"},query:{activeLockCount:0,query:"RETURN 1",runtime:"slotted",requestUri:"127.0.0.1:7687",clientAddress:"127.0.0.1:64239",elapsedTimeMillis:1,protocol:"bolt",cpuTimeMillis:null,waitTimeMillis:0,indexes:[],idleTimeMillis:null,resourceInformation:{},allocatedBytes:null,connectionId:"bolt-17",startTime:"2019-03-05T20:43:30.246Z",pageHits:0,id:"query-33",planner:"idp",parameters:{},pageFaults:0,status:"running"}}]}),st=new pe({description:"Lists active tasks the database",dependency:function(e){var t=e.getVersion();return{pass:t.major>=3&&t.minor>=4,description:"Requires Neo4j >= 3.4"}},query:"\n WITH 3.4 AS variant\n CALL dbms.listTransactions()\n \n YIELD transactionId, username, metaData, startTime, protocol,\n clientAddress, requestUri, currentQueryId, currentQuery, \n activeLockCount, status, resourceInformation, elapsedTimeMillis,\n cpuTimeMillis, waitTimeMillis, idleTimeMillis\n \n /* Rename fields so we can tell when a duplicated field comes from TX data */\n WITH collect({\n id: transactionId,\n metaData: metaData,\n startTime: startTime,\n protocol: protocol,\n clientAddress: clientAddress,\n requestUri: requestUri,\n currentQueryId: currentQueryId,\n currentQuery: currentQuery,\n activeLockCount: activeLockCount,\n status: status,\n resourceInformation: resourceInformation,\n elapsedTimeMillis: elapsedTimeMillis,\n cpuTimeMillis: cpuTimeMillis,\n waitTimeMillis: waitTimeMillis,\n idleTimeMillis: idleTimeMillis\n }) as transactions\n \n /* Grab queries -- omit parameters because of https://github.com/moxious/halin/issues/97 */\n CALL dbms.listQueries()\n YIELD queryId, username, metaData, query, /* parameters, */ planner, runtime, indexes,\n startTime, protocol, clientAddress, requestUri, status, resourceInformation, \n activeLockCount, elapsedTimeMillis, cpuTimeMillis, waitTimeMillis, idleTimeMillis,\n allocatedBytes, pageHits, pageFaults\n \n /* Rename fields so we can tell when a duplicated field comes from Query data */\n WITH transactions, collect({\n id: queryId,\n query: query,\n /* parameters: parameters, */\n planner: planner,\n runtime: runtime,\n indexes: indexes,\n startTime: startTime,\n protocol: protocol,\n clientAddress: clientAddress,\n requestUri: requestUri,\n status: status,\n resourceInformation: resourceInformation,\n activeLockCount: activeLockCount,\n elapsedTimeMillis: elapsedTimeMillis,\n cpuTimeMillis: cpuTimeMillis,\n waitTimeMillis: waitTimeMillis,\n idleTimeMillis: idleTimeMillis,\n allocatedBytes: allocatedBytes,\n pageHits: pageHits,\n pageFaults: pageFaults\n }) as queries\n \n UNWIND transactions as transaction\n\n RETURN \n transaction.id, \n transaction,\n [q in queries WHERE q.id = transaction.currentQueryId][0] as query\n\n ORDER BY transaction.elapsedTimeMillis DESC\n LIMIT 500 \n ",columns:["id","transaction","query"].map(fe),exampleResult:[{id:"bolt-17:transaction-33:query-33",transaction:{activeLockCount:0,currentQueryId:"query-33",currentQuery:"RETURN 1;",requestUri:"127.0.0.1:7687",clientAddress:"127.0.0.1:64239",elapsedTimeMillis:0,metaData:{type:"user-direct",app:"neo4j-browser_v3.2.17"},protocol:"bolt",cpuTimeMillis:0,waitTimeMillis:0,idleTimeMillis:0,resourceInformation:{},startTime:"2019-03-05T20:43:30.246Z",id:"transaction-33",status:"Running"},query:{activeLockCount:0,query:"RETURN 1",runtime:"slotted",requestUri:"127.0.0.1:7687",clientAddress:"127.0.0.1:64239",elapsedTimeMillis:1,protocol:"bolt",cpuTimeMillis:null,waitTimeMillis:0,indexes:[],idleTimeMillis:null,resourceInformation:{},allocatedBytes:null,startTime:"2019-03-05T20:43:30.246Z",pageHits:0,id:"query-33",planner:"idp",pageFaults:0,status:"running"}}]}),it=new pe({description:"Gets a list of the databases supported by the system",query:"SHOW DATABASES",bare:!0,columns:[{Header:"Name",accessor:"name"},{Header:"Address",accessor:"address"},{Header:"Role",accessor:"role"},{Header:"Requested Status",accessor:"requestedStatus"},{Header:"Current Status",accessor:"currentStatus"},{Header:"Error",accessor:"error"},{Header:"Default?",accessor:"default"}],exampleResult:[{name:"neo4j",address:"0.0.0.0:7687",role:"standalone",requestedStatus:"online",currentStatus:"online",error:"",default:!0},{name:"system",address:"0.0.0.0:7687",role:"standalone",requestedStatus:"online",currentStatus:"online",error:"",default:!0}]}),ot=new pe({description:"Starts a database",query:"START DATABASE $name",bare:!0,void:!0,parameters:{name:"Name of the database"},columns:[],exampleResult:[]}),lt=new pe({description:"Stops a database",query:"STOP DATABASE $name",bare:!0,void:!0,parameters:{name:"Name of the database"},columns:[],exampleResult:[]}),ct=new pe({description:"Creates a database",query:"CREATE DATABASE $name",bare:!0,void:!0,parameters:{name:"Name of the database"},columns:[],exampleResult:[]}),ut=new pe({description:"Drops a database",query:"DROP DATABASE $name",bare:!0,void:!0,parameters:{name:"Name of the database"},columns:[],exampleResult:[]}),dt=new pe({description:"Gets a list of privileges",query:"SHOW PRIVILEGES",bare:!0,columns:[{Header:"Access",accessor:"access"},{Header:"Action",accessor:"action"},{Header:"Resource",accessor:"resource"},{Header:"Graph",accessor:"graph"},{Header:"Segment",accessor:"segment"},{Header:"Role",accessor:"role"}],exampleResult:[{access:"GRANTED",action:"read",resource:"all_properties",graph:"*",segment:"NODE(*)",role:"admin"}]}),mt=we,ht=new pe({description:"Fetches page cache statistics for running Neo4j",query:"\n WITH 4.0 AS variant\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.page_cache.usage_ratio')\n YIELD attributes\n WITH attributes.Value.value as usageRatio\n\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.page_cache.hit_ratio')\n YIELD attributes\n WITH attributes.Value.value as hitRatio, usageRatio\n\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.page_cache.page_faults')\n YIELD attributes\n WITH attributes.Count.value as faults, hitRatio, usageRatio\n\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.page_cache.flushes')\n YIELD attributes\n WITH attributes.Count.value as flushes,\n faults, hitRatio, usageRatio\n\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.page_cache.evictions')\n YIELD attributes\n WITH attributes.Count.value as evictions,\n flushes, faults, hitRatio, usageRatio\n\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.page_cache.eviction_exceptions')\n YIELD attributes\n WITH attributes.Count.value as evictionExceptions,\n evictions, flushes, faults, hitRatio, usageRatio\n\n RETURN \n hitRatio, \n 0 as bytesRead, /* Not yet supported */\n 0 as fileMappings, /* Not yet supported */\n 0 as fileUnmappings, /* Not yet supported */\n flushes, \n usageRatio, \n 0 as bytesWritten, /* Not yet supported */\n faults, \n evictions, \n evictionExceptions",columns:[{Header:"Usage Ratio",accessor:"usageRatio",Cell:mt.pctField},{Header:"Hit Ratio",accessor:"hitRatio",Cell:mt.pctField},{Header:"Read",accessor:"bytesRead",Cell:mt.dataSizeField},{Header:"Written",accessor:"bytesWritten",Cell:mt.dataSizeField},{Header:"Faults",accessor:"faults",Cell:mt.numField},{Header:"Flushes",accessor:"flushes",Cell:mt.numField,show:!1},{Header:"Evictions",accessor:"evictions",Cell:mt.numField,show:!1},{Header:"Eviction Except.",accessor:"evictionExceptions",Cell:mt.numField,show:!1},{Header:"File Mappings",accessor:"fileMappings",Cell:mt.numField,show:!1},{Header:"File Unmappings",accessor:"fileUnmappings",Cell:mt.numField,show:!1}],rate:2e3,exampleResult:[{hitRatio:.9945,bytesRead:237650,bytesWritten:237650,fileMappings:40,fileUnmappings:22,flushes:16,usageRatio:1313e-7,bytesWRitten:163790,faults:35,evictions:0,evictionExceptions:0}]}),pt=new pe({description:"Fetches transaction statistics of how much work the database is processing",query:"\n WITH 4.0 AS variant\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.' + $db + '.transaction.active')\n YIELD attributes WITH attributes.Value.value as open\n\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.' + $db + '.transaction.active_read')\n YIELD attributes WITH attributes.Value.value as active_read,\n open\n\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.' + $db + '.transaction.active_write')\n YIELD attributes WITH attributes.Value.value as active_write,\n active_read, open\n\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.' + $db + '.transaction.committed')\n YIELD attributes WITH attributes.Count.value as committed,\n active_write, active_read, open\n\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.' + $db + '.transaction.active')\n YIELD attributes WITH attributes.Value.value as active,\n committed, active_write, active_read, open\n\n CALL dbms.queryJmx(\"neo4j.metrics:name=neo4j.\" + $db + \".transaction.peak_concurrent\")\n YIELD attributes WITH attributes.Count.value as concurrent,\n active, committed, active_write, active_read, open\n\n CALL dbms.queryJmx(\"neo4j.metrics:name=neo4j.\" + $db + \".transaction.rollbacks\")\n YIELD attributes WITH attributes.Count.value as rolledBack,\n concurrent, active, committed, active_write, active_read, open\n\n CALL dbms.queryJmx(\"neo4j.metrics:name=neo4j.\" + $db + \".transaction.started\")\n YIELD attributes WITH attributes.Count.value as opened,\n rolledBack, concurrent, active, committed, active_write, active_read, open\n \n RETURN \n rolledBack,\n open,\n -1 as lastCommittedId, /* 4.0 TODO Not yet supported by neo4j.metrics:name=neo4j.system.transaction.last_committed_tx_id */\n opened,\n concurrent,\n committed,\n active_write,\n active_read,\n active\n ",parameters:{db:"Name of the database"},columns:[{Header:"Rolled Back",accessor:"rolledBack"},{Header:"Open",accessor:"open"}],legendOnlyColumns:[{Header:"Peak Concurrent",accessor:"concurrent"},{Header:"Opened",accessor:"opened"},{Header:"Committed",accessor:"committed"},{Header:"Last Committed",accessor:"lastCommittedId"}],rate:2e3,exampleResult:[{rolledBack:283,open:1,lastCommittedId:7,opened:42929,concurrent:8,committed:42645}]}),ft=we,gt=new pe({description:"Fetches page cache statistics for running Neo4j",query:"\n WITH 4.2 AS variant\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.page_cache.usage_ratio')\n YIELD attributes\n WITH attributes.Value.value as usageRatio\n\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.page_cache.hit_ratio')\n YIELD attributes\n WITH attributes.Value.value as hitRatio, usageRatio\n\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.page_cache.page_faults')\n YIELD attributes\n WITH attributes.Count.value as faults, hitRatio, usageRatio\n\n /* As of Neo4j 4.2, metrics for:\n * neo4j.metrics:name=neo4j.page_cache.flushes\n * neo4j.metrics:name=neo4j.page_cache.evictions\n * neo4j.page_cache.eviction_exceptions\n * Appear to have been removed\n * #operability\n */\n\n RETURN \n hitRatio, \n 0 as bytesRead, /* Not yet supported */\n 0 as fileMappings, /* Not yet supported */\n 0 as fileUnmappings, /* Not yet supported */\n usageRatio, \n 0 as bytesWritten, /* Not yet supported */\n faults,\n -1 as flushes, /* No longer supported in 4.2 */\n -1 as evictions, /* No longer supported in 4.2 */\n -1 as evictionExceptions /* No longer supported in 4.2 */\n ",columns:[{Header:"Usage Ratio",accessor:"usageRatio",Cell:ft.pctField},{Header:"Hit Ratio",accessor:"hitRatio",Cell:ft.pctField},{Header:"Read",accessor:"bytesRead",Cell:ft.dataSizeField},{Header:"Written",accessor:"bytesWritten",Cell:ft.dataSizeField},{Header:"Faults",accessor:"faults",Cell:ft.numField},{Header:"Flushes",accessor:"flushes",Cell:ft.numField,show:!1},{Header:"Evictions",accessor:"evictions",Cell:ft.numField,show:!1},{Header:"Eviction Except.",accessor:"evictionExceptions",Cell:ft.numField,show:!1},{Header:"File Mappings",accessor:"fileMappings",Cell:ft.numField,show:!1},{Header:"File Unmappings",accessor:"fileUnmappings",Cell:ft.numField,show:!1}],rate:2e3,exampleResult:[{hitRatio:.9945,bytesRead:237650,bytesWritten:237650,fileMappings:40,fileUnmappings:22,flushes:16,usageRatio:1313e-7,bytesWRitten:163790,faults:35,evictions:0,evictionExceptions:0}]}),vt=new pe({description:"Fetches transaction statistics of how much work the database is processing",query:"\n WITH 4.2 AS variant\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.' + $db + '.transaction.active_read')\n YIELD attributes WITH attributes.Value.value as active_read\n\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.' + $db + '.transaction.active_write')\n YIELD attributes WITH attributes.Value.value as active_write,\n active_read\n\n CALL dbms.queryJmx('neo4j.metrics:name=neo4j.' + $db + '.transaction.committed')\n YIELD attributes WITH attributes.Count.value as committed,\n active_write, active_read\n\n CALL dbms.queryJmx(\"neo4j.metrics:name=neo4j.\" + $db + \".transaction.peak_concurrent\")\n YIELD attributes WITH attributes.Count.value as concurrent,\n committed, active_write, active_read\n\n CALL dbms.queryJmx(\"neo4j.metrics:name=neo4j.\" + $db + \".transaction.rollbacks\")\n YIELD attributes WITH attributes.Count.value as rolledBack,\n concurrent, committed, active_write, active_read\n \n RETURN \n rolledBack,\n /* NOTE: 4.2 changed the definitions of JMX metrics and open is not available anymore; this is the closets available\n * proxy */\n active_read + active_write AS open,\n -1 as lastCommittedId, /* 4.0 TODO Not yet supported by neo4j.metrics:name=neo4j.system.transaction.last_committed_tx_id */\n -1 as opened, /* 4.2 removed support for this metric */\n concurrent,\n committed,\n active_write,\n active_read,\n active_read + active_write AS active\n ",parameters:{db:"Name of the database"},columns:[{Header:"Rolled Back",accessor:"rolledBack"},{Header:"Open",accessor:"open"}],legendOnlyColumns:[{Header:"Peak Concurrent",accessor:"concurrent"},{Header:"Opened",accessor:"opened"},{Header:"Committed",accessor:"committed"},{Header:"Last Committed",accessor:"lastCommittedId"}],rate:2e3,exampleResult:[{rolledBack:283,open:1,lastCommittedId:7,opened:42929,concurrent:8,committed:42645}]}),bt=new pe({description:"Determines whether apoc.log.stream is present, and if the database can send log files back",dependency:function(e){return{pass:e.supportsLogStreaming(),description:"Requires log streaming support (present in recent APOC releases)"}},query:'\n CALL dbms.procedures() \n YIELD name \n WHERE name="apoc.log.stream" \n RETURN count(name) as n\n ',columns:[{Header:"N",accessor:"n"}],exampleResult:[{n:se.int(1)}]}),yt=new pe({description:"Determines which version of APOC the database has (if any)",dependency:function(e){return{pass:e.supportsAPOC(),description:"Requires APOC (any version)"}},query:"RETURN apoc.version() AS version",columns:[{Header:"Version",accessor:"version"}],exampleResult:[{version:"3.5.0.2"}]}),Et=["labelCount","relTypeCount","propertyKeyCount","nodeCount","relCount","labels","relTypes","relTypesCount","stats"],Ct=new pe({description:"Uses APOC to access the count store",dependency:function(e){return{pass:e.supportsAPOC(),description:"Requires APOC (any version)"}},query:"\n CALL apoc.meta.stats()\n YIELD ".concat(Et.join(", "),"\n RETURN ").concat(Et.join(", "),"\n "),columns:Et.map((function(e){return{Header:e,accessor:e}})),exampleResult:[{labelCount:12,relTypeCount:11,propertyKeyCount:44,nodeCount:400,relCount:1e4,labels:{Foo:25,Bar:12},relTypes:{"()-[:HELD]->(:Event)":385354},relTypesCount:{GROUP:3052100},stats:{relTypeCount:11}}]}),St={PING:Ne,CLUSTER_ROLE:Me,CLUSTER_OVERVIEW:Ie,GET_CONSTRAINTS:_e,JMX_ALL:ge,JMX_STORE_SIZES:Oe,JMX_DISK_UTILIZATION:Re,JMX_PAGE_CACHE:ke,JMX_4_TOTAL_STORE_SIZE:De,DBMS_4_PAGE_CACHE:ht,JMX_MEMORY_STATS:be,JMX_GARBAGE_COLLECTOR:ve,JMX_TRANSACTIONS:Ae,DBMS_4_TRANSACTIONS:pt,JMX_LAST_TRANSACTION_ID:je,OS_OPEN_FDS:Ce,OS_LOAD_STATS:ye,OS_MEMORY_STATS:Ee,LIST_METRICS:xe,METRICS_CSV_ENABLED:Pe,GET_METRIC:Le,APOC_STORAGE_METRIC:Fe,DB_QUERY_STATS:Be,DB_QUERY_HAS_STATS:Ue,DB_QUERY_STATS_COLLECT:We,DB_QUERY_STATS_STOP:ze,DBMS_COMPONENTS:Ge,DBMS_AUTH_ENABLED:Ye,DBMS_GET_AUTH_PROVIDER:Ve,DBMS_GET_MAX_HEAP:Je,DBMS_FUNCTIONS:Qe,DBMS_PROCEDURES:Ke,DBMS_LIST_CONFIG:Xe,DBMS_LIST_INDEXES:$e,DBMS_SECURITY_USER_ROLES:Ze,DBMS_LIST_TRANSACTIONS:tt,DBMS_LIST_CONNECTIONS:nt,DBMS_LIST_ACTIVE_LOCKS:at,DBMS_34_TASKS:st,DBMS_35_TASKS:rt,DBMS_4_SHOW_DATABASES:it,DBMS_4_START_DATABASE:ot,DBMS_4_STOP_DATABASE:lt,DBMS_4_CREATE_DATABASE:ct,DBMS_4_DROP_DATABASE:ut,DBMS_4_SHOW_PRIVILEGES:dt,DBMS_4_2_PAGE_CACHE:gt,APOC_LOG_STREAM:bt,APOC_VERSION:yt,APOC_COUNT_STORE:Ct},wt=d.a.merge({find:function(e,t){if(St[t])return St[t];var n=e.getVersion(),a=Number(n.major)>=4,r=4===Number(n.major)&&2===Number(n.minor);if("pageCache"===t)return r?gt:a?ht:ke;if("transactions"===t)return r?vt:a?pt:Ae;throw new Error("Cannot find query "+t+" in the query library")}},St),Tt=n(438),kt=n(208),Ot=n.n(kt),Rt=n(64),At=n.n(Rt),jt=function(e){return e.run(wt.DBMS_COMPONENTS).then((function(e){var t=e.records[0];return{name:t.get("name"),versions:t.get("versions"),edition:t.get("edition")}})).catch((function(e){return I.reportError(e,"Failed to get DBMS components; this can be because user is not admin"),{name:"UNKNOWN",versions:[],edition:"UNKNOWN"}}))},Dt=function(e){return e.run(wt.APOC_LOG_STREAM,{}).then((function(e){return e.records[0].get("n").toNumber()>0})).catch((function(e){return I.reportError("Failed to probe for file streaming procedures",e),!1}))},Nt=function(e){return e.run(wt.DBMS_4_SHOW_DATABASES,{},se.SYSTEM_DB).then((function(e){return!0})).catch((function(e){return"".concat(e).indexOf("Invalid input")||I.warn("Feature probe for multi-database returned unexpected error",!1),!1}))},Mt=function(e){return e.run(wt.DB_QUERY_HAS_STATS).then((function(e){return e.records.length>0})).catch((function(e){return I.reportError("DBStats probe failed",e),!1}))},It=function(e){return e.run(wt.APOC_VERSION).then((function(){return!0})).catch((function(e){return-1==="".concat(e).indexOf("Unknown function")&&I.reportError("APOC probe failed",e),!1}))},_t=function(e){return e.run(wt.METRICS_CSV_ENABLED).then((function(e){var t=e.records[0];if(t&&"true"===t.get("value"))return!0;I.fine("CSV metrics not enabled",t)})).catch((function(e){return A.permissionDenied(e)||I.fine("Error on CSV metrics enabled probe",e),!1}))},xt=function(e){return e.run(wt.DBMS_AUTH_ENABLED).then((function(e){var t=!0;return e.records.forEach((function(e){var n=e.get("value");t="".concat(n)})),t})).catch((function(e){return!A.permissionDenied(e)&&(I.reportError(e,"Failed to check auth enabled status"),!0)}))},Lt=function(e){return e.run(wt.DBMS_GET_AUTH_PROVIDER).then((function(e){var t=!1,n=!1;return e.records.forEach((function(e){var a=e.get("value"),r="".concat(a);r.indexOf("native")>-1?(t=!0,n=!1):r.indexOf("system-graph")>-1&&(t=!0,n=!0)})),{nativeAuth:t,systemGraph:n}})).catch((function(e){return A.permissionDenied(e)||I.reportError(e,"Failed to get DBMS auth implementation type"),!1}))},Pt=function(e){return e.getConfiguration().then((function(e){var t=d.a.get(e,"fabric.database.name"),n=d.a.get(e,"fabric.graph.0.uri");if(t&&n){for(var a=0,r=[],s=function(){var t="fabric.graph.".concat(a),n=Object.keys(e).filter((function(e){return 0===e.indexOf(t)&&-1===e.indexOf("driver")}));if(0===n.length)return"break";var s={};n.forEach((function(n){var a=n.replace("".concat(t,"."),""),r=d.a.get(e,n);s[a]=r})),r.push(s),a++};;){if("break"===s())break}return{database:t,graphs:r}}return!1}))},Ht=function(e){return e.run(wt.LIST_METRICS.query,{}).then((function(e){return e.records.map((function(e){return{name:e.get("name"),lastUpdated:e.get("lastUpdated")}}))})).catch((function(e){var t="".concat(e);return t.indexOf("no procedure")>-1&&t.indexOf("apoc.metrics.list")>-1||I.reportError("Failed to list metrics",e),[]}))},Ft=function(e){var t={},n=[function(){return jt(e).then((function(e){t=d.a.merge(d.a.cloneDeep(t),e)}))},function(){return Lt(e).then((function(e){t.nativeAuth=e.nativeAuth,t.systemGraph=e.systemGraph}))},function(){return Pt(e).then((function(e){t.fabric=e}))},function(){return xt(e).then((function(e){t.authEnabled=e}))},function(){return _t(e).then((function(e){t.csvMetricsEnabled=e}))},function(){return It(e).then((function(e){t.apoc=e}))},function(){return Dt(e).then((function(e){t.logStreaming=e}))},function(){return Ht(e).then((function(t){e.metrics=t}))},function(){return function(e){return e.run(wt.JMX_ALL.query,{}).then((function(e){return e.records.map((function(e){return e.get("name")}))})).catch((function(e){return I.reportError("Failed to list JMX entries",e),[]}))}(e).then((function(e){t.jmxEntries=e.sort(),console.log("JMX entries",t)}))},function(){return Mt(e).then((function(e){t.hasDBStats=e}))},function(){return Nt(e).then((function(e){t.multidatabase=e}))},function(){return e.getConfiguration().then((function(){t.maxHeap=e.getConfigurationValue("dbms.memory.heap.max_size")}))},function(){return e.getMaxPhysicalMemory().then((function(e){t.physicalMemory=e}))}];return K.a.map(n,(function(e){return e()}),{concurrency:2}).then((function(){return t}))},qt=Ht,Bt=function(e,t){var n=e.getFeedsFor(t).map((function(e){return e.isFresh()})),a=n.length,r=n.filter((function(e){return e})).length;return{score:r/a,total:a,fresh:r,notFresh:n.filter((function(e){return!e})).length,performance:t.performance(),created:new Date}},Ut=function(){function e(t){var n=this;if(Object(_.a)(this,e),t.has("databases")){var a=t.get("databases");Object.keys(a).forEach((function(e){var t=a[e];n.role=t})),this.database=a}else{this.role=(t.get("role")||"").trim();var r=this.role,s=Object(H.a)({},Wt.SINGLEDB_NAME,r);this.database=s}this.standalone=!!t.has("standalone")&&t.get("standalone"),this.id=t.get("id"),this.addresses=t.get("addresses"),this.groups=t.get("groups"),this.dbms={},this.driver=null,this.observations=new me.a(100),this.errors={},this.pluggedIn=!0}return Object(x.a)(e,[{key:"getId",value:function(){return this.id}},{key:"merge",value:function(e){if(!e.getId()===this.getId())throw new Error("Cannot merge changes with a different member ID");var t=!1;return d.a.isEqual(this.addresses,e.addresses)||(this.addresses=d.a.cloneDeep(e.addresses),I.fine("".concat(this.getBoltAddress()," addresses changed: "),this.addresses,e.addresses),t=!0),d.a.isEqual(this.groups,e.groups)||(this.groups=d.a.cloneDeep(e.groups),I.fine("".concat(this.getBoltAddress()," groups changed"),this.groups,e.groups),t=!0),d.a.isEqual(this.database,e.database)||(this.database=d.a.cloneDeep(e.database),I.fine("".concat(this.getBoltAddress()," database changed"),this.database,e.database),t=!0),t}},{key:"getDatabaseRoles",value:function(){return d.a.cloneDeep(this.database)}},{key:"getHealthScore",value:function(e){return Bt(e,this)}},{key:"setDriver",value:function(e){this.driver=e,this.pool=se.getSessionPool(this.id,this.driver,15)}},{key:"shutdown",value:function(){var e=this;return this.pool.drain().then((function(){return e.pool.clear()}))}},{key:"performance",value:function(){var e=this.observations.toArray().map((function(e){return e.y}));return{stdev:e.length>0?At.a.std.apply(At.a,Object(ie.a)(e)):0,mean:e.length>0?At.a.mean.apply(At.a,Object(ie.a)(e)):0,median:e.length>0?At.a.median.apply(At.a,Object(ie.a)(e)):0,mode:e.length>0?At.a.mode.apply(At.a,Object(ie.a)(e)):0,min:e.length>0?At.a.min.apply(At.a,Object(ie.a)(e)):0,max:e.length>0?At.a.max.apply(At.a,Object(ie.a)(e)):0,errors:this.errors,observations:this.observations.toArray()}}},{key:"asJSON",value:function(){return{address:this.getBoltAddress(),procotols:this.protocols(),role:this.role,writer:this.canWrite(),database:this.database,id:this.id,groups:this.groups,label:this.getLabel(),dbms:this.dbms,performance:this.performance(),pool:{size:this.pool.size,available:this.pool.available,borrowed:this.pool.borrowed,pending:this.pool.pending,min:this.pool.min,max:this.pool.max}}}},{key:"getObservations",value:function(){return this.observations}},{key:"getBoltAddress",value:function(){return this.boltAddress||(this.boltAddress=this.addresses.filter((function(e){return e.indexOf("bolt")>-1}))[0]),this.boltAddress}},{key:"getPort",value:function(){return Ot.a.parse(this.getBoltAddress()).port||7687}},{key:"getAddress",value:function(){return Ot.a.parse(this.getBoltAddress()).host}},{key:"getLabel",value:function(){var e=Ot.a.parse(this.getBoltAddress()),t=e.host||"NO_ADDRESS";e.port=e.port||"7687";var n="7687"===e.port?"":":"+e.port;return t.match(/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/)?t+n:t.split(".")[0]+n}},{key:"protocols",value:function(){return this.addresses.map((function(e){return Ot.a.parse(e)})).map((function(e){return e.protocol}))}},{key:"isLeader",value:function(){return this.role===e.ROLE_LEADER}},{key:"isFollower",value:function(){return this.role===e.ROLE_FOLLOWER}},{key:"isSingle",value:function(){return this.role===e.ROLE_SINGLE||this.role===e.ROLE_STANDALONE}},{key:"isReadReplica",value:function(){return this.role===e.ROLE_REPLICA}},{key:"isCore",value:function(){return this.isLeader()||this.isFollower()||this.isSingle()}},{key:"canWrite",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!!this.isSingle()||(d.a.isNil(e)?this.isLeader():"LEADER"===this.database[e])}},{key:"isEnterprise",value:function(){return"enterprise"===this.dbms.edition||"commercial"===this.dbms.edition}},{key:"isCommunity",value:function(){return!this.isEnterprise()}},{key:"usesFabric",value:function(){return this.dbms.fabric}},{key:"supportsAPOC",value:function(){return this.dbms.apoc}},{key:"supportsLogStreaming",value:function(){return this.dbms.logStreaming}},{key:"csvMetricsEnabled",value:function(){return this.dbms.csvMetricsEnabled}},{key:"supportsMultiDatabase",value:function(){return this.dbms.multidatabase}},{key:"supportsNativeAuth",value:function(){return this.dbms.nativeAuth}},{key:"supportsSystemGraph",value:function(){return this.dbms.systemGraph}},{key:"supportsAuth",value:function(){return"true"===this.dbms.authEnabled}},{key:"supportsDBStats",value:function(){return this.dbms.hasDBStats}},{key:"getCypherSurface",value:function(){var e=function(e,t){return e.records.map((function(e){return{name:e.get("name"),signature:e.get("signature"),description:e.get("description"),roles:e.has("roles")?e.get("roles"):[],type:t}}))},t=this.run(wt.DBMS_FUNCTIONS).then((function(t){return e(t,"function")})),n=this.run(wt.DBMS_PROCEDURES).then((function(t){return e(t,"procedure")}));return K.a.all([t,n]).then((function(e){return d.a.flatten(e)}))}},{key:"getAvailableMetrics",value:function(){var e=this;return d.a.isNil(this.metrics)?qt(this).then((function(t){return e.metrics=t,t})):K.a.resolve(this.metrics)}},{key:"getVersion",value:function(){if(d.a.isNil(d.a.get(this.dbms,"versions")))return{major:"unknown",minor:"unknown",patch:"unknown"};this.dbms.versions.length>1&&I.warn("This ClusterMember has more than one version installed; only using the first");var e=(this.dbms.versions[0]||"").split("-"),t=Object(Tt.a)(e,2),n=t[0],a=t[1],r=n.split("."),s={major:r[0]||"unknown",minor:r[1]||"unknown",patch:r[2]||"unknown"};return a&&(s.extra=a),"aura"===s.extra&&4===Number(s.major)&&(s.major=4,s.minor=2,s.patch=0),s}},{key:"killConnections",value:function(e){return this.run("CALL dbms.killConnections($ids)",{ids:e}).then((function(e){return se.unpackResults(e,{optional:["connectionId","username","message"]})}))}},{key:"getMaxPhysicalMemory",value:function(){return this.run(wt.OS_MEMORY_STATS).then((function(e){var t=e.records[0];return se.handleNeo4jInt(t.get("physTotal"))})).catch((function(e){if(A.permissionDenied(e))return"unknown";throw e}))}},{key:"getConfiguration",value:function(){var e=this;return d.a.isNil(this.configuration)?this.run("CALL dbms.listConfig()",{}).then((function(e){var t={};return e.records.forEach((function(e){var n=e.get("name"),a=e.get("value");if(t.hasOwnProperty(n)){var r=t[n];d.a.isArray(r)?r.push(a):t[n]=[r,a]}else se.isInt(a)?t[n]=se.integer.inSafeRange(a)?a.toNumber():se.integer.toString(a):t[n]=a})),t})).then((function(t){return e.configuration=t,e.configuration})).catch((function(t){if(!A.permissionDenied(t))throw t;e.configuration={}})):K.a.resolve(this.configuration)}},{key:"getConfigurationValue",value:function(e){if(d.a.isNil(this.configuration))throw new Error("Make sure to call getConfiguration() first");return d.a.get(this.configuration,e)}},{key:"checkComponents",value:function(){var e=this;if(!this.driver)throw new Error("ClusterMember has no driver");return this.isOnline()?Ft(this).then((function(t){e.pluggedIn=!0,e.dbms=t})).then((function(){e.isCommunity()&&(e.dbms.nativeAuth=!0),e.dbms.multidatabase&&(e.dbms.systemGraph=!0),d.a.set(e.dbms,"version",e.getVersion())})):K.a.reject("Skipping component check on offline cluster member")}},{key:"markOffline",value:function(){this.pluggedIn=!1}},{key:"markOnline",value:function(){this.pluggedIn=!0}},{key:"isOnline",value:function(){return this.pluggedIn}},{key:"_txSuccess",value:function(e){this.pluggedIn=!0,this.observations.push({x:new Date,y:e})}},{key:"_txError",value:function(e){(A.failedToEstablishConnection(e)||A.repeatedAuthFailure(e)||A.connectionRefused(e))&&(this.pluggedIn=!1);var t="".concat(e);return d.a.has(this.errors,t)?this.errors[t]=this.errors[t]+1:this.errors[t]=1,this.errors[t]}},{key:"run",value:function(e){var t,n=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!this.driver)throw new Error("ClusterMember has no driver!");if(!e)throw new Error("Missing query");var s,i=(new Date).getTime(),o=function(){return!r||n.getVersion().major<4?(s=!0,n.pool.acquire()):(s=!1,K.a.resolve(n.driver.session({database:r})))};return o().then((function(r){t=r;var s={};return n.dbms.version&&n.dbms.version.major>=3&&n.dbms.version.minor>=5&&(s=wt.queryMetadata),e instanceof pe?r.run(e.getQuery(),a):r.run(e,a,s)})).then((function(e){var t=(new Date).getTime()-i;return n._txSuccess(t),e})).catch((function(e){throw n._txError(e),e})).finally((function(e){return s?n.pool.release(t).catch((function(e){return I.fine("Pool release error",e)})):t.close(),e}))}}],[{key:"makeStandalone",value:function(t,n){n.get=function(e){return n[e]},n.has=function(e){return!d.a.isNil(n[e])},n.standalone=!0;var a=new e(n),r=t.driverFor(a.getBoltAddress());return a.setDriver(r),a}}]),e}();Ut.ROLE_LEADER="LEADER",Ut.ROLE_FOLLOWER="FOLLOWER",Ut.ROLE_REPLICA="READ_REPLICA",Ut.ROLE_SINGLE="SINGLE",Ut.ROLE_STANDALONE="STANDALONE";var Wt=function(){function e(t){if(Object(_.a)(this,e),!d.a.isArray(t))throw new Error("Databases must be initialized with an array of results from SHOW DATABASES");var n=["name","address","role","requestedStatus","currentStatus","default","error"];if(t.forEach((function(e){n.forEach((function(t){if(d.a.isNil(e[t]))throw new Error("Initializing Database objects requires key ".concat(t))}))})),d.a.uniq(t.map((function(e){return e.name}))).length>1)throw new Error("Inconsistent multi-name array of results");this.name=t[0].name,this.backingStatuses=t,this.created=new Date}return Object(x.a)(e,[{key:"merge",value:function(t){if(!(t instanceof e)||t.name!==this.name)throw new Error("Cannot merge with a different or non-Database");var n=!1;return d.a.isEqual(this.backingStatuses,t.backingStatuses)||(this.backingStatuses=d.a.cloneDeep(t.backingStatuses),I.fine("Database ".concat(this.name," statuses changed")),n=!0),this.created=t.created,n}},{key:"asJSON",value:function(){return{name:this.name,statuses:this.backingStatuses}}},{key:"isDefault",value:function(){return this.backingStatuses[0].default}},{key:"getLabel",value:function(){return this.name}},{key:"isReconciling",value:function(){var e=!1;return this.backingStatuses.forEach((function(t){e=e||t.currentStatus!==t.requestedStatus})),e}},{key:"getErrors",value:function(){var e={};return this.backingStatuses.forEach((function(t){e[t.address]=t.error})),e}},{key:"hasError",value:function(){return this.backingStatuses.filter((function(e){return e.error})).length>0}},{key:"getMemberStatuses",value:function(){return this.backingStatuses}},{key:"getStatuses",value:function(){return d.a.uniq(this.backingStatuses.map((function(e){return e.currentStatus})))}},{key:"getMembersByRole",value:function(e){var t=this,n=e.members(),a={};return n.forEach((function(e){var n,r=e.getDatabaseRoles();(n=e.isSingle()?r[t.name]||Ut.ROLE_SINGLE:r[t.name]||"DATABASE OFFLINE")in a?a[n].push(e):a[n]=[e]})),a}},{key:"getLeader",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(1===e.members().length)return e.members()[0];if(!e.supportsMultiDatabase())return e.getWriteMember();var n=this.getMemberStatuses().filter((function(e){var t=e.role.toUpperCase();return t===Ut.ROLE_LEADER||t===Ut.ROLE_STANDALONE||t===Ut.ROLE_SINGLE}));if(0===n.length)return this.isOnline()&&I.warn("Database ".concat(this.name," has no leader; election may be underway")),null;if(n.length>1){var a=JSON.stringify(n,null,2),r="Database ".concat(this.name," has more than one leader (").concat(a,"); this may be transient and OK, but if it persists, investigate!");if(t)throw new Error(r);I.warn(r)}var s=n[0].address,i=s.replace("bolt://","").split(":"),o=Object(Tt.a)(i,2),l=o[0],c=o[1],u=e.members().filter((function(e){var t=Ot.a.parse(e.getBoltAddress());return l===t.host&&c===t.port}));if(1===u.length)return u[0];if(u.length>1)throw new Error("Inconsistent cluster member address table; > 1 leader matching address");var m=e.members().map((function(e){return e.getBoltAddress()})).map((function(e){return Ot.a.parse(e)})).map((function(e){return JSON.stringify(d.a.pick(e,["host","port"]))}));return I.error("Searching for leader address ".concat(s," (host=").concat(l," port=").concat(c,") failed among ").concat(m.join(", "))),null}},{key:"getStatus",value:function(){var e=this.getStatuses();return 1===e.length||I.warn("DB has multiple statuses",this.asJSON()),e[0]}},{key:"isOnline",value:function(){var e=this.getStatuses(),t=d.a.uniq(e);return 1===t.length&&"online"===t[0]}}],[{key:"pre4DummyDatabase",value:function(t){return new e([{name:e.SINGLEDB_NAME,currentStatus:e.STATUS_ONLINE,requestedStatus:e.STATUS_ONLINE,role:Ut.ROLE_STANDALONE,default:!0,error:"",address:t?t.getBaseURI():"0.0.0.0"}])}},{key:"fromArrayOfResults",value:function(t){var n=d.a.groupBy(t,"name"),a=[];return Object.keys(n).forEach((function(t){a.push(new e(n[t]))})),a}}]),e}();Wt.SINGLEDB_NAME="neo4j",Wt.STATUS_ONLINE="online";var zt=function(){function e(){Object(_.a)(this,e),this._subscribers={data:[],error:[]}}return Object(x.a)(e,[{key:"on",value:function(e,t){return this._subscribers[e]||(this._subscribers[e]=[]),-1===this._subscribers[e].indexOf(t)&&this._subscribers[e].push(t),t}},{key:"_notifyListeners",value:function(e,t){(this._subscribers[e]||[]).forEach((function(n){try{n.apply(void 0,Object(ie.a)(t))}catch(a){I.reportError("Error in ".concat(e," listener: "),a)}}))}},{key:"removeListener",value:function(e,t){var n=this._subscribers[e]||[],a=n.indexOf(t);return a>-1&&(n.splice(a,1),this._subscribers[e]=n),t}},{key:"currentState",value:function(){throw new Error("Override me")}},{key:"isFresh",value:function(){throw new Error("Override me")}}]),e}(),Gt=function(e,t){return{success:!0,node:e,addr:e.getBoltAddress(),results:t}},Yt=function(e,t){return t&&I.reportError(t),{success:!1,node:e,addr:e.getBoltAddress(),err:t}},Vt=function(e){return{success:e.filter((function(e){return e.success})).length===e.length,results:e}},Jt=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(e){var a;return Object(_.a)(this,n),(a=t.call(this)).ctx=e,a.eventLog=new me.a(200),a}return Object(x.a)(n,[{key:"currentState",value:function(){return this.eventLog.toArray()}},{key:"isFresh",value:function(){return!0}},{key:"addEvent",value:function(e){if(!e.message||!e.type)throw new Error("ClusterManager events must have at least message, type");var t=d.a.cloneDeep(e);return d.a.set(t,"date",le.a.utc().toISOString()),d.a.set(t,"payload",e.payload||null),d.a.set(t,"id",ue.a.v4()),d.a.set(t,"address",t.event||"all members"),this.eventLog.push(t),this._notifyListeners("data",[e,this]),e}},{key:"getEventLog",value:function(){return this.currentState()}},{key:"clusterWideQuery",value:function(e,t){var n=(this.ctx.supportsSystemGraph()?[this.ctx.getSystemDBWriter()]:this.ctx.members()).map((function(n){return n.run(e,t,se.SYSTEM_DB).then((function(e){return Gt(n,e)})).catch((function(e){return Yt(n,e)}))}));return K.a.all(n).then(Vt)}},{key:"changeUserPassword",value:function(e){var t=this,n=e.username,a=e.password;if(!e||!a)throw new Error("Call with an object containing keys username, password");return this.clusterWideQuery("CALL dbms.security.changeUserPassword($username, $password, false)",{username:n,password:a}).then((function(e){return t.addEvent({type:"passwordchange",message:"Changed password for ".concat(n),payload:n}),e}))}},{key:"addUser",value:function(e){var t=this,n=e.username,a=e.password;if(!e||!a)throw new Error("Call with object containing keys username, password");return this.clusterWideQuery("CALL dbms.security.createUser($username, $password, false)",{username:n,password:a}).then((function(e){return t.addEvent({type:"adduser",alert:!0,message:'Added user "'.concat(n,'"'),payload:n}),e}))}},{key:"deleteUser",value:function(e){var t=this,n=e.username;if(!n)throw new Error("Call with an object containing keys username");return this.clusterWideQuery("CALL dbms.security.deleteUser($username)",{username:n}).then((function(e){return t.addEvent({type:"deleteuser",message:'Deleted user "'.concat(n,'"'),payload:n,alert:!0}),e}))}},{key:"copyRole",value:function(e,t){var n=this;return this.clusterWideQuery("CREATE ROLE `".concat(t,"` AS COPY OF `").concat(e,"`")).then((function(a){return n.addEvent({type:"addrole",message:"Created role ".concat(t," as copy of ").concat(e),payload:{existingRole:e,toBeCreatedRole:t},alert:!0}),a}))}},{key:"addRole",value:function(e){var t=this;if(!e)throw new Error("Must provide role");return this.clusterWideQuery("CALL dbms.security.createRole($role)",{role:e}).then((function(n){return t.addEvent({type:"addrole",message:'Created role "'.concat(e,'"'),payload:e,alert:!0}),n}))}},{key:"deleteRole",value:function(e){var t=this;if(!e)throw new Error("Must provide role");return this.clusterWideQuery("CALL dbms.security.deleteRole($role)",{role:e},se.SYSTEM_DB).then((function(n){return t.addEvent({type:"deleterole",message:'Deleted role "'.concat(e,'"'),payload:e,alert:!0}),n}))}},{key:"addNodeRole",value:function(e,t,n){return I.info("ADD ROLE",{username:t,role:n,addr:e.getBoltAddress()}),e.run("call dbms.security.addRoleToUser($role, $username)",{username:t,role:n},se.SYSTEM_DB)}},{key:"removeNodeRole",value:function(e,t,n){return I.info("REMOVE ROLE",{username:t,role:n,addr:e.getBoltAddress()}),e.run("call dbms.security.removeRoleFromUser($role, $username)",{username:t,role:n},se.SYSTEM_DB)}},{key:"associateUserToRoles",value:function(e,t){var n=this;if(I.info("CM associate ".concat(e," to ").concat(t)),!d.a.isArray(t))throw new Error("roles must be an array");if(!d.a.isObject(e)||!e.username)throw new Error("user must be an object with username");var a=e.username,r=(this.ctx.supportsSystemGraph()?[this.ctx.getSystemDBWriter()]:this.ctx.members()).map((function(e){return function(e){return e.run(wt.DBMS_SECURITY_USER_ROLES,{username:a},se.SYSTEM_DB).then((function(e){return se.unpackResults(e,{required:["value"]})})).then((function(e){return e.map((function(e){return e.value}))})).then((function(e){return I.fine("gather roles made",e),e}))}(e).then((function(n){return function(e,n){I.fine("determine differences",e,t);var a=new Set(e),r=new Set(t),s=new Set(Object(ie.a)(a).filter((function(e){return!r.has(e)}))),i=new Set(Object(ie.a)(r).filter((function(e){return!a.has(e)}))),o=new Set(Object(ie.a)(a).filter((function(e){return r.has(e)})));return I.fine("Determine differences","rolesHere=",e,"newRoles=",r),I.fine("Role modification: ",n.getBoltAddress(),"adding",Object(ie.a)(i),"removing",Object(ie.a)(s),"preserving",Object(ie.a)(o)),{toAdd:Object(ie.a)(i),toDelete:Object(ie.a)(s),toPreserve:Object(ie.a)(o)}}(n,e)})).then((function(t){return function(e,t){var r=e.toAdd,s=e.toDelete,i=Object(ie.a)(r).map((function(e){return n.addNodeRole(t,a,e)})),o=Object(ie.a)(s).map((function(e){return n.removeNodeRole(t,a,e)})),l=i.concat(o);return K.a.all(l).then((function(){var e=Object(ie.a)(r).join(", "),n=Object(ie.a)(s).join(", "),i=e?"Added: "+e:"",o=n?"Removed: "+n:"",l="Assigned roles to ".concat(a,". ").concat(i," ").concat(o);return Gt(t,l)})).catch((function(e){return I.reportError(e,"Cluster operation failure applying role changes"),Yt(t,e)}))}(t,e)})).then((function(){n.addEvent({type:"roleassoc",message:'Associated "'.concat(a,'" to roles ').concat(t.map((function(e){return'"'.concat(e,'"')})).join(", ")),alert:!0,payload:{username:a,roles:t}})})).then((function(){return Gt(e)})).catch((function(t){return Yt(e,t)}))}));return K.a.all(r).then(Vt)}},{key:"getRoles",value:function(){return this.ctx.getSystemDBWriter().run("call dbms.security.listRoles()",{},se.SYSTEM_DB).then((function(e){return se.unpackResults(e,{required:["role","users"]})}))}},{key:"alterPrivilege",value:function(e){var t=this,n=e.validate();if(n)throw new Error(n);if(!this.ctx.getSystemDBWriter().supportsSystemGraph())throw new Error("You cannot modify fine-grained privileges on a DB that does not support system graph");return this.ctx.getSystemDBWriter().run(e.buildQuery(),{},se.SYSTEM_DB).then((function(n){return I.fine("Privilege results",n),t.addEvent({type:"privilege",message:e.buildQuery(),payload:[]}),Gt(t.ctx.getSystemDBWriter(),[])}))}},{key:"getDatabases",value:function(){var e=this;return this.ctx.getSystemDBWriter().run(wt.DBMS_4_SHOW_DATABASES,{},se.SYSTEM_DB).then((function(e){return se.unpackResults(e,{required:["name","address","role","requestedStatus","currentStatus","default","error"]})})).then((function(t){return e._dbs=Wt.fromArrayOfResults(t),e._dbs})).catch((function(t){var n="".concat(t);return["Invalid input","connected to the database that does not support multiple databases"].map((function(e){return n.indexOf(e)>-1})).reduce((function(e,t){return e||t}),!1)||I.warn("ClusterManager#getDatabases() returned unexpected error",t),I.info('Pre Neo4j 4.0, all clusters have a single database "neo4j"'),e._dbs=[Wt.pre4DummyDatabase(e.ctx)],e._dbs}))}},{key:"stopDatabase",value:function(e){var t=this;if(!e||!e.name)throw new Error("Invalid or missing database");return this.ctx.getFeedsForDatabase(e.name).forEach((function(t){I.fine("Stopping data feed for ".concat(e.name)),t.stop()})),this.ctx.getSystemDBWriter().run("STOP DATABASE `".concat(e.name,"`"),{},se.SYSTEM_DB).then((function(e){return I.info("stop results",e),e})).then((function(){return t.ctx.getDatabaseSet().refresh(t.ctx)})).then((function(){return t.addEvent({type:"database",alert:!0,message:"Stopped database ".concat(e.name),payload:e})}))}},{key:"startDatabase",value:function(e){var t=this;if(!e||!e.name)throw new Error("Invalid or missing database");return this.ctx.getSystemDBWriter().run("START DATABASE `".concat(e.name,"`"),{},se.SYSTEM_DB).then((function(e){return I.info("start results",e),e})).then((function(){return t.ctx.getDatabaseSet().refresh(t.ctx)})).then((function(){return t.addEvent({type:"database",alert:!0,message:"Started database ".concat(e.name),payload:e})})).then((function(){t.ctx.getFeedsForDatabase(e.name).forEach((function(t){I.fine("Starting data feed for ".concat(e.name)),t.start()}))}))}},{key:"dropDatabase",value:function(e){var t=this;if(!e||!e.name)throw new Error("Invalid or missing database");return this.ctx.getFeedsForDatabase(e.name).forEach((function(n){I.info("Stopping data feed on ".concat(e.name),t.ctx.removeDataFeed(n))})),this.ctx.getSystemDBWriter().run("DROP DATABASE `".concat(e.name,"`"),{},se.SYSTEM_DB).then((function(e){return I.info("drop results",e),e})).then((function(){return t.ctx.getDatabaseSet().refresh(t.ctx)})).then((function(){return t.addEvent({type:"database",alert:!0,message:"Dropped database ".concat(e.name)})}))}},{key:"createDatabase",value:function(e){var t=this;return this.ctx.getSystemDBWriter().run("CREATE DATABASE `".concat(e,"`"),{},se.SYSTEM_DB).then((function(e){return I.info("Created database; results ",e),e})).then((function(){return t.ctx.getDatabaseSet().refresh(t.ctx)})).then((function(){return t.addEvent({type:"database",alert:!0,message:"Created database ".concat(e)})}))}},{key:"getDatabaseStoreSizes",value:function(){var e=this;if(this.ctx.getVersion().major<4)throw new Error("This operation only applies to Neo4j >= 4.0");var t=this.ctx.databases().map((function(e){return e.getLabel()})),n={};return K.a.all(K.a.map(t,(function(t){return e.ctx.getSystemDBWriter().run(wt.JMX_4_TOTAL_STORE_SIZE,{db:t}).then((function(e){return se.unpackResults(e,{required:["sizeInBytes"]})})).then((function(e){var a=d.a.get(e[0],"sizeInBytes")||0;n[t]=a}))}),{concurrency:3})).then((function(){return n}))}}]),n}(zt),Qt=function(){function e(){Object(_.a)(this,e),this.clusterMembers=[],this.clustered=!1,this.timeout=null,this.memFeeds={},this.stats={}}return Object(x.a)(e,[{key:"members",value:function(){return this.clusterMembers}},{key:"getStats",value:function(){return this.stats}},{key:"shutdown",value:function(){return this.timeout&&clearTimeout(this.timeout),Promise.all(this.clusterMembers.map((function(e){return e.shutdown()}))).catch((function(e){return I.reportError(e,"Failure to shut down cluster members",e)}))}},{key:"initialize",value:function(e,t){var n=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){return console.log(e)},r=t.session();return a("Checking cluster status"),r.run(wt.CLUSTER_OVERVIEW.query).then((function(t){return n.clustered=!0,n._mergeChanges(e,t.records.map((function(e){return new Ut(e)})),a)})).catch((function(t){if(A.noProcedure(t)){var a=e.getBaseDetails();n.clustered=!1;var r=a.host,s=a.port,i=["bolt://".concat(r,":").concat(s)],o={id:ue.a.v4(),addresses:i,role:"SINGLE",database:"default"};return n._mergeChanges(e,[Ut.makeStandalone(e,o)])}throw I.reportError(t),t})).then((function(){return n.scheduleRefresh(e)})).finally((function(){if(r.close(),0===n.members().length)throw new Error("Failed to connect to any valid cluster members")}))}},{key:"scheduleRefresh",value:function(e){var t=this;return this.timeout&&clearTimeout(this.timeout),!!this.clustered&&(this.timeout=setTimeout((function(){return t.refresh(e)}),5e3),this.timeout)}},{key:"updateStats",value:function(e,t,n){var a=d.a.merge({lastUpdated:new Date},d.a.clone(n)),r=d.a.get(this.stats[t],"heapCommitted"),s=d.a.get(n,"heapCommitted");if(a.pctUsed=(n.heapUsed||0)/(n.heapCommitted||-1),a.pctFree=1-a.pctUsed,r&&s!==r){var i=Se.humanDataSize(r),o=Se.humanDataSize(s);e.getClusterManager().addEvent({type:"memory",alert:!0,address:t,message:"Heap allocation changed on ".concat(t," from ").concat(i," to ").concat(o),payload:{old:d.a.clone(this.stats[t]),new:d.a.clone(a)}})}return a.pctFree<=.1?e.getClusterManager().addEvent({type:"memory",alert:!0,error:!0,address:t,message:"Heap is >= 90% utilization on ".concat(t),payload:d.a.clone(a)}):a.pctFree<=.02&&e.getClusterManager().addEvent({type:"memory",alert:!0,error:!0,address:t,message:"Heap is >= 98% utilization on ".concat(t),payload:d.a.clone(a)}),this.stats[t]=a,a}},{key:"getMemoryFeed",value:function(e,t){var n=this,a=t.getBoltAddress();if(this.memFeeds[a])return Promise.resolve(this.memFeeds[a]);var r=e.getDataFeed(d.a.merge({node:t},wt.JMX_MEMORY_STATS));return new Promise((function(s,i){return r.on("data",(function(r){t.markOnline();var s=d.a.get(r,"data[0]");return n.updateStats(e,a,s)})),r.on("error",(function(e,n){t.markOffline(),I.fine("ClusterMemberSet: failed to get mem data",a,e),i(e,n)})),s(r)}))}},{key:"ping",value:function(e,t){var n=t.getBoltAddress(),a=e.getDataFeed(d.a.merge({node:t},wt.PING));return new Promise((function(e,r){a.on("data",(function(n){return t.markOnline(),e({clusterMember:t,elapsedMs:d.a.get(n,"data[0]_sampleTime"),newData:n,err:null})})),a.on("error",(function(e,a){I.fine("ClusterMemberSet: failed to ping",n,e),t.markOffline(),r(e,a)}))}))}},{key:"remove",value:function(e){for(var t=-1,n=0;n-1&&this.clusterMembers.splice(t,1),t>-1}},{key:"_mergeChanges",value:function(e,t){var n=this,a=function(e,t){return t.filter((function(t){return t.getId()===e}))[0]},r=new Set(this.members().map((function(e){return e.getId()}))),s=new Set(t.map((function(e){return e.getId()}))),i=new Set(Object(ie.a)(r).filter((function(e){return!s.has(e)}))),o=new Set(Object(ie.a)(s).filter((function(e){return!r.has(e)}))),l=new Set(Object(ie.a)(r).filter((function(e){return s.has(e)}))),c=[],u=function(e){return{address:e.getBoltAddress(),database:e.getDatabaseRoles()}},d=[];return i.forEach((function(e){var t=a(e,n.members());d.push({message:"Cluster member exited.",type:"exit",address:t.getBoltAddress(),payload:u(t)}),n.remove(t)})),o.forEach((function(r){var s=a(r,t),i=e.driverFor(s.getBoltAddress());s.setDriver(i);var o=Promise.all([n.ping(e,s),n.getMemoryFeed(e,s)]).then((function(){return s.checkComponents()})).catch((function(e){return console.error("Failed to initialize entering member",e)}));c.push(o),d.push({message:"Cluster member entered.",type:"enter",address:s.getBoltAddress(),payload:u(s)}),n.clusterMembers.push(s)})),l.forEach((function(e){var r=a(e,n.members()),s=a(e,t);r.merge(s)&&d.push({message:"Cluster member changed database assignments, groups, or addresses.",type:"change",address:r.getBoltAddress(),payload:u(r)})})),d.forEach((function(t){return e.getClusterManager().addEvent(t)})),c.length>0?Promise.all(c):Promise.resolve(!0)}},{key:"refresh",value:function(e){var t=this;return e.getSystemDBWriter().run(wt.CLUSTER_OVERVIEW.query).then((function(n){return t._mergeChanges(e,n.records.map((function(e){return new Ut(e)})))})).then((function(){return t.scheduleRefresh(e)})).catch((function(e){I.error("Error refreshing cluster member set",e)}))}}]),e}(),Kt=function(){function e(){Object(_.a)(this,e),this.dbs=[],this.multiDB=!0,this.timeout=null}return Object(x.a)(e,[{key:"databases",value:function(){return this.dbs}},{key:"shutdown",value:function(){return clearTimeout(this.timeout),!0}},{key:"getDatabaseByName",value:function(e){return this.databases().filter((function(t){return t.name===e}))[0]}},{key:"getDefaultDatabase",value:function(){return this.databases().filter((function(e){return e.isDefault()}))[0]}},{key:"scheduleRefresh",value:function(e){var t=this;return this.timeout&&clearTimeout(this.timeout),!!this.multiDB&&(this.timeout=setTimeout((function(){return t.refresh(e)}),5e3),this.timeout)}},{key:"remove",value:function(e){for(var t=-1,n=0;n-1&&this.dbs.splice(t,1),t>-1}},{key:"_mergeChanges",value:function(e,t){var n=this,a=function(e,t){return t.filter((function(t){return t.getLabel()===e}))[0]},r=new Set(this.databases().map((function(e){return e.getLabel()}))),s=new Set(t.map((function(e){return e.getLabel()}))),i=new Set(Object(ie.a)(r).filter((function(e){return!s.has(e)}))),o=new Set(Object(ie.a)(s).filter((function(e){return!r.has(e)}))),l=new Set(Object(ie.a)(r).filter((function(e){return s.has(e)}))),c=[];return i.forEach((function(e){var t=a(e,n.databases());c.push({message:"Database ".concat(t.getLabel()," exited."),type:"exit",address:"cluster",payload:t.asJSON()}),n.remove(t)})),o.forEach((function(e){var r=a(e,t);c.push({message:"Database ".concat(r.getLabel()," entered."),type:"enter",address:"cluster",payload:r.asJSON()}),n.dbs.push(r)})),l.forEach((function(e){var r=a(e,n.databases()),s=a(e,t);r.merge(s)&&c.push({message:"Database ".concat(r.getLabel()," changed status."),type:"change",address:"cluster",payload:r.asJSON()})})),c.forEach((function(t){return e.getClusterManager().addEvent(t)})),Promise.resolve(!0)}},{key:"refresh",value:function(e){var t=this;return e.getSystemDBWriter().run(wt.DBMS_4_SHOW_DATABASES,{},se.SYSTEM_DB).then((function(e){return se.unpackResults(e,{required:["name","address","role","requestedStatus","currentStatus","default","error"]})})).then((function(n){return t.multiDB=!0,t._mergeChanges(e,Wt.fromArrayOfResults(n))})).catch((function(n){var a="".concat(n);return["Invalid input","connected to the database that does not support multiple databases"].map((function(e){return a.indexOf(e)>-1})).reduce((function(e,t){return e||t}),!1)?t.multiDB=!1:I.warn("ClusterManager#getDatabases() returned unexpected error",n),I.info('Pre Neo4j 4.0, all clusters have a single database "neo4j"'),t._mergeChanges(e,[Wt.pre4DummyDatabase(e)])})).finally((function(){return t.scheduleRefresh(e)}))}},{key:"initialize",value:function(e){return this.refresh(e)}}]),e}(),Xt=n(55),$t=function(e){return!d.a.isNaN(e)&&!(e===1/0)&&!(e===-1/0)},Zt=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(e){var a;if(Object(_.a)(this,n),(a=t.call(this)).node=e.node,a.database=e.database||"DEFAULT",a.query=e.query,a.params=e.params||{},a.rate=e.rate||1e3,a.index=0,a.displayColumns=e.displayColumns||e.columns,a.aliases=e.alias?[e.alias]:[],a.aliases.length>0&&I.warn("Warning: use addAliases() rather than passing in DataFeed constructor",a.aliases),a.filter=e.filter,a.augmentFns=e.augmentData?[e.augmentData]:[],a.debug=e.debug,a.windowWidth=e.windowWidth||42e4,a.feedStartTime=null,a.label=a.findLabel(a.query),a.state={data:null,events:new me.a(Math.floor(a.windowWidth/a.rate*1.25)),time:new Date,lastDataArrived:new Date,index:a.index++},!a.node||!a.query||!a.displayColumns)throw I.error(e),new Error("Missing one of required props displayColumns/columns, node, query");var r=a.query.replace(/\s*[\r\n]+\s*/g," ");return a.name="".concat(a.node.getBoltAddress(),"-").concat(r,"-").concat(a.database,"-").concat(JSON.stringify(a.displayColumns),"}"),a}return Object(x.a)(n,[{key:"findLabel",value:function(e){var t=null;return Object.keys(wt).forEach((function(n){wt[n].query===e&&(t=n)})),t||"Unlabeled"}},{key:"currentState",value:function(){return this.state}},{key:"addAugmentationFunction",value:function(e){return-1===this.augmentFns.indexOf(e)&&this.augmentFns.push(e),this.augmentFns}},{key:"removeAugmentationFunction",value:function(e){var t=this.augmentFns.indexOf(e);return t>-1&&this.augmentFns.splice(t,1),this.augmentFns}},{key:"addAliases",value:function(e){var t=function(e){return d.a.sortBy(Object.keys(e)).join(",")},n=t(e);return-1===this.aliases.map(t).indexOf(n)&&this.aliases.push(e),this.aliases}},{key:"stop",value:function(){this.timeout&&(clearTimeout(this.timeout),this.feedStartTime=null)}},{key:"start",value:function(){return this.stop(),this.sampleData()}},{key:"isRunning",value:function(){return null!==this.feedStartTime}},{key:"getTimeRange",value:function(){var e=this.state.events.toArray(),t=e[0],n=e[e.length-1];return t&&n?new Xt.TimeRange(t.timestamp(),n.timestamp()):null}},{key:"getDataPackets",value:function(){return this.state.events.toArray().map((function(e){return e._original}))}},{key:"stats",value:function(){var e=this.getDataPackets(),t=e.map((function(e){return e._sampleTime})),n=d.a.isEmpty(t)?[0]:t;return{name:this.name,label:this.label,address:this.node.getBoltAddress(),lastObservation:this.state&&this.state.data?this.state.data[0]:null,query:this.query,packets:e.length,stdev:At.a.std.apply(At.a,Object(ie.a)(n)),mean:At.a.mean.apply(At.a,Object(ie.a)(n)),median:At.a.median.apply(At.a,Object(ie.a)(n)),mode:At.a.mode.apply(At.a,Object(ie.a)(n)),min:At.a.min.apply(At.a,Object(ie.a)(n)),max:At.a.max.apply(At.a,Object(ie.a)(n)),augFns:this.augmentFns.length,aliases:this.aliases.length,timings:n}}},{key:"min",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.displayColumns;if(!this.state.data||0===this.state.data.length)return 0;var t=function(e){var t=d.a.values(e).filter($t);return Math.min.apply(Math,Object(ie.a)(t))},n=e.map((function(e){return e.accessor})),a=this.getDataPackets().map((function(e){return d.a.pick(e,n)})).map((function(e){return t(e)}));return Math.min.apply(Math,Object(ie.a)(a))}},{key:"max",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.displayColumns;if(!this.state.data||0===this.state.data.length)return 1;var t=function(e){var t=d.a.values(e).filter($t);return Math.max.apply(Math,Object(ie.a)(t))},n=e.map((function(e){return e.accessor})),a=this.getDataPackets().map((function(e){return d.a.pick(e,n)})).map((function(e){return t(e)}));return Math.max.apply(Math,Object(ie.a)(a))}},{key:"hasError",value:function(){return!d.a.isNil(this.state.error)}},{key:"isFresh",value:function(){var e=(this.sampleStart||new Date).getTime(),t=this.state.lastDataArrived.getTime(),n=(new Date).getTime();if(this.state.error)return!1;return!((t>=e?t-e:n-e)>2*this.windowWidth)}},{key:"sampleData",value:function(){var e=this,t=!1;this.feedStartTime||(this.feedStartTime=new Date,t=!0);var n=(new Date).getTime();this.sampleStart=new Date;var a=function(t){e.timeout=setTimeout((function(){return e.sampleData()}),t)},r=function(t){t&&("".concat(e.state.error)!=="".concat(t)&&I.reportError(t,"Failed to execute timeseries query (first time)"),e.state.lastDataArrived=e.feedStartTime,e.state.error=t,e._notifyListeners("error",[t,e])),a(2*e.rate)};return this.node.isOnline()?this.node.run(this.query,this.params).then((function(r){var s=(new Date).getTime()-n;s>2*e.rate&&!t&&I.warn("DataFeed: query took ".concat(s," against window of ").concat(e.rate),e.name.slice(0,200));var i=r.records[0];if(!i)throw new Error("Query ".concat(e.query," returned no valid records"));var o={_sampleTime:s,index:e.index++};if((e.displayColumns.forEach((function(e){var t=i.get(e.accessor);o[e.accessor]=se.isInt(t)?se.integer.toNumber(t):t})),e.augmentFns.forEach((function(t){try{o=d.a.merge(o,t(o,e))}catch(n){console.error("Aug fn failed",n)}})),e.aliases.forEach((function(t){e.debug&&I.fine("AliasObj",t),Object.keys(t).forEach((function(n){e.debug&&I.fine("Alias",t[n],n),o[t[n]]=o[n]}))})),e.debug&&I.fine("DB=",e.database,"event",o),a(e.rate),e.filter)&&!e.filter(o,d.a.get(e.state,"data[0]")))return null;var l=new Date,c=new Xt.TimeEvent(l,o);c._original=o;var u=e.state.events;return u.push(c),e.state.lastDataArrived=new Date,e.state.data=[o],e.state.time=l,e.state.events=u,e.state.error=void 0,e._notifyListeners("data",[e.state,e])})).catch(r):Promise.resolve(r(null))}}]),n}(zt),en=n(159),tn="halin/".concat(c.version," build ").concat(en.build," on ").concat(le.a.utc(en.date).format("YYYY-MM-DD")),nn=function(){function e(){var t=this;Object(_.a)(this,e),this.drivers={},this.dataFeeds={},this.pollRate=1e3,this.memberSet=new Qt,this.dbSet=new Kt,this.driverOptions={connectionTimeout:15e3,trust:"TRUST_SYSTEM_CA_SIGNED_CERTIFICATES"},this.debug=!1,this.mgr=new Jt(this),this.mgr.on("data",(function(e){return t.onClusterEvent(e)}))}return Object(x.a)(e,[{key:"members",value:function(){return this.memberSet.members()}},{key:"databases",value:function(){return this.dbSet.databases()}},{key:"getMemberSet",value:function(){return this.memberSet}},{key:"getDatabaseSet",value:function(){return this.dbSet}},{key:"getWriteMember",value:function(){var e=this.memberSet.members().filter((function(e){return e.canWrite()}))[0];if(!e)throw new Error("\n Cluster has no write members! This could mean that it is broken,\n or is currently undergoing a leader election.\n ");return e}},{key:"getSystemDBWriter",value:function(){var e=this.memberSet.members().filter((function(e){return e.canWrite(se.SYSTEM_DB)}))[0];if(this.getVersion().major<4)return this.getWriteMember();if(!e){var t=JSON.stringify(this.memberSet.members().map((function(e){return e.asJSON()})),null,2);throw new Error("No systemdb writer in all of ".concat(t))}return e}},{key:"getPollRate",value:function(){return this.pollRate}},{key:"getClusterManager",value:function(){return this.mgr}},{key:"getFeedsForDatabase",value:function(e){return d.a.values(this.dataFeeds).filter((function(t){return t.database===e}))}},{key:"getFeedsFor",value:function(e){return d.a.values(this.dataFeeds).filter((function(t){return t.node===e}))}},{key:"removeDataFeed",value:function(e){return e.stop(),!!this.dataFeeds[e.name]&&(delete this.dataFeeds[e.name],!0)}},{key:"getDataFeed",value:function(e){var t=new Zt(e),n=this.dataFeeds[t.name];return n||(this.dataFeeds[t.name]=t,t.start(),t)}},{key:"driverFor",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.a.get(this.base,"username"),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d.a.get(this.base,"password"),a=d.a.get(this.base,"tlsLevel"),r=!(!d.a.get(this.base,"encrypted")&&"REQUIRED"!==a);if(this.drivers[e])return this.drivers[e];var s=d.a.merge({encrypted:r},this.driverOptions),i=se.driver(e,se.auth.basic(t,n),s);return i._userAgent=tn,this.drivers[e]=i,i}},{key:"shutdown",value:function(){I.info("Shutting down halin context"),d.a.values(this.dataFeeds).map((function(e){return e.stop()})),this.memberSet.shutdown(),d.a.values(this.drivers).map((function(e){return e.close()})),this.getClusterManager().addEvent({type:"halin",message:"Halin monitoring shut down"})}},{key:"isCluster",value:function(){return this.memberSet.members().length>1}},{key:"isEnterprise",value:function(){return this.getWriteMember().isEnterprise()}},{key:"isCommunity",value:function(){return!this.isEnterprise()}},{key:"isNeo4jAura",value:function(){return(this.getBaseURI()||"").toLowerCase().indexOf("databases.neo4j.io")>-1}},{key:"isAuraEnterprise",value:function(){return this.isNeo4jAura()&&this.userIsAdmin()}},{key:"isAuraProfessional",value:function(){return this.isNeo4jAura()&&!this.isAuraEnterprise()}},{key:"supportsRoles",value:function(){return this.isEnterprise()&&!this.isNeo4jAura()}},{key:"userIsAdmin",value:function(){return!this.isEnterprise()||this.getCurrentUser().roles.indexOf("admin")>-1}},{key:"supportsAPOC",value:function(){return this.getWriteMember().supportsAPOC()}},{key:"supportsLogStreaming",value:function(){return this.getWriteMember().supportsLogStreaming()}},{key:"supportsMetrics",value:function(){return this.getWriteMember().metrics&&this.memberSet.members()[0].metrics.length>0}},{key:"supportsDBStats",value:function(){return this.getWriteMember().supportsDBStats()}},{key:"supportsNativeAuth",value:function(){return this.getWriteMember().supportsNativeAuth()}},{key:"supportsSystemGraph",value:function(){return this.getWriteMember().supportsSystemGraph()}},{key:"supportsMultiDatabase",value:function(){return this.getWriteMember().supportsMultiDatabase()}},{key:"supportsAuth",value:function(){return this.getWriteMember().supportsAuth()}},{key:"getVersion",value:function(){return this.getWriteMember().getVersion()}},{key:"getCurrentUser",value:function(){return this.currentUser}},{key:"onClusterEvent",value:function(e){I.info("Cluster Event",e)}},{key:"checkUser",value:function(e){var t=this,n=e.session();return n.run("call dbms.showCurrentUser()",{}).then((function(e){var n=e.records[0];t.currentUser={username:n.get("username"),roles:n.has("roles")?n.get("roles"):[],flags:n.get("flags")}})).catch((function(e){A.noProcedure(e)?t.currentUser={username:"neo4j",roles:[],flags:[]}:(I.reportError(e,"Failed to get user info"),t.currentUser={username:"UNKNOWN",roles:[],flags:[]})})).finally((function(){return n.close()}))}},{key:"getBaseDetails",value:function(){return this.base}},{key:"getBaseURI",value:function(){return"bolt://".concat(this.base.host,":").concat(this.base.port)}},{key:"initialize",value:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return null},a=!0,r=function(e){return n?n(e,t):null};try{window}catch(i){a=!1}try{var s=null;return s=a?K.a.resolve(d.a.cloneDeep(e.connectionDetails)):K.a.resolve(e.getConnectionDetailsFromEnvironment()),r("Getting database connection"),s.then((function(e){if(d.a.isNil(e))throw new Error("In order to launch Halin, you must have an active database connection");if(t.base=d.a.cloneDeep(e),!t.base.password)throw new Error('No password received from Neo4j Desktop.\n Please check that the option "Store Database Passwords" is\n enabled in Neo4j Desktop');return t.base.driver=t.driverFor(t.getBaseURI()),K.a.all([t.checkUser(t.base.driver,n),t.memberSet.initialize(t,t.base.driver,n)])})).then((function(){return t.dbSet.initialize(t)})).then((function(){if(t.isNeo4jAura())throw new Error("Halin does not support Aura at this time");var e=t.getVersion();console.log("version",e),e.major>=4&&e.minor>=3&&setTimeout((function(){t.getClusterManager().addEvent({type:"halin",message:'Halin is deprecated; check the "About" tab for more information.',alert:!0})}),3e3)})).then((function(){return t.getClusterManager().addEvent({type:"halin",message:"Halin monitoring started"}),r("Initialization complete"),t}))}catch(i){I.reportError(i,"General Halin Context Error");try{this.shutdown()}catch(o){I.reportError(o,"Failure to shut down post halin context error")}return K.a.reject(new Error("General Halin Context error",i))}}}],[{key:"getConnectionDetailsFromEnvironment",value:function(){var e=Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).ENCRYPTION_REQUIRED?"REQUIRED":"OPTIONAL";return{host:Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).NEO4J_HOST||"localhost",port:Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).NEO4J_PORT||7687,username:Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).NEO4J_USERNAME||"neo4j",password:Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).NEO4J_PASSWORD||"admin",enabled:!0,tlsLevel:e}}}]),e}();nn.connectionDetails=null;var an=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s0&&void 0!==arguments[0]?arguments[0]:{};return r.a.createElement("div",{className:"Spinner"},r.a.createElement(z.a,{className:"Spinner-logo",style:dn,src:"img/neo4j_logo_globe.png",size:"mini"}),e.text||"Loading...")};mn.defaultProps={text:"Loading"},mn.props={text:un.a.string};var hn=mn,pn=(n(1498),n(1499),function(){return r.a.createElement(rn.a,{position:"top-center",newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnVisibilityChange:!0,draggable:!0})}),fn=n(800),gn=0,vn=function(){function e(t,n){Object(_.a)(this,e),this.title=t,this.url=n}return Object(x.a)(e,[{key:"render",value:function(){return r.a.createElement("p",{key:"kb".concat(gn++)},"For more information, see\xa0",r.a.createElement("a",{target:"halindocs",href:this.url},this.title))}}]),e}(),bn=function(e){return r.a.createElement("div",{className:"KnowledgeBase"},e.map((function(e){return d.a.isString(e)?r.a.createElement("p",{key:"kb".concat(gn++)},e):e instanceof vn?e.render():e})))},yn={configReference:new vn("Neo4j Configuration Reference","https://neo4j.com/docs/operations-manual/current/reference/configuration-settings/"),txManagement:new vn("transaction management","https://neo4j.com/docs/java-reference/current/transactions/"),connectionManagement:new vn("connection management","https://neo4j.com/docs/operations-manual/current/monitoring/connection-management/"),jmxMonitoring:new vn("JMX monitoring of the operating system","https://neo4j.com/docs/java-reference/current/jmx-metrics/"),usersAndRoles:new vn("Native User and role management","https://neo4j.com/docs/operations-manual/current/authentication-authorization/native-user-role-management/"),understandingDataOnDisk:new vn("Understanding Neo4j's Data on Disk","https://neo4j.com/developer/kb/understanding-data-on-disk/"),dbStats:new vn("db.stats procedures","https://neo4j.com/docs/operations-manual/current/reference/procedures/"),configuringDataOnDisk:new vn("configuration settings reference","https://neo4j.com/docs/operations-manual/current/reference/configuration-settings/#config_dbms.directories.data"),openFiles:new vn("number of open files","https://neo4j.com/developer/kb/number-of-open-files/"),fsTuning:new vn("linux filesystem tuning","https://neo4j.com/docs/operations-manual/current/performance/linux-file-system-tuning/"),performanceTuning:new vn("performance tuning and the page cache","https://neo4j.com/developer/guide-performance-tuning/"),understandingMemoryConsumption:new vn("understanding memory consumption","https://neo4j.com/developer/kb/understanding-memory-consumption/"),memoryConfiguration:new vn("memory configuration and performance","https://neo4j.com/docs/operations-manual/3.5/performance/memory-configuration/"),tuningGC:new vn("memory configuration and performance","https://neo4j.com/docs/operations-manual/3.5/performance/memory-configuration/"),proceduresAndFunctions:new vn("procedures and functions","https://neo4j.com/docs/java-reference/current/extending-neo4j/procedures-and-functions/procedures/"),troubleshootingConnections:new vn("Troubleshooting Bolt Connection Issues","https://community.neo4j.com/t/troubleshooting-connection-issues-in-neo4j-browser-and-cypher-shell/129"),troubleshootingHalin:new vn("Troubleshooting Halin Connection Issues","https://community.neo4j.com/t/troubleshooting-connection-issues-with-halin/8413"),queryLogging:new vn("query logging","https://neo4j.com/docs/operations-manual/current/monitoring/logging/query-logging/"),logFiles:new vn("log file locations","https://neo4j.com/docs/operations-manual/current/configuration/file-locations/#file-locations-log-files"),systemLoadAverage:new vn("JMX system load average","https://docs.oracle.com/javase/7/docs/api/java/lang/management/OperatingSystemMXBean.html#getSystemLoadAverage()"),systemService:new vn("Neo4j as a system service","https://neo4j.com/docs/operations-manual/current/installation/linux/systemd/#linux-service-log"),authMaxFailedAttempts:new vn("Configuring maximum failed authorization attempts","https://neo4j.com/docs/operations-manual/current/reference/configuration-settings/#config_dbms.security.auth_max_failed_attempts"),enablingCSVMetrics:new vn("Enabling CSV Metrics","https://neo4j.com/docs/operations-manual/current/monitoring/metrics/expose/#metrics-enable"),changingCSVMetricIntervals:new vn("Configuring CSV Metrics and sampling intervals","https://neo4j.com/docs/operations-manual/current/monitoring/metrics/expose/#metrics-csv"),countStore:new vn("Fast counts using the count store","https://neo4j.com/developer/kb/fast-counts-using-the-count-store/"),apocDocs:new vn("APOC Documentation","https://neo4j.com/docs/labs/apoc/current/"),fabric:new vn("Fabric","https://neo4j.com/docs/operations-manual/4.0/fabric/introduction/")},En={metricsReference:fn,links:yn,render:bn,"neo4j.log":bn(["The standard log, where general information about Neo4j is written. Not written for Debian and RPM packages. See relevant sections.",yn.logFiles]),"debug.log":bn(["Information useful when debugging problems with Neo4j",yn.logFiles]),"query.log":bn(["Log of executed queries that takes longer than a specified threshold. (Enterprise Edition only.)",yn.logFiles]),"security.log":bn(["Log of security events. (Enterprise Edition only.)",yn.logFiles]),ApocMetaStats:bn(["Basic statistics about your database content, that uses the Neo4j Count Store",yn.apocDocs,yn.countStore]),LogTroubleshooting:bn(["Some installs of Neo4j may use journalctl to access logs, which may not be\n on disk in their usual locations.",yn.systemService,yn.queryLogging]),CypherSurface:bn(["Neo4j has built in procedures and functions which can be called from Cypher","Some are provided for by the system, while others (such as APOC) may be separately\n installed as plugins",yn.proceduresAndFunctions]),StoreFiles:bn(["Store file sizes allow you to track how much disk space Neo4j is using.\n Neo4j uses a file for each kind of information it manages. Total disk\n space is also impacted by things such as transaction logs.",yn.understandingDataOnDisk]),DiskUtilization:bn(["Shows the breakdown of actual files on disk and how much storage they require",yn.understandingDataOnDisk]),Neo4jConfiguration:bn(["The following table displays the contents of the neo4j.conf file, which details\n how the system is configured.",yn.configReference]),Roles:bn(["Roles permit further identifying users and associating them\n with certain permissions.",yn.usersAndRoles]),Users:bn(["User management allows creating new accounts that others can use\n to access bolt connections in Neo4j.",yn.usersAndRoles]),UserManagement:bn(["Neo4j typically manages users on a per-machine basis.","Features here will apply changes across all machines in your cluster","To check if your users and roles are consistent across all of your machines,\n run the advisor in the diagnostics area.",yn.usersAndRoles]),SampleQueries:bn(["Neo4j includes built-in procedures that let us monitor query execution plan and\n execution times for queries that run on the system.","Halin allows temporary sampling of this data for inspecting what is running on\n the system at any given time.","All times are given in microseconds (one millionth of a second)",yn.dbStats]),Diagnostics:bn(["This function runs a suite of tests and can provide advice on how\n to improve your configuration.","A file will be generated with all\n diagnostics, which you can send to Neo4j to help\n troubleshoot issues."]),Ping:bn(["Ping sends a trivial cypher query to the server and measures how \n long it takes the response to come back.","This is useful when examining slow queries, because it shows\n how much time network latency and basic cypher queries take, allowing\n us to see how much of query performance is those factors, versus the\n execution of the Cypher itself."]),StorageCapacity:bn(["Neo4j allows you to configure different directory locations.","Often these will be on the same disk.","The table below shows the underlying disk free and available \n in each directory specified in your neo4j.conf file.","If many statistics are the same, this probably means that most \n or all of your files reside on the same disk.",yn.configuringDataOnDisk]),ClusterMember:bn(["A member is a single machine or container that participates in a Neo4j cluster.","In the case of stand-alone or single instance Neo4j, Halin treats this as a cluster with 1 member."]),ClusterMemory:bn(["The heap space is used for query execution, transaction state, management of the graph etc. The size needed for the heap is very dependent on the nature of the usage of Neo4j. For example, long-running queries, or very complicated queries, are likely to require a larger heap than simpler queries.","Generally speaking, in order to aid performance, we want to configure a large enough heap to sustain concurrent operations.","In case of performance issues we may have to tune our queries, and monitor their memory usage, in order to determine whether the heap needs to be increased.","The heap memory size is determined by the parameters dbms.memory.heap.initial_size and dbms.memory.heap.max_size. It is recommended to set these two parameters to the same value. This will help avoid unwanted full garbage collection pauses.",yn.memoryConfiguration]),EventLog:bn(["Halin keeps a record of all significant events it saw since it connected to\n your Neo4j instance. This includes leader re-elections, creation of databases,\n users, roles, and so on.","The event log only pertains to the period of time you're running Halin, because\n halin does not save data locally."]),GarbageCollection:bn(["Slow garbage collection is an indication of performance problems.","For best performance,\n you want to make sure the JVM is not spending too much time \n performing garbage collection. The goal is to have a large \n enough heap to make sure that heavy/peak load will not result \n in so called GC-trashing. Performance can drop as much as two orders \n of magnitude when GC-trashing happens. Having too large heap may \n also hurt performance so you may have to try some different \n heap sizes.",yn.tuningGC]),FileDescriptors:bn(["Operating systems place limits on how many files may be open at once.\n In some cases, the usual limits may be too low.",yn.openFiles,yn.fsTuning]),PageCache:bn(["The page cache is used to cache the Neo4j data as stored on disk. Ensuring that most of the graph data from disk is cached in memory will help avoid costly disk access.",yn.performanceTuning]),Memory:bn(["Total memory shows the total amount in use.","Heap \u2013 The heap is where your Class instantiations or \u201cObjects\u201d are stored.","Heap is further divided into two categories; the amount used, and the amount committed,\n or in other words how much the database has allocated for potential use.","The JVM has memory other than the heap, referred to as Non-Heap Memory. \n It is created at the JVM startup and stores per-class structures such as \n runtime constant pool, field and method data, and the code for methods and \n constructors, as well as interned Strings. The default maximum size of \n non-heap memory is 64 MB. This can be changed using \u2013XX:MaxPermSize VM option.",yn.understandingMemoryConsumption]),SystemLoad:bn(["The system load is a measure of the amount of computational work that a computer system performs.","System load is the load average for the last minute. \n The system load average is the sum of the number of runnable entities queued to the \n available processors and the number of runnable entities running on the available \n processors averaged over a period of time. The way in which the load average is \n calculated is operating system specific but is typically a damped \n time-dependent average. If the load average is not available, a negative \n value is returned.","This method is designed to provide a hint about the system load and may be queried frequently. The load average may be unavailable on some platform where it is expensive to implement this method","Process load shows how much load is caused by the Neo4j process itself, subject to the same rolling average",yn.performanceTuning,yn.systemLoadAverage]),Privileges:bn(["Privileges control the access rights to graph elements using a combined \n whitelist/blacklist mechanism. It is possible to grant access, deny access, \n or both. The user will be able to access a resource if they have a grant \n (whitelist) and do not have a deny (blacklist) relevant to that resource. \n If there are no read privileges provided at all, then the user will be \n denied access to the entire graph, and this will generate an error. \n All other combinations of GRANT and DENY will result in the matching \n subgraph being visible, which will appear to the user as if they have a \n smaller database (smaller graph)."]),Tasks:bn(["Neo4j Tasks is a combination of three kinds of information: connections,\n transactions, and queries. This allows monitoring of what is currently \n executing on a given Neo4j cluster member.",yn.txManagement,yn.connectionManagement]),Connections:bn(["These are bolt or other network connections to the database, showing which \n programs are accessing the database, and from which network addresses",yn.connectionManagement]),Database:bn(["Databases operate as independent entities in a Neo4j DBMS, both in standalone and in a cluster. \n Since a cluster consists of multiple independent server instances, the effects of administrative \n operations like creating a new database happen asynchronously and independently for each server. \n However, the immediate effect of an administrative operation is to safely commit the desired \n state in the system database.","The desired state committed in the system database gets replicated and is picked up by an internal \n component called the reconciler. It runs on every instance and takes the appropriate actions required \n locally on that instance for reaching the desired state; creating, starting, stopping and dropping \n databases.","Every database runs in an independent Raft group and since there are two databases in a fresh cluster, \n system and neo4j, this means that it also has two Raft groups. Every Raft group also has an independent \n leader and thus a particular Core server could be the leader for one database and a follower for \n another."]),Fabric:bn(["A Fabric setup includes a Fabric database, that acts as the entry point to a federated or sharded graph \n infrastructure. This database is also referred in Fabric as the virtual database. Drivers and client \n applications access and use the Fabric database like any other Neo4j database, with the exception that \n it cannot store any data and queries against it return no data. The Fabric database can be configured \n only on a standalone Neo4j DBMS, i.e. on a Neo4j DBMS where the configuration setting dbms.mode must \n be set to SINGLE.",yn.fabric]),TransactionsOpen:bn(["Any query that updates the graph will run in a transaction. An updating query will always either fully succeed, or not succeed at all.","Open transactions are those that are currently in-flight in the database","Committed transactions have succeeded and finished.","Rolled back transactions are those that failed, and were not applied.",yn.txManagement]),UsedMemory:bn(["This displays total physical memory / RAM available to the machine that Neo4j runs on.","This is not limited to what Neo4j uses, but covers all processes running on that machine",yn.jmxMonitoring]),Transactions:bn(["All database operations that access the graph, indexes, or the schema must be performed in a transaction","Open transactions are the number of active transactions Neo4j is running at any given moment.",'Rolled back transactions are those who have failed, and whose intermediate effects were "rolled back" so that\n the entire transaction as a package either succeeds or fails.',yn.txManagement]),FailedToEstablishConnection:bn(["This error can mean that your database instance is under heavy load or is\n not currently responsive"]),BrokenRoutingTable:bn(["This error can mean that your cluster routing table in incorrectly specified, or\n that cluster members cannot be contacted within the timeout limit (about 15 seconds)"]),CSVMetrics:bn(["Metrics are generated by the database and not sampled by Halin in real time.","In general, these metrics are updated every 3 seconds by the server (default)","Managing these metrics requires server-side configuration",yn.enablingCSVMetrics,yn.changingCSVMetricIntervals]),BrowserSecurityConstraints:bn(["This error can mean that you have untrusted SSL certificates on your server.\n Either install trusted certificates, or try again without encryption.","This error can also mean that you have provided an incorrect DNS name or address for the database","If you are using Neo4j Desktop and running on your local machine, de-select encryption.","Double check your host and try again"]),Unauthorized:bn(["Double check your username and password and try again.","Halin assumes that when you log in as a user, the password for that user is\n the same across all members in the cluster. Please double check and ensure this\n is the case as well"]),RepeatedAuthFailure:bn(["This error occurs when the client has tried to log in with the wrong password\n too many times",yn.authMaxFailedAttempts]),HalinNotSupported:bn(["No further information available."]),UnknownError:bn(["Unfortunately, no troubleshooting is available for this particular error. \n Consider checking the Neo4j community site for more information."]),NoActiveDatabase:bn(["Check to make sure you have activated a database in Neo4j Desktop before launching Halin"]),ClusterResponseGraph:bn(["Each data point represents the timing of a query returned by the Neo4j cluster, showing\n evolving performance over time.","This is simply used for diagnostic reasons to check if the cluster is responding slowly, or\n if network factors are interfering"])},Cn=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s0&&void 0!==arguments[0]?arguments[0]:++wn,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Sn;return t[e%t.length]},DEFAULT_PALETTE:Sn,TWO_TONE:["#35CF21","#6814DF"]},kn={timeRange:null},On=function(e){return kn.timeRange=e,e},Rn={displayTimeRange:function(e){var t=kn.timeRange;return t?(t&&e&&t.disjoint(e)?On(null):t.begin()>=new Date&&(I.debug("User selected range is in the un-displayable future"),On(null)),t):e},setTimeWindow:On,getTimeWindow:function(){return kn.timeRange}},An={HalinContext:nn,ClusterMember:Ut,ClusterManager:Jt,DataFeed:Zt,kb:En,driver:se,queryLibrary:wt,sentry:I,status:ln,palette:Tn,datautil:Se,timewindow:Rn},jn=n(801),Dn=n.n(jn),Nn={max:20,maxAge:6e4},Mn=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s=e.state.lastCheck)}));console.log("Events not yet processed",t),t.map((function(e){return ln.toastify({state:{message:ln.message(e.message)}})})),this.setState({lastCheck:new Date})}},{key:"render",value:function(){return r.a.createElement("span",{id:"HalinAlerter"})}}]),n}(a.Component),In=(n(1502),n(1503),n(562)),_n=n(205),xn=n(1684),Ln=n(821),Pn=n(1673),Hn=n(1681),Fn=n(160),qn=n(439),Bn=n(822),Un=n(65),Wn=(n(743),function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(e,a){var r;if(Object(_.a)(this,n),(r=t.call(this,e,a)).state={chartLowLimit:1/0,chartHighLimit:-1/0,startTime:new Date,query:null,data:null,error:null,events:null,time:new Date,lastDataArrived:new Date,minObservedValue:1/0,maxObservedValue:-1/0,tracker:null,timeRange:null,disabled:{},metadata:!1,displayProperty:null},r.handleTimeRangeChange=function(e){r.mounted&&(Rn.setTimeWindow(e),r.setState({timeRange:e}))},r.handleTrackerChanged=function(e,t){r.setState({tracker:e,trackerEvent:e&&r.dataSeries.at(r.dataSeries[r.nodes[0]].bisect(e)),trackerX:e&&t(e)})},r.legendClick=function(e){I.fine("Legend clicked",e);!function(e){var t=d.a.cloneDeep(r.state.disabled);t[e]=!r.state.disabled[e],r.setState({disabled:t})}(e)},r.toggleMetadata=function(){var e=!r.state.metadata;r.setState({metadata:e})},r.handleTimeRangeChange=function(e){r.mounted&&Rn.setTimeWindow(e)},r.handleTrackerChanged=function(e,t){r.setState({tracker:e,trackerEvent:e&&r.dataSeries[r.nodes[0]].at(r.dataSeries[r.nodes[0]].bisect(e)),trackerX:e&&t(e)})},r.id=ue.a.v4(),!e.query&&!e.feedMaker)throw new Error("Either query OR feedmaker is a required property");if(!e.displayProperty)throw new Error("displayProperty is required");return r.state.displayProperty=e.displayProperty,r.query=e.query,r.rate=e.rate||2e3,r.width=e.width||380,r.timeWindowWidth=e.timeWindowWidth||3e5,r.showGrid=!d.a.isNil(e.showGrid)&&e.showGrid,r.showGridPosition=d.a.isNil(e.showGridPosition)?"over":e.showGridPosition,r.feedMaker=e.feedMaker,r.onUpdate=e.onUpdate,r.dateStyle={fontSize:12,color:"#AAA",borderWidth:1,borderColor:"#F4F4F4"},r.nodes=window.halinContext.members().map((function(e){return e.getBoltAddress()})),r}return Object(x.a)(n,[{key:"findMatchingHalinQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props.query,t=null;return Object.keys(wt).forEach((function(n){wt[n].query&&!t&&wt[n].query===e&&(t=wt[n])})),t}},{key:"findColumns",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props.query,t=this.findMatchingHalinQuery(e),n=t?t.columns:null;return n||[{Header:this.state.displayProperty,accessor:this.state.displayProperty}]}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){e.database!==this.state.database&&this.startDataFeeds(),this.setState({displayProperty:e.displayProperty,database:e.database,minObservedValue:1/0,maxObservedValue:-1/0,resetY:!0})}},{key:"displayTimeRange",value:function(){return Rn.displayTimeRange(d.a.get(d.a.get(this.state,this.nodes[0]),"timeRange"))}},{key:"startDataFeeds",value:function(){var e=this,t=window.halinContext,a=function(){if(e.props.database)return e.props.database.getLabel();var n=t.getDatabaseSet().getDefaultDatabase();return n?n.getLabel():(I.warn("No default database detected in ClusterTimeseries"),"DEFAULT")};t.members().forEach((function(r){var s,i=r.getBoltAddress();if(e.streams[i]=new Xt.Stream,e.props.feedMaker)e.props.debug&&console.log("FEEDMAKER"),s=e.props.feedMaker(r);else{var o=e.findMatchingHalinQuery(e.props.query);e.props.debug&&console.log("Matching query",o),(s=t.getDataFeed({node:r,database:a(),query:e.props.query,rate:e.props.rate,windowWidth:e.props.timeWindowWidth,displayColumns:e.findColumns(),filter:o?o.filter:null})).addAliases(Object(H.a)({},e.state.displayProperty,n.keyFor(i,e.state.displayProperty)))}e.feeds[i]&&e.feeds[i].removeListener("data",e.onDataCallbacks[i]),e.feeds[i]=s,e.onDataCallbacks[i]=function(t,n){return e.onData(r,a(),t,n)},e.feeds[i].on("data",e.onDataCallbacks[i]),e.feeds[i].on("error",(function(t,n){return e.onError(t,n)}));var l=e.feeds[i].currentState();e.onDataCallbacks[i](l,e.feeds[i])}))}},{key:"componentDidMount",value:function(){var e=this;this.mounted=!0,this.feeds={},this.streams={},this.onDataCallbacks={},this.startDataFeeds();var t={};this.nodes.forEach((function(a){t[n.keyFor(a,e.state.displayProperty)]=!1})),this.setState({startTime:new Date,disabled:t})}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"onError",value:function(e,t){var n=Object.values(this.feeds).map((function(e){return d.a.get(e.currentState(),"error")})).reduce((function(e,t){return e&&t}),!0);n&&(this.setState({error:n}),console.fine("All feeds are in an error state"))}},{key:"onData",value:function(e,t,n,a){var r=e.getBoltAddress();if(this.mounted){var s=[{accessor:this.state.displayProperty,Header:this.state.displayProperty}],i=.85*a.min(s,this.props.debug),o=1.15*a.max(s,this.props.debug);this.props.debug&&I.debug("computedMin/Max",i,o,"from",this.state.displayProperty);var l=o,c=i;if(!a.feedStartTime)return I.fine("ClusterTimeseries: feed is stopped"),null;var u,d,m=a.feedStartTime.getTime();n.time.getTime()-m>=this.timeWindowWidth?(u=n.time.getTime()-this.timeWindowWidth,d=n.time.getTime()+1e3):(u=m,d=m+this.timeWindowWidth+1e3);var h=new Xt.TimeRange(u,d),p=Object(Fn.a)(Object(Fn.a)({},n),{},{maxObservedValue:l,minObservedValue:c,timeRange:h,error:null}),f={};f[r]=p,this.setState(f),this.onUpdate&&this.onUpdate(this.state)}}},{key:"getObservedMins",value:function(){var e=this;return this.nodes.map((function(t){return e.state[t].minObservedValue}))}},{key:"getObservedMaxes",value:function(){var e=this;return this.nodes.map((function(t){return e.state[t].maxObservedValue}))}},{key:"getChartMin",value:function(){if(!d.a.isNil(this.props.min))return this.props.min;var e=this.getObservedMins();return Math.min(Math.min.apply(Math,Object(ie.a)(e)),this.state.chartLowLimit)}},{key:"getChartMax",value:function(){if(!d.a.isNil(this.props.max))return this.props.max;var e=this.getObservedMaxes();return Math.max.apply(Math,Object(ie.a)(e))}},{key:"chooseColor",value:function(e){if(d.a.isNil(e))return Tn.chooseColor(0);var t=this.nodes[e],a=n.keyFor(t,this.state.displayProperty);if(this.state.disabled[a])return"transparent";var r=window.halinContext.members()[e];return r.isLeader()&&!r.supportsMultiDatabase()||r.supportsMultiDatabase()&&r.canWrite(se.SYSTEM_DB)?"#000000":Tn.chooseColor(e)}},{key:"renderChartMetadata",value:function(){if(!this.state.metadata)return"";var e=Math.min.apply(Math,Object(ie.a)(this.getObservedMins())),t=Math.max.apply(Math,Object(ie.a)(this.getObservedMaxes()));return r.a.createElement("div",{className:"ChartMetadata"},r.a.createElement(qn.a,null,"Max",r.a.createElement(qn.a.Detail,null,Se.roundToPlaces(t,2))),r.a.createElement(qn.a,null,"Min",r.a.createElement(qn.a.Detail,null,Se.roundToPlaces(e,2))),r.a.createElement(qn.a,null,"Range",r.a.createElement(qn.a.Detail,null,Se.roundToPlaces(t-e,2))))}},{key:"render",value:function(){var e=this,t=Object(Un.styler)(this.nodes.map((function(t,a){return{key:n.keyFor(t,e.state.displayProperty),color:e.chooseColor(a),width:"scatter"===e.props.chartType?8:3}})));this.dataSeries={};var a=this.nodes.map((function(t){return d.a.get(e.state[t],"data")})).reduce((function(e,t){return e||t}),!0);if(a&&this.nodes.forEach((function(t){var n=d.a.get(e.state[t],"events");e.dataSeries[t]=new Xt.TimeSeries({name:"Data Series",events:n?n.toArray():[]})})),!this.mounted||!a)return r.a.createElement(hn,{active:!0});if(this.state.error)return r.a.createElement(B.a,{negative:!0},r.a.createElement(B.a.Header,null,"Error Retrieving Data"),r.a.createElement("p",null,"Data feeds are in an error state, and no data can be shown."));var s=d.a.merge({id:"y",width:70,showGrid:!0,type:"linear",min:this.getChartMin(),max:this.getChartMax()},this.props.yAxis||{}),i=d.a.merge({showGrid:this.showGrid,showGridPosition:this.showGridPosition,width:this.width,enablePanZoom:!0,trackerPosition:this.state.tracker,onTrackerChanged:this.handleTrackerChanged,onTimeRangeChanged:this.handleTimeRangeChange,timeRange:this.displayTimeRange()},this.props.container||{});return r.a.createElement("div",{className:"CypherTimeseries"},r.a.createElement(Bn.a,null,r.a.createElement(Bn.a.Row,{columns:1,className:"CypherTimeseriesLegend"},r.a.createElement(Bn.a.Column,null,r.a.createElement(Un.Legend,{type:"swatch",style:t,onSelectionChange:this.legendClick,categories:this.nodes.map((function(t,a){return{key:n.keyFor(t,e.state.displayProperty),label:window.halinContext.members()[a].getLabel(),style:{fill:e.chooseColor(a)}}}))}))),r.a.createElement(Bn.a.Row,{columns:1,className:"CypherTimeseriesContent"},r.a.createElement(Bn.a.Column,{textAlign:"left"},r.a.createElement(Un.ChartContainer,i,r.a.createElement(Un.ChartRow,{height:"150"},r.a.createElement(Un.YAxis,s),r.a.createElement(Un.Charts,null,this.nodes.map((function(a){var s={key:n.keyFor(a,e.state.displayProperty),axis:"y",style:t,columns:[n.keyFor(a,e.state.displayProperty)],series:e.dataSeries[a]};return"scatter"===e.props.chartType?r.a.createElement(Un.ScatterChart,s):r.a.createElement(Un.LineChart,s)})))))))),this.renderChartMetadata())}}],[{key:"keyFor",value:function(e,t){if(!e||!t)throw new Error("Must provide both addr and field");return"".concat(e,"-").concat(t).replace(/[^a-zA-Z0-9]/g,"")}}]),n}(a.Component)),zn=(n(1523),n(1678)),Gn=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){return Object(_.a)(this,n),t.apply(this,arguments)}return Object(x.a)(n,[{key:"getMainContent",value:function(){return this.props.knowledgebase?(En[this.props.knowledgebase]||I.warn("No kb entry for ",this.props.knowledgebase),En[this.props.knowledgebase]||"No further information available"):this.props.content||"No further information available"}},{key:"getIntroContent",value:function(){return this.props.intro||null}},{key:"getContent",value:function(){var e=this.getIntroContent(),t=this.getMainContent();return e?r.a.createElement("div",null,e,t):t}},{key:"render",value:function(){return r.a.createElement(zn.a,{on:"click",wide:"very",inverted:!0,position:this.props.position||"bottom left",trigger:r.a.createElement(_n.a,{name:(this.props.icon||"info")+" circle",color:"green"}),content:this.getContent()})}}]),n}(a.PureComponent),Yn=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){return Object(_.a)(this,n),t.apply(this,arguments)}return Object(x.a)(n,[{key:"header",value:function(){return this.props.header?r.a.createElement(Hn.a.Header,null,r.a.createElement("h3",null,this.props.header,this.props.knowledgebase?r.a.createElement(Gn,{knowledgebase:this.props.knowledgebase}):"")):""}},{key:"render",value:function(){var e=d.a.pick(this.props,["id"]);return r.a.createElement(Hn.a,Object.assign({fluid:!0,className:"HalinCard"},e),this.header(),r.a.createElement("div",{className:"HalinCardContent"},this.props.children))}}]),n}(a.PureComponent);Yn.props={children:un.a.node.isRequired,knowledgebase:un.a.string,header:un.a.string};var Vn=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s2&&void 0!==arguments[2])||arguments[2],a="Only users with role 'admin' may use this function",r=function(e){return Promise.resolve(!e.isEnterprise()||e.getCurrentUser().roles.indexOf("admin")>-1)};return $n(e,r,(function(){return Xn(t,a,n)}))},ta=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a="Only available in Neo4j Enterprise",r=function(e){return Promise.resolve(e.isEnterprise())};return $n(e,r,(function(){return Xn(t,a,n)}))},na=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a="As of Neo4j 4.2, you must set metrics.jmx.enabled=true in your configuration in order to use this function",r=function(e){var t=e.getVersion();return 4===Number(t.major)&&Number(t.minor)>=2?e.getSystemDBWriter().getConfiguration().then((function(e){return"true"===e["metrics.jmx.enabled"]})):Promise.resolve(!0)};return $n(e,r,(function(){return Xn(t,a,n)}))},aa=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a="This feature is only available for databases that have APOC installed.",r=function(e){return Promise.resolve(e.supportsAPOC())};return $n(e,r,(function(){return Xn(t,a,n)}))},ra=$n,sa=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a="Only available in versions of Neo4j which support db.stats (Neo4j 3.5.2 and above)",r=function(e){return Promise.resolve(e.supportsDBStats())};return $n(e,r,(function(){return Xn(t,a,n)}))},ia=na(ta(function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s=.8?"green":e>=.6?"yellow":"red"},e}return Object(x.a)(n,[{key:"sampleFeeds",value:function(){if(!this.mounted)return null;var e=this.props.member.getHealthScore(window.halinContext);this.setState(e)}},{key:"componentDidMount",value:function(){var e=this;this.mounted=!0,this.interval=setInterval((function(){return e.sampleFeeds()}),500)}},{key:"componentWillUnmount",value:function(){this.mounted=!1,clearInterval(this.interval)}},{key:"render",value:function(){var e,t=this.props.member.canWrite(se.SYSTEM_DB),n=!this.props.member.supportsMultiDatabase()&&this.props.member.isLeader(),a=this.props.member.isReadReplica(),s=this.colorFor(this.state.score);return e=t||n?"star":a?"copy":"circle",r.a.createElement(_n.a,{className:"ClusterMemberStatusIcon",name:e,color:s})}}]),n}(a.Component);ha.props={member:un.a.object.isRequired};var pa=ha,fa={hover:"none"},ga=function(e){return r.a.createElement(qn.a,{style:fa},r.a.createElement(pa,e),e.member?e.member.getLabel():"NONE",e.detail?r.a.createElement(qn.a.Detail,null,e.detail):"")};ga.props={member:un.a.object.isRequired};var va=ga,ba=n(806),ya=function(e){var t=se.handleNeo4jInt(e),n=d.a.isString(t)?t:JSON.stringify(t);return d.a.isNil(n)?null:n.replace(/"/g,'""')},Ea=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){return Object(_.a)(this,n),t.apply(this,arguments)}return Object(x.a)(n,[{key:"getButtonText",value:function(){return this.props.title?this.props.title:"Download"}},{key:"getFilename",value:function(){return this.props.filename?this.props.filename:"Halin-data-".concat(le.a.utc().format(),".csv")}},{key:"render",value:function(){var e=this,t=this.props.displayColumns.filter((function(e){return e.accessor})).filter((function(e){return d.a.isNil(e.excludeFromCSV)||!e.excludeFromCSV})).filter((function(t){return!!e.props.includeHidden||(d.a.isNil(t.show)||t.show)})),n=this.props.data.map((function(e){return t.map((function(e){return e.accessor})).map((function(t){return d.a.get(e,t)})).map(ya)})),a=[t.map((function(e){return e.Header||e.accessor}))].concat(n);return r.a.createElement(ba.CSVLink,{filename:this.getFilename(),className:"ui button DownloadCSV",data:a},r.a.createElement(_n.a,{name:"download"}),this.getButtonText())}}]),n}(a.PureComponent),Ca=(n(1551),function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(e,a){var r;if(Object(_.a)(this,n),(r=t.call(this,e,a)).state={key:ue.a.v4(),items:null,refresh:null,displayColumns:null},r.onUpdate=function(){if(r.buildSelectFilters(),r.props.onUpdate)return r.props.onUpdate(r.state.items,Object(ua.a)(r))},r.updateColumns=function(e){I.fine("Showing",e);var t=d.a.cloneDeep(r.state.displayColumns);return t.forEach((function(t){e.indexOf(t.accessor)>-1?t.show=!0:t.show=!1})),I.fine("New display columns",t),r.setState({displayColumns:t})},!e.query)throw new Error("must provide query");if(!e.displayColumns)throw new Error("must provide displayColumns");r.rate=e.rate||5e3,r.query=e.query,r.params=e.params||{},r.allowColumnSelect=!d.a.isNil(e.allowColumnSelect)&&e.allowColumnSelect,r.allowDownloadCSV=!d.a.isNil(e.allowDownloadCSV)&&e.allowDownloadCSV,r.originalDisplayColumns=e.displayColumns,r.showPagination=e.showPagination?function(){return e.showPagination}:function(){return r.state.items.length>=7},r.defaultPageSize=e.defaultPageSize?function(){return e.defaultPageSize}:function(){return 10},r.sortable=!!d.a.isNil(e.sortable)||e.sortable,r.filterable=!!d.a.isNil(e.filterable)||e.filterable,r.pageSizeOptions=d.a.isNil(e.pageSizeOptions)?[10,20,25,50,100]:e.pageSizeOptions,r.nodeLabel=!e.hideMemberLabel;return["onPageChange","onPageSizeChange","onSortedChange","onFilteredChange","onResizedChange","onExpandedChange"].forEach((function(t){r[t]=d.a.isNil(e[t])?function(){return null}:e[t]})),r}return Object(x.a)(n,[{key:"componentDidMount",value:function(){this.mounted=!0,this.setState({displayColumns:d.a.cloneDeep(this.originalDisplayColumns)}),this.sampleData()}},{key:"componentWillUnmount",value:function(){this.mounted=!1,this.cancelPoll()}},{key:"cancelPoll",value:function(){this.interval&&clearTimeout(this.interval)}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){this.state.refresh!==e.refresh&&(this.setState({refresh:e.refresh}),this.cancelPoll(),this.sampleData())}},{key:"buildSelectFilters",value:function(){var e=this;if(!this.props.selectFilter)return null;this.props.selectFilter.forEach((function(t){var n=e.state.displayColumns.filter((function(e){return e.accessor===t}))[0];if(n){var a=d.a.uniq(e.state.items.map((function(e){return e[t]})));a.sort();var s={filterMethod:function(e,t){return"all"===e.value||t[e.id]===e.value},Filter:function(e){var t=e.filter,n=e.onChange;return r.a.createElement("select",{onChange:function(e){return n(e.target.value)},style:{width:"100%"},value:t?t.value:"all"},r.a.createElement("option",{value:"all"},"All"),a.map((function(e,t){return r.a.createElement("option",{value:e,key:t},e)})))}};d.a.merge(n,s)}else I.warn("Cannot create select filter for missing column ".concat(t))}))}},{key:"sampleData",value:function(){var e=this;return this.props.node.run(this.query,this.parameters,this.props.database).then((function(t){var n=se.unpackResults(t,{required:[],optional:e.state.displayColumns.map((function(e){return e.accessor})).filter((function(e){return e}))});return e.mounted&&(e.setState({items:n},e.onUpdate),e.rate>0&&setTimeout((function(){return e.sampleData()}),e.rate)),n})).catch((function(t){I.reportError(t,"CypherDataTable: error executing ".concat(e.query)),e.setState({items:[]},e.onUpdate)}))}},{key:"renderColumnSelector",value:function(){return r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(Bn.a.Column,null,r.a.createElement(ma,{onSelect:this.updateColumns,displayColumns:this.state.displayColumns})))}},{key:"renderDownloadCSV",value:function(){return r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(Bn.a.Column,null,r.a.createElement(Ea,{includeHidden:!0,data:this.state.items,displayColumns:this.state.displayColumns})))}},{key:"render",value:function(){return this.state.items?r.a.createElement("div",{className:"CypherDataTable"},r.a.createElement(Bn.a,null,this.allowColumnSelect?this.renderColumnSelector():"",this.allowDownloadCSV?this.renderDownloadCSV():"",r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(Bn.a.Column,null,r.a.createElement(da.a,{className:"-striped -highlight",defaultFilterMethod:function(e,t){var n=e.pivotId||e.id;return void 0===t[n]||String(t[n]).indexOf(e.value)>-1},data:this.state.items,sortable:this.sortable,filterable:this.filterable,defaultPageSize:this.defaultPageSize(),pageSize:Math.min(this.state.items.length,10),pageSizeOptions:this.pageSizeOptions,showPagination:this.showPagination(),columns:this.state.displayColumns,onPageChange:this.onPageChange,onPageSizeChange:this.onPageSizeChange,onSortedChange:this.onSortedChange,onResizedChange:this.onResizedChange,onExpandedChange:this.onExpandedChange}),this.nodeLabel?r.a.createElement(va,{member:this.props.node}):"")))):r.a.createElement(hn,{active:!0})}}]),n}(a.Component)),Sa=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(e,a){var r;return Object(_.a)(this,n),(r=t.call(this,e,a)).state={users:[],roles:[]},r.cancel=function(){return I.fine("Cancelled user assignment with state",r.state),r.setState({open:!1}),r.state.onCancel(Object(ua.a)(r))},r.ok=function(){var e=r.state.activeUser.username,t=r.state.activeUser.newRoles;return window.halinContext.getClusterManager().associateUserToRoles({username:e},t).then((function(e){return r.state.onConfirm(Object(ua.a)(r),e)})).catch((function(e){return r.state.onConfirm(Object(ua.a)(r),e)}))},r.chooseUser=function(e,t){var n=t.value,a=d.a.cloneDeep(r.state.users.filter((function(e){return e.username===n}))[0]),s=d.a.cloneDeep(a.roles);a.newRoles=s,r.setState({activeUser:a}),I.fine("selected user ",t.value)},r.formValid=function(){return r.state.activeUser},r.chooseRole=function(e,t){var n=t.value,a=d.a.cloneDeep(r.state.activeUser);a.newRoles=n,r.setState({activeUser:a})},r.state.open=e.open,r.state.onConfirm=e.onConfirm||function(){return null},r.state.onCancel=e.onCancel||function(){return null},r}return Object(x.a)(n,[{key:"cypher",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;return this.props.node.run(e,n,a).catch((function(e){I.reportError(e),t.setState({pending:!1,message:null,error:ln.message("Error","Could not execute cypher: ".concat(e))},(function(){return ln.toastify(t)}))}))}},{key:"loadUsers",value:function(){var e=this,t=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;try{return e.get(t)}catch(a){return n}};return this.cypher("CALL dbms.security.listUsers()",{},An.driver.SYSTEM_DB).then((function(e){return e.records})).then((function(n){var a=n.map((function(e){return{key:e.get("username"),value:e.get("username"),text:e.get("username"),roles:t(e,"roles",[]),username:e.get("username")}}));e.setState({users:a})}))}},{key:"loadRoles",value:function(){var e=this;return window.halinContext.isCommunity()?Promise.resolve([]):this.cypher("CALL dbms.security.listRoles()",{},An.driver.SYSTEM_DB).then((function(e){return e.records})).then((function(t){var n=t.map((function(e){return{key:e.get("role"),value:e.get("role"),text:e.get("role"),role:e.get("role")}}));e.setState({roles:n})}))}},{key:"removeRole",value:function(e,t){var n={username:e,role:t};return this.cypher("\n CALL dbms.security.removeRoleFromUser({role}, {username})\n RETURN null as value\n ",n,An.driver.SYSTEM_DB)}},{key:"addRole",value:function(e,t){var n={username:e,role:t};return this.cypher("\n CALL dbms.security.addRoleToUser({role}, {username})\n RETURN null as value\n ",n,An.driver.SYSTEM_DB)}},{key:"componentDidMount",value:function(){this.setState({loadPromise:Promise.all([this.loadUsers(),this.loadRoles()])})}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){d.a.isNil(e.open)||(e.open&&this.setState({loadPromise:Promise.all([this.loadUsers(),this.loadRoles()])}),this.setState({open:e.open}))}},{key:"render",value:function(){return r.a.createElement(F.a,{className:"AssignRoleModal",open:this.state.open},r.a.createElement(F.a.Header,null,"Manage User Roles"),r.a.createElement(F.a.Content,null,r.a.createElement(Bn.a,null,r.a.createElement(Bn.a.Row,{columns:2},r.a.createElement(Bn.a.Column,null,r.a.createElement("h4",null,"Step 1: Select User"),this.state.users&&this.state.users.length>0?r.a.createElement(Qn.a,{placeholder:"Select user",fluid:!0,selection:!0,onChange:this.chooseUser,options:this.state.users}):"Loading users..."),r.a.createElement(Bn.a.Column,null,r.a.createElement("h4",null,"Step 2: Assign Roles"),this.state.roles&&this.state.roles.length>0?r.a.createElement(Qn.a,{fluid:!0,multiple:!0,selection:!0,placeholder:"Choose Roles",disabled:!this.state.activeUser,value:d.a.get(this.state.activeUser,"newRoles")||[],onChange:this.chooseRole,options:this.state.roles}):"Loading roles...")))),r.a.createElement(F.a.Actions,null,r.a.createElement(W.a,{basic:!0,color:"red",onClick:this.cancel},"Cancel"),r.a.createElement(W.a,{basic:!0,color:"green",disabled:!this.formValid(),onClick:this.ok},"OK")))}}]),n}(a.Component),wa=(n(1552),n(1553),function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(e,a){var r;return Object(_.a)(this,n),(r=t.call(this,e,a)).state={username:"",password:"",requireChange:!1,pending:!1,error:null},r.inputStyle={minWidth:"150px",paddingTop:"10px",paddingBottom:"10px"},r.onUserCreate=e.onUserCreate||function(){return null},r}return Object(x.a)(n,[{key:"createUser",value:function(){var e=this;this.setState({pending:!0,error:!1});var t=window.halinContext.getClusterManager(),n={username:this.state.username,password:this.state.password};return t.addUser(n).then((function(t){I.info("ClusterMgr result",t);var a="Creating user ".concat(n.username);t.success?e.setState({pending:!1,error:null}):e.setState({pending:!1,error:ln.fromClusterOp(a,t)})})).catch((function(t){return e.setState({pending:!1,error:ln.message("Error","Could not create ".concat(n.username,": ").concat(t))})})).finally((function(){return e.state.error?ln.toastify(e):null}))}},{key:"valid",value:function(){return!this.state.username||!this.state.username.match(/[,:\s]/)&&!this.state.username.match(/[^\x00-\x7F]/)}},{key:"submit",value:function(e){I.fine("submit",this.state),e.preventDefault(),this.createUser()}},{key:"handleChange",value:function(e,t){var n={};n[e]=t.target.value,this.setState(n)}},{key:"render",value:function(){var e=this;return r.a.createElement("div",{className:"NewUserForm"},r.a.createElement(q.a,{size:"small",error:!this.valid(),style:{textAlign:"left"}},r.a.createElement(q.a.Group,{widths:"equal"},r.a.createElement(q.a.Input,{fluid:!0,style:this.inputStyle,disabled:this.state.pending,onChange:function(t){return e.handleChange("username",t)},label:"Username",placeholder:"username"}),r.a.createElement(q.a.Input,{fluid:!0,style:this.inputStyle,disabled:this.state.pending,onChange:function(t){return e.handleChange("password",t)},label:"Password",type:"password"})),r.a.createElement(B.a,{error:!0,header:"Invalid username",content:"Usernames must be ASCII and cannot contain , : or whitespace"}),r.a.createElement(q.a.Button,{positive:!0,style:this.inputStyle,disabled:this.state.pending||!this.valid()||!this.state.username||!this.state.password,onClick:function(t){return e.submit(t)},type:"submit"},r.a.createElement("i",{className:"icon add user"})," Create")))}}]),n}(a.Component)),Ta=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s-1,onClick:function(n){return t.open(e)},type:"submit",icon:"cancel"})})}},{key:"changeUserPasswordButton",value:function(e){if(!window.halinContext.isEnterprise())return"";var t=r.a.createElement(W.a,{compact:!0,type:"submit",icon:"key"});return r.a.createElement(F.a,{closeIcon:!0,trigger:t},r.a.createElement(F.a.Header,null,"Change Password for User ",e.username),r.a.createElement(F.a.Content,null,r.a.createElement(Ta,e)))}},{key:"changePassword",value:function(e){console.log("Change Password",e)}},{key:"refresh",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state.refresh+1;this.setState({refresh:e,childRefresh:e,error:null})}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){this.state.refresh!==e.refresh&&this.refresh(e.refresh)}},{key:"deleteUser",value:function(e){var t=this;return I.info("DELETE USER ",e),window.halinContext.getClusterManager().deleteUser(e).then((function(n){I.info("ClusterMgr result",n);var a="Deleting user ".concat(e.username);n.success?t.setState({pending:!1,error:null}):t.setState({pending:!1,error:ln.fromClusterOp(a,n)})})).catch((function(n){return t.setState({pending:!1,error:ln.message("Error","Could not delete user ".concat(e.username,": ").concat(n))})})).finally((function(){return t.state.error?ln.toastify(t):null}))}},{key:"downloadCSVButton",value:function(){return this.state.data&&0!==this.state.data.length?r.a.createElement(Ea,{title:"Download",filename:"Halin-neo4j-users-".concat(le.a.utc().format(),".csv"),data:this.state.data,displayColumns:this.displayColumns}):""}},{key:"addUserButton",value:function(){var e=this;return r.a.createElement(F.a,{closeIcon:!0,trigger:r.a.createElement(W.a,{primary:!0},r.a.createElement(_n.a,{name:"add",color:"green"})," Add User")},r.a.createElement(F.a.Header,null,"Create New User"),r.a.createElement(F.a.Content,null,r.a.createElement(wa,{node:this.props.node,onUserCreate:function(){return e.refresh()}})))}},{key:"manageRolesButton",value:function(){var e=this;return window.halinContext.supportsRoles()?r.a.createElement(W.a,{onClick:function(t){return e.openAssign()}},r.a.createElement("i",{className:"icon user"})," Manage"):""}},{key:"render",value:function(){var e=this;return r.a.createElement("div",{className:"Neo4jUsers"},r.a.createElement("h3",null,"Users ",r.a.createElement(Gn,{knowledgebase:"Users"})),r.a.createElement(Bn.a,null,r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(Bn.a.Column,null,r.a.createElement(W.a.Group,{size:"small"},this.addUserButton(),this.manageRolesButton(),this.downloadCSVButton(),r.a.createElement(W.a,{onClick:function(t){return e.refresh()},icon:"refresh"})))),window.halinContext.supportsRoles()?r.a.createElement(Sa,{key:this.key,node:this.props.node,open:this.state.assignOpen,onCancel:this.closeAssign,onConfirm:this.confirmRoleAssignment}):"",r.a.createElement(Pn.a,{header:"Delete User",content:"Are you sure? This action cannot be undone!",open:this.state.confirmOpen,onCancel:this.close,onConfirm:this.confirm}),r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(Bn.a.Column,null,r.a.createElement(Ca,{node:this.props.node,onUpdate:this.onRecordsUpdate,showPagination:!0,query:this.query,refresh:this.state.childRefresh,defaultPageSize:10,database:An.driver.SYSTEM_DB,displayColumns:this.displayColumns,hideMemberLabel:!0})))))}}]),n}(a.Component),Oa=(n(1554),n(1555),ta(function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(e,a){var r;return Object(_.a)(this,n),(r=t.call(this,e,a)).state={role:null,pending:!1,error:null},r.inputStyle={minWidth:"150px",paddingTop:"10px",paddingBottom:"10px"},r.onRoleCreate=e.onRoleCreate||function(){return null},r}return Object(x.a)(n,[{key:"createRole",value:function(){var e=this;return this.setState({pending:!0}),I.info("Creating role with driver ",this.driver),window.halinContext.getClusterManager().addRole(this.state.role).then((function(t){I.fine("ClusterMgr result",t);var n="Creating role ".concat(e.state.role);t.success?e.setState({pending:!1,error:null}):e.setState({pending:!1,error:ln.fromClusterOp(n,t)})})).catch((function(t){return e.setState({pending:!1,error:ln.message("Error","Could not create role ".concat(e.state.role,": ").concat(t))})})).finally((function(){return e.state.error?ln.toastify(e):null}))}},{key:"formValid",value:function(){return this.state.role}},{key:"submit",value:function(e){I.fine("submit",this.state),e.preventDefault(),this.createRole()}},{key:"handleChange",value:function(e,t){var n={};n[e]=t.target.value,this.setState(n)}},{key:"valid",value:function(){return!this.state.role||this.state.role.match(/^[A-Za-z0-9]+$/)}},{key:"render",value:function(){var e=this;return r.a.createElement("div",{className:"NewRoleForm"},r.a.createElement(q.a,{error:!this.valid(),size:"small",style:{textAlign:"left"}},r.a.createElement(q.a.Group,{widths:"equal"},r.a.createElement(q.a.Input,{fluid:!0,style:this.inputStyle,disabled:this.state.pending,onChange:function(t){return e.handleChange("role",t)},label:"Role Name",placeholder:"myCustomRole"})),r.a.createElement(B.a,{error:!0,header:"Invalid role name",content:"Role names may consist only of simple letters and numbers"}),r.a.createElement(q.a.Button,{positive:!0,style:this.inputStyle,disabled:this.state.pending||!this.valid()||!this.state.role,onClick:function(t){return e.submit(t)},type:"submit"},r.a.createElement("i",{className:"icon add"})," Create")))}}]),n}(a.Component),"Create Roles")),Ra=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(e,a){var r;return Object(_.a)(this,n),(r=t.call(this,e,a)).state={role:null,pending:!1,error:null},r.inputStyle={minWidth:"150px",paddingTop:"10px",paddingBottom:"10px"},r.onRoleCreate=e.onRoleCreate||function(){return null},r}return Object(x.a)(n,[{key:"createRole",value:function(){var e=this;return this.setState({pending:!0}),I.info("Creating role copy with driver ",this.driver),window.halinContext.getClusterManager().copyRole(this.props.role,this.state.role).then((function(t){I.fine("ClusterMgr result",t);var n="Creating role ".concat(e.state.role);t.success?e.setState({pending:!1,error:null}):e.setState({pending:!1,error:ln.fromClusterOp(n,t)})})).catch((function(t){return e.setState({pending:!1,error:ln.message("Error","Could not create role ".concat(e.state.role,": ").concat(t))})})).finally((function(){return e.state.error?ln.toastify(e):null}))}},{key:"formValid",value:function(){return this.state.role}},{key:"submit",value:function(e){I.fine("submit",this.state),e.preventDefault(),this.createRole()}},{key:"handleChange",value:function(e,t){var n={};n[e]=t.target.value,this.setState(n)}},{key:"valid",value:function(){return!this.state.role||this.state.role.match(/^[A-Za-z0-9]+$/)}},{key:"preview",value:function(){return"CREATE ROLE `".concat(this.state.role||"(enter role below)","` AS COPY OF `").concat(this.props.role,"`")}},{key:"render",value:function(){var e=this;return r.a.createElement("div",{className:"CopyRoleForm"},r.a.createElement(q.a,{error:!this.valid(),size:"small",style:{textAlign:"left"}},r.a.createElement(q.a.Group,null,r.a.createElement("h3",null,"Preview"),r.a.createElement("h4",null,this.preview())),r.a.createElement(q.a.Group,{widths:"equal"},r.a.createElement(q.a.Input,{fluid:!0,style:this.inputStyle,disabled:this.state.pending,onChange:function(t){return e.handleChange("role",t)},label:"Role Name",placeholder:"myCustomRole"})),r.a.createElement(B.a,{error:!0,header:"Invalid role name",content:"Role names may consist only of simple letters and numbers"}),r.a.createElement(q.a.Button,{positive:!0,style:this.inputStyle,disabled:this.state.pending||!this.valid()||!this.state.role,onClick:function(t){return e.submit(t)},type:"submit"},r.a.createElement("i",{className:"icon copy"})," Copy")))}}]),n}(a.Component);Ra.props={role:un.a.string.isRequired};var Aa=ta(Ra,"Copy Role"),ja=function(e){return r.a.createElement(F.a,{closeIcon:!0,trigger:r.a.createElement(W.a,{compact:!0,icon:"copy",type:"submit"})},r.a.createElement(F.a.Header,null,"Copy Role: ",e.role),r.a.createElement(F.a.Content,null,r.a.createElement(Aa,{role:e.role})))},Da=ta(function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i=4?ja(a):"")}},{Header:"Role",accessor:"role"},{Header:"Users",accessor:"users",Cell:function(e){var t=e.row;return t.users.map((function(e,n){return r.a.createElement("div",{className:"user",key:n},e,n0&&void 0!==arguments[0]?arguments[0]:this.state.refresh+1;this.setState({refresh:e,childRefresh:e,message:null,error:null})}},{key:"addRoleButton",value:function(){var e=this;return r.a.createElement(F.a,{closeIcon:!0,trigger:r.a.createElement(W.a,{primary:!0},r.a.createElement(_n.a,{name:"add",color:"green"})," Add Role")},r.a.createElement(F.a.Header,null,"Create New Role"),r.a.createElement(F.a.Content,null,r.a.createElement(Oa,{node:this.props.node,onUserCreate:function(){return e.refresh()}})))}},{key:"deleteRole",value:function(e){var t=this;return I.info("DELETE ROLE",e),window.halinContext.getClusterManager().deleteRole(e.role).then((function(n){I.fine("ClusterMgr result",n);var a="Deleting role ".concat(e.role);n.success?t.setState({pending:!1,error:null}):t.setState({pending:!1,error:ln.fromClusterOp(a,n)})})).catch((function(n){return t.setState({pending:!1,error:ln.message("Error","Could not delete role ".concat(e.role,": ").concat(n))})})).finally((function(){return t.state.error?ln.toastify(t):null}))}},{key:"downloadCSVButton",value:function(){return this.state.data&&0!==this.state.data.length?r.a.createElement(Ea,{title:"Download",filename:"Halin-neo4j-roles-".concat(le.a.utc().format(),".csv"),data:this.state.data,displayColumns:this.displayColumns}):""}},{key:"render",value:function(){var e=this;return r.a.createElement("div",{className:"Neo4jRoles"},r.a.createElement("h3",null,"Roles ",r.a.createElement(Gn,{knowledgebase:"Roles"})),r.a.createElement(Bn.a,null,r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(Bn.a.Column,null,r.a.createElement(W.a.Group,{size:"small"},this.addRoleButton(),this.downloadCSVButton(),r.a.createElement(W.a,{onClick:function(t){return e.refresh()},icon:"refresh"})))),r.a.createElement(Pn.a,{header:"Delete Role",content:"Are you sure? This action cannot be undone. If you delete this role, all users currently assigned to this role will lose it.",open:this.state.confirmOpen,onCancel:this.close,onConfirm:this.confirm}),r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(Bn.a.Column,null,r.a.createElement(Ca,{node:this.props.node,query:this.query,showPagination:!0,refresh:this.state.childRefresh,displayColumns:this.displayColumns,database:An.driver.SYSTEM_DB,defaultPageSize:10,onUpdate:this.onRecordsUpdate,hideMemberLabel:!0})))))}}],[{key:"canDelete",value:function(e){return-1===An.driver.systemRoles.indexOf(e)}}]),n}(a.Component)),Na={ACCCESS:"ACCESS",START:"START",STOP:"STOP",CREATE_INDEX:"CREATE INDEX",DROP_INDEX:"DROP INDEX",INDEX_MANAGEMENT:"INDEX MANAGEMENT",CREATE_CONSTRAINT:"CREATE CONSTRAINT",DROP_CONSTRAINT:"DROP CONSTRAINT",CONSTRAINT_MANAGEMENT:"CONSTRAINT MANAGEMENT",CREATE_LABEL:"CREATE NEW NODE LABEL",CREATE_RELATIONSHIP:"CREATE NEW RELATIONSHIP TYPE",CREATE_PROPERTY:"CREATE NEW PROPERTY NAME",NAME_MANAGEMENT:"NAME MANAGEMENT",ALL:"ALL DATABASE PRIVILEGES"},Ma=function(){function e(t){Object(_.a)(this,e),this.operation=t.operation,this.privilege=t.privilege,this.database=t.database,this.entity=t.entity,this.role=t.role}return Object(x.a)(e,[{key:"properties",value:function(){return{operation:this.operation,privilege:this.privilege,database:this.database||this.graph,graph:this.graph,entity:this.entity,role:this.role}}},{key:"validate",value:function(){var e=this,t=null;return["operation","privilege","database","entity","role"].forEach((function(n){e[n]||(t="Missing key ".concat(n))})),t}},{key:"buildQuery",value:function(){var t=this.operation,n=this.privilege,a="*"===this.database?this.database:"`".concat(this.database,"`"),r="DATABASE"===this.entity?"":this.entity,s=this.role,i="*"===a?"GRAPHS":"GRAPH";e.isDatabaseOperation(n)&&(i="DATABASE");var o="REVOKE"===t?"FROM":"TO";return n.indexOf("WRITE")>-1?"".concat(t," ").concat(n," ON ").concat(i," ").concat(a," ").concat(o," ").concat(s):Object.values(e.DATABASE_OPERATIONS).indexOf(n)>-1?"".concat(t," ").concat(n," ON DATABASE ").concat(a," ").concat(o," ").concat(s):"".concat(t," ").concat(n," ON ").concat(i," ").concat(a," ").concat(r," ").concat(o," ").concat(s)}}],[{key:"isDatabaseOperation",value:function(t){return Object.values(e.DATABASE_OPERATIONS).indexOf(t)>-1}},{key:"allowsEntity",value:function(t){return"WRITE"!==t&&!e.isDatabaseOperation(t)}},{key:"fromSystemPrivilege",value:function(t,n){var a,r=(a=n.action,{read:"READ",write:"WRITE",find:"TRAVERSE",create_propertykey:Na.CREATE_PROPERTY,create_reltype:Na.CREATE_RELATIONSHIP,create_label:Na.CREATE_LABEL,drop_constraint:Na.DROP_CONSTRAINT,constraint_management:Na.CONSTRAINT_MANAGEMENT,create_constraint:Na.CREATE_CONSTRAINT,create_index:Na.CREATE_INDEX,drop_index:Na.DROP_INDEX,name_management:Na.NAME_MANAGEMENT,start_database:Na.START,stop_database:Na.STOP,access:Na.ACCCESS}[a.toLowerCase()]||a.toUpperCase()),s=function(e){var t={graph:"",all_properties:"{*}"}[e];if(!d.a.isNil(t))return t;var n=new RegExp("property\\((?.*?)\\)"),a=e.match(n);return a&&a.groups&&a.groups.list?"(".concat(a.groups.list,")"):t||""}(n.resource),i=s&&this.allowsEntity(r)?"".concat(r," ").concat(s):r;return new e({operation:t,database:n.graph,entity:function(e){var t=new RegExp("(?(NODE|RELATIONSHIP))\\((?.*?)\\)"),n=e.match(t);return n&&n.groups&&n.groups.list?"".concat(n.groups.element,"S ").concat(n.groups.list):"DATABASE"}(n.segment),role:n.role,privilege:i})}}]),e}();Ma.OPERATIONS={GRANT:"GRANT",REVOKE:"REVOKE",DENY:"DENY"},Ma.DATABASE_OPERATIONS=Na,Ma.PRIVILEGES={TRAVERSE:"TRAVERSE",READ_ALL:"READ {*}",MATCH_ALL:"MATCH {*}",WRITE:"WRITE"},Ma.ENTITIES={ALL_NODES:"NODES *",ALL_RELS:"RELATIONSHIPS *",ALL_ELEMENTS:"ELEMENTS *"},Ma.VALID_OPERATIONS=["GRANT","REVOKE","DENY"],Ma.VALID_PRIVILEGES=["TRAVERSE","READ {*}","MATCH {*}","WRITE"].concat(Object.values(Ma.DATABASE_OPERATIONS)),Ma.VALID_ENTITIES=["NODES *","RELATIONSHIPS *","ELEMENTS *"];var Ia=function(e){return{key:ue.a.v4(),text:e,value:e}},_a=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(e,a){var r;return Object(_.a)(this,n),(r=t.call(this,e,a)).state={pending:!1,message:null,error:null,formError:null,operation:Ma.OPERATIONS.GRANT,privilege:Ma.PRIVILEGES.TRAVERSE,entity:Ma.ENTITIES.ALL_NODES,role:"admin",op:null,operations:Ma.VALID_OPERATIONS.map(Ia),privileges:Ma.VALID_PRIVILEGES.map(Ia),entities:Ma.VALID_ENTITIES.map(Ia)},r.inputStyle={minWidth:"150px",paddingTop:"10px",paddingBottom:"10px"},r.onModify=e.onModify||function(){return null},r}return Object(x.a)(n,[{key:"valid",value:function(){return this.state.op&&d.a.isNil(this.state.op.validate())}},{key:"UNSAFE_componentWillMount",value:function(){var e=this,t=window.halinContext.getClusterManager();return this.setState({pending:!0}),t.getRoles().then((function(t){var n=t.map((function(e){return Ia(e.role)})),a=window.halinContext.databases().map((function(e){return Ia(e.getLabel())})).concat([Ia("*")]),r=e.props.database||a[0].value,s=e.props.role||n[0].value,i=e.props.privilege||"TRAVERSE",o=(e.props.operation||"").toUpperCase()||"GRANT",l=e.props.entity||"NODES *",c=new Ma({database:r,role:s,privilege:i,operation:o,entity:l});return e.setState({database:r,role:s,privilege:i,operation:o,entity:l,op:c,roles:n,databases:a})})).catch((function(e){I.error("Failed to get roles for pre-population",e)})).finally((function(){return e.setState({pending:!1})}))}},{key:"submit",value:function(e){var t=this;I.fine("submit",this.state),e.preventDefault();var n=window.halinContext.getClusterManager(),a=this.state.op.buildQuery();return n.alterPrivilege(this.state.op).then((function(e){t.setState({pending:!1,message:ln.fromClusterOp(a,e),error:null})})).catch((function(e){I.error("Privilege Error",e),t.setState({pending:!1,message:null,error:ln.message("Error","Could not ".concat(a,": ").concat(e))})})).finally((function(){return ln.toastify(t)}))}},{key:"handleChange",value:function(e,t,n){console.log("handleChange",e,n.value);var a=d.a.pick(this.state,["operation","privilege","database","entity","role"]),r=d.a.merge(a,Object(H.a)({},e,n.value)),s=new Ma(r);r.op=s,this.setState(r)}},{key:"queryBuilderFormGroup",value:function(){var e=this;return r.a.createElement(q.a.Group,{widths:"equal"},r.a.createElement(q.a.Select,{fluid:!0,options:this.state.operations,placeholder:"Operation",style:this.inputStyle,disabled:this.state.pending,defaultValue:this.state.operation,label:"Action",onChange:function(t,n){return e.handleChange("operation",t,n)}}),r.a.createElement(q.a.Select,{fluid:!0,options:this.state.privileges,style:this.inputStyle,disabled:this.state.pending,defaultValue:this.state.privilege,onChange:function(t,n){return e.handleChange("privilege",t,n)},label:"Privilege",placeholder:"MATCH (*)"}),r.a.createElement(q.a.Select,{fluid:!0,options:this.state.databases,style:this.inputStyle,disabled:this.state.pending,defaultValue:this.state.database,onChange:function(t,n){return e.handleChange("database",t,n)},label:"ON DATABASE"}),r.a.createElement(q.a.Select,{fluid:!0,options:this.state.entities,style:this.inputStyle,disabled:this.state.pending||!Ma.allowsEntity(this.state.privilege),defaultValue:this.state.entity,onChange:function(t,n){return e.handleChange("entity",t,n)},label:"Entity"}),r.a.createElement(q.a.Select,{fluid:!0,options:this.state.roles,placeholder:"role",label:"TO ROLE",style:this.inputStyle,disabled:this.state.pending,defaultValue:this.state.role,onChange:function(t,n){return e.handleChange("role",t,n)}}))}},{key:"render",value:function(){var e=this;if(this.state.pending)return r.a.createElement(hn,null);var t="DENY"===this.state.operation||"REVOKE"===this.state.operation;return r.a.createElement("div",{className:"AlterPrivilegeForm"},r.a.createElement(q.a,{size:"small",error:!this.valid(),style:{textAlign:"left"}},r.a.createElement(q.a.Group,null,r.a.createElement("h3",null,"Preview"),r.a.createElement("h4",null,new Ma(this.state).buildQuery())),this.props.locked?"":this.queryBuilderFormGroup(),r.a.createElement(q.a.Button,{positive:!t,negative:t,style:this.inputStyle,disabled:this.state.pending||!this.valid(),onClick:function(t){return e.submit(t)},type:"submit"},r.a.createElement("i",{className:"icon lock"})," Alter Privileges")))}}]),n}(a.Component),xa=function(e){var t="tiny"===e.button.size||e.button.compact?r.a.createElement(W.a,Object.assign({},e.button||{},{icon:e.icon})):r.a.createElement(W.a,e.button||{},r.a.createElement(_n.a,{name:e.icon}),e.label);return r.a.createElement(F.a,{closeIcon:!0,trigger:t},r.a.createElement(F.a.Header,null,e.label),r.a.createElement(F.a.Content,null,r.a.createElement(_a,e.privilege)))};xa.props={label:un.a.string.isRequired,privilege:un.a.object.isRequired,icon:un.a.string.isRequired};var La=xa,Pa=function(e){return{compact:!0,negative:!0,size:"tiny",disabled:An.driver.systemRoles.indexOf(e.role)>-1}},Ha=function(e){return d.a.merge(d.a.cloneDeep(Pa(e)),{negative:null,positive:!0})},Fa=function(){return[{Header:"Actions",id:"delete",minWidth:70,maxWidth:100,Cell:function(e){var t=e.row,n=Ma.fromSystemPrivilege("DENY",t),a=Ma.fromSystemPrivilege("REVOKE",t),s=Ma.fromSystemPrivilege("GRANT",t);return"GRANTED"===t.access?r.a.createElement("span",null,r.a.createElement(La,{label:"Deny",privilege:d.a.merge({locked:!0},n.properties()),icon:"lock",button:Pa(t)}),r.a.createElement(La,{label:"Revoke",privilege:d.a.merge({locked:!0},a.properties()),icon:"remove circle",button:Pa(t)})):r.a.createElement(La,{label:"Grant",privilege:d.a.merge({locked:!0},s.properties()),icon:"unlock",button:Ha(t)})}}].concat(d.a.cloneDeep(An.queryLibrary.DBMS_4_SHOW_PRIVILEGES.columns))},qa=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s0&&void 0!==arguments[0]?arguments[0]:this.state.refresh+1;this.setState({refresh:e,childRefresh:e,message:null,error:null})}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){this.state.refresh!==e.refresh&&this.refresh(e.refresh)}},{key:"downloadCSVButton",value:function(){return this.state.data&&0!==this.state.data.length?r.a.createElement(Ea,{title:"Download",filename:"Halin-neo4j-privileges-".concat(le.a.utc().format(),".csv"),data:this.state.data,displayColumns:this.displayColumns}):""}},{key:"render",value:function(){return r.a.createElement("div",{className:"Neo4jPrivileges"},r.a.createElement("h3",null,"Privileges ",r.a.createElement(Gn,{knowledgebase:"Privileges"})),r.a.createElement(Bn.a,null,r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(Bn.a.Column,null,r.a.createElement(W.a.Group,{size:"small"},r.a.createElement(La,{label:"Grant",privilege:{operation:"GRANT"},icon:"unlock",button:{primary:!0}}),this.downloadCSVButton()))),r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(Bn.a.Column,null,r.a.createElement(Ca,{node:this.props.node,onUpdate:this.onRecordsUpdate,showPagination:!0,query:this.query,database:An.driver.SYSTEM_DB,refresh:this.state.childRefresh,defaultPageSize:10,selectFilter:["access","action","resource","segment","role","graph"],displayColumns:this.displayColumns,hideMemberLabel:!0})))))}}]),n}(a.Component),Ba=Zn(function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s=4;return window.halinContext.supportsRoles()&&s.push(n),i&&o&&s.push(a),r.a.createElement(ca.a,{panes:s,className:"PermissionsPane"})}},{key:"__render",value:function(){var e=window.halinContext.isEnterprise(),t=e?2:1;return r.a.createElement("div",{className:"PermissionsPane"},r.a.createElement(Bn.a,{divided:"vertically"},r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(Bn.a.Column,null,r.a.createElement("h3",null,"Permissions Management",r.a.createElement(Gn,{knowledgebase:"UserManagement"})))),r.a.createElement(Bn.a.Row,{columns:t},r.a.createElement(Bn.a.Column,null,r.a.createElement(ka,{key:this.state.key,node:this.props.node,refresh:this.state.childRefresh})),e?r.a.createElement(Bn.a.Column,null,r.a.createElement(Da,{key:this.state.key,node:this.props.node,refresh:this.state.childRefresh})):""),r.a.createElement(Bn.a.Row,null,r.a.createElement(Bn.a.Column,null,r.a.createElement(qa,{key:this.state.key,node:this.props.node,refresh:this.state.childRefresh})))))}}]),n}(a.Component)),Ua=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s-1},columns:e,sortable:!0,filterable:!0,defaultPageSize:10,showPagination:!0}))}}]),n}(a.Component),Wa=n(1680),za=(n(1563),function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){return Object(_.a)(this,n),t.apply(this,arguments)}return Object(x.a)(n,[{key:"render",value:function(){An.sentry.fine("build",en);var e=le.a.utc(en.date).format("YYYY-MM-DD");return r.a.createElement(Yn,{header:"About Halin v".concat(c.version),className:"AppFooter"},r.a.createElement("p",null,r.a.createElement(z.a,{style:{display:"block",marginLeft:"auto",marginRight:"auto"},src:"favicon-32x32.png"})),r.a.createElement("strong",null,"As of June 2021, Halin version 0.16.0 and Neo4j 4.3.0 halin is now deprecated, and will not support all 4.3.0+ features; you may encounter incompatibilities."),r.a.createElement(Wa.a,null,r.a.createElement(Wa.a.Item,null,r.a.createElement("a",{target:"halindocs",href:"https://moxious.github.io/halin/"},"Documentation")),r.a.createElement(Wa.a.Item,null,r.a.createElement("a",{target:"halindocs",href:"https://github.com/moxious/halin/blob/master/release-notes.md#halin-release-notes"},"Release Notes")),r.a.createElement(Wa.a.Item,null,r.a.createElement("a",{target:"halindocs",href:"https://github.com/moxious/halin"},"Source Code (GitHub)"))),r.a.createElement("p",null,"Build ",r.a.createElement("a",{href:"https://circleci.com/gh/moxious/halin/".concat(en.build)},en.build," on ",e)))}}]),n}(a.PureComponent)),Ga=n(808),Ya=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s=1.5*p?t.push(Qa.warn({addr:n,finding:"Your page cache setting is more than 50% greater than your store on disk size.\n Store size=".concat(p,", page cache ").concat(r," bytes (").concat(a,")"),advice:"You can reduce your page cache size to be more efficient with memory"})):r>=f?t.push(Qa.pass({addr:n,finding:"Your page cache looks appropriately sized considering your store size on disk"})):t.push(Qa.warn({addr:n,finding:"Your page cache setting is too small considering your store size.\n Store size=".concat(p," bytes, page cache ").concat(r," bytes (").concat(a,")"),advice:"Consider increasing your page cache size to improve system performance"}))}})),t}],Xa=function(e){return function(t){return d.a.get(t,"halin.enterprise")?e(t):[]}},$a=function(e,t,n){var a=e.nodes.map((function(e){return e.configuration[t]})),r=d.a.uniq(a);return 1===r.length?[n(Qa.CLUSTER,r[0],e.nodes[0])]:e.nodes.map((function(e){var a=e.configuration[t],r=e.basics.address;return n(r,a,e)}))},Za=[function(e){return function(e){if(!d.a.get(e,"halin.cluster"))return[]}}((function(e){var t=[];return e.nodes.length%2===0?t.push(Qa.warn({addr:Qa.CLUSTER,finding:"You have an even number of cluster nodes (".concat(e.nodes.length,")"),advice:"Consider using an odd number of nodes to better balance"})):t.push(Qa.pass({addr:Qa.CLUSTER,finding:"You have an odd number of cluster nodes (".concat(e.nodes.length,")")})),t})),function(e){var t=[],n=e.nodes.filter((function(e){return e.basics.writer}));return 1===n.length?t.push(Qa.pass({addr:Qa.CLUSTER,finding:"You have exactly 1 writer in your cluster (".concat(n[0].basics.label,"). Good!")})):0===n.length?t.push(Qa.error({addr:Qa.CLUSTER,finding:"Your cluster lacks a member which can write",advice:"This could be evidence of misconfiguration,\n a leader re-election in process, or too many node failures. Investigate!"})):n.length>1&&t.push(Qa.error({addr:Qa.OVERALL,finding:"Your cluster has more than one write member",advice:"This should never occur, and indicates either a bug in Halin or a misconfiguration of\n your cluster. Please investigate."})),t},function(e){var t=[],n="causal_clustering.cluster_routing_ttl";return e.nodes.forEach((function(e){var a=e.basics.address,r=e.configuration[n],s=Se.timeAbbreviation2Milliseconds(r);Number.isNaN(Number(s))?t.push(Qa.error({addr:a,finding:"Configuration key ".concat(n," has an invalid value: ").concat(r),advice:"Consider setting this to the default value ".concat(r)})):s0){var u=Object(ie.a)(l).join(", ");t.push(Qa.error({addr:e,finding:"Machine is missing users ".concat(u," which are defined elsewhere in the cluster"),advice:"Consider creating the appropriate users to sync them across the cluster"}))}else t.push(Qa.pass({addr:e,finding:"Machine has a consistent user set"}));if(c.size>0){var d=Object(ie.a)(c).join(", ");t.push(Qa.error({addr:e,finding:"Machine is missing roles ".concat(d," which are defined elsewhere in the cluster"),advice:"Consider creating the appropriate roles to sync them across the cluster"}))}else t.push(Qa.pass({addr:e,finding:"Machine has a consistent role set"}))})),t},Xa((function(e){var t=[];return e.nodes.forEach((function(e){var n=e.basics.address,a=e.users.filter((function(e){return e.roles.indexOf("admin")>-1}));0===a.length?t.push(Qa.error({addr:n,finding:"Machine has no admin users",advice:"Ensure system has a user with role admin"})):(t.push(Qa.pass({addr:n,finding:"Machine has admin users specified"})),a.length>5&&t.push(Qa.warn({addr:n,finding:"Machine has a large number (".concat(a.length,") of users with admin privileges"),advice:"Periodically review permissions, and limit users to only the permissions they require"})))})),t}))],ar=[function(e){var t=[];return e.nodes.forEach((function(e){var n=Object.keys(e.configuration),a=e.basics.address;n.forEach((function(n){var r=e.configuration[n];if(d.a.isArray(r)){var s=r.length;t.push(Qa.error({addr:a,finding:"Configuration item ".concat(n," has ").concat(s," values specified"),advice:"Entries should exist in the configuration file only once. Edit your configuration to ensure it is correct"}))}}))})),t}],rr=[function(e){var t=[],n=e.nodes.map((function(e){return e.basics})).map((function(e){return d.a.get(e,"dbms.versions[0]")})),a=d.a.uniq(n);return 1===a.length?t.push(Qa.pass({finding:"All machines are running the same version of Neo4j, ".concat(a[0])})):t.push(Qa.error({finding:"Machines in your cluster are running different versions of Neo4j!\n Detected versions: ".concat(a.join(", "),"\n "),advice:"Consider baselining all machines on one version."})),t}],sr="dbms.security.auth_enabled",ir=[function(e){return $a(e,"browser.retain_connection_credentials",(function(e,t,n){return"false"===t?Qa.pass({addr:e,finding:"Browser does not retain connection credentials, which is a secure configuration"}):Qa.info({addr:e,finding:"Neo4j browser retains connection credentials",advice:"Consider setting configuration browser.retain_connection_credentials=false for security;\n this will force users to log into browser each time they use it."})}))},function(e){return $a(e,"dbms.connector.http.enabled",(function(e,t,n){return"false"===t?Qa.pass({addr:e,finding:"You have disabled HTTP access. Good!"}):Qa.info({addr:e,finding:"You have HTTP enabled (dbms.connector.http.enabled=true)",advice:"Disable HTTP and prefer the use of HTTPS because it encrypts traffic in transit"})}))},function(e){return $a(e,"dbms.jvm.additional",(function(e,t,n){return t&&t.indexOf("com.sun.management.jmxremote.port")>-1?Qa.warn({addr:e,finding:"A remote JMX port is configured in ".concat(t),advice:"Consider disabling remote JMX access to Neo4j and using a different monitoring method for security"}):Qa.pass({addr:e,finding:"Remote JMX access looks like it is not enabled. Good!"})}))},function(e){return $a(e,"dbms.security.auth_lock_time",(function(e,t,n){return!t||t>10||t<3?Qa.info({addr:e,finding:"Your dbms.security.auth_lock_time is set to ".concat(t),advice:"Recommend setting this to a value between 3 and 10 to \n minimize the chances of a successful brute force attack"}):Qa.pass({addr:e,finding:"Your dbms.security.auth_lock_time is appropriately configured"})}))},function(e){return $a(e,"dbms.security.http_access_control_allow_origin",(function(e,t,n){return t&&"*"!==t?Qa.pass({addr:e,finding:"You have CORS headers configured. Good!"}):Qa.info({addr:e,finding:"Configure CORS Headers",advice:"\n Enabling a specific CORS response header \n (dbms.security.http_access_control_allow_origin) limits the ability to \n access the website\n "})}))},function(e){return $a(e,sr,(function(e,t,n){return d.a.isNil(t)?Qa.info({addr:e,finding:"Auth enabled configuration is missing (".concat(sr,") but it defaults to true"),advice:"Consider setting this to true explicitly in your configuration file."}):"false"===t?Qa.error({addr:e,finding:"Database authorization is disabled (".concat(sr,"=false)"),advice:"You should enable database authorization; this configuration makes the database vulnerable to malicious activities. Disabling authentication and authorization is not recommended"}):"true"===t?Qa.pass({addr:e,finding:"Database authentication and authorization support is enabled"}):Qa.error({addr:e,finding:"Configuration parameter ".concat(sr," has an invalid value"),advice:"You should set this parameter to true"})}))},function(e){return $a(e,"browser.credential_timeout",(function(e,t,n){return t?Qa.pass({addr:e,finding:"Browser credential timeouts are configured, which is good!"}):Qa.info({addr:e,finding:"Implement Neo4j browser credential timeouts",advice:"\n Recommend setting browser.credential_timeout=15m. This setting ensures \n that a client using the Neo4j browser will be logged out after \n a period of inactivity.\n "})}))},function(e){return $a(e,"dbms.security.auth_max_failed_attempts",(function(e,t,n){return t&&t>=3&&t<=10?Qa.pass({addr:e,finding:"You have a maximum number of failed user auth attempts configured. Good!"}):Qa.warn({addr:e,finding:"Your dbms.security.auth_max_failed_attempts is set to '".concat(t,"'"),advice:"Set this to a value between 3 and 10 to minimize the chances of brute force password attack"})}))},function(e){return $a(e,"dbms.connector.bolt.tls_level",(function(e,t,n){return"REQUIRED"===t?Qa.pass({addr:e,finding:"You have configured TLS to be required for bolt connections. Good!"}):Qa.info({addr:e,finding:"You have configured TLS for bolt connections to be ".concat(t),advice:"\n Recommend this be set to REQUIRED. The bolt protocol can operate either \n encrypted or unencrypted. \n This setting ensures that unencrypted mode may not be used by clients. \n This in turn ensures that unencrypted data and authorization information \n never crosses the wire.\n "})}))},function(e){return $a(e,"dbms.security.http_strict_transport_security",(function(e,t,n){return t?Qa.pass({addr:e,finding:"You have HTTP Strict-Transport-Security (HSTS) Response headers configured. Good!"}):Qa.info({addr:e,finding:"Set HTTP Strict-Transport-Security (HSTS) Response Header",advice:"\n The HTTP Strict-Transport-Security (HSTS) header tells browsers that a \n webpage should only be accessed using HTTPS instead of HTTP. It is \n attached to every HTTPS response. Enabling the HSTS Response \n Header ensures that the browser is only available via HTTPS. \n "})}))},function(e){return $a(e,"dbms.security.auth_provider",(function(e,t,n){return"ldap"!==t?Qa.info({addr:e,finding:"You are not using an LDAP auth provider.",advice:"Consider using an LDAP provider. \n An LDAP auth provider provides stronger user management (disable users, \n password changes, password complexity, etc.) than available with Neo4j \n native users. It also streamlines the user management across a cluster, as \n Neo4j does not centralize management of native users.\n "}):Qa.pass({addr:e,finding:"You are using the LDAP auth provider. Good!"})}))}],or=[function(e){var t=[];return e.nodes.forEach((function(e){var n=e.basics.address;d.a.get(e,"basics.dbms.apoc")?t.push(Qa.pass({addr:n,finding:"You are using APOC. Good!"})):t.push(Qa.info({addr:n,finding:"You are not using APOC",advice:"Consider installing it to add features to your database! https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases"}))})),t}],lr=[function(e){var t=[];if(1===e.nodes.length)return t.push(Qa.pass({finding:"All cluster members are even in transaction replication"})),t;var n=function(e){var t=function(e){return d.a.get(e,"lastTXID.value")||0},n=e.nodes.filter((function(e){return e.basics.writer}))[0]||e.nodes[0],a=t(n),r=e.nodes.filter((function(e){return e!==n})),s=function(e){return{member:e,value:t(e),laggingBy:a-t(e)}},i=r.filter((function(e){return t(e)===a})).map(s),o=r.filter((function(e){return t(e)a})).map(s);return{leader:s(n),even:i,behind:o,ahead:l}}(e),a=n.leader,r=a.member.basics.address,s=a.value;return t.push(Qa.info({addr:r,finding:"Last Transaction ID is ".concat(s)})),n.even.forEach((function(e){t.push(Qa.pass({addr:e.member.basics.address,finding:"This member is even with transaction replication at TXID ".concat(s,". Good!")}))})),n.behind.forEach((function(e){var n=e.member.basics.address,a=e.laggingBy>=20?Qa.ERROR:Qa.WARN;t.push(new Qa({level:a,addr:n,finding:"This member is lagging the leader by ".concat(e.laggingBy," transactions"),advice:"Small amounts of lag indicate regular cluster replication; larger amounts may indicate\n a network or configuration problem, and may result in stale data on querying this member"}))})),n.ahead.forEach((function(e){var n=e.member.basics.address;t.push(Qa.error({addr:n,finding:"This member is ahead of the leader by ".concat(-1*e.laggingBy," transactions"),advice:"This should never occur. Either Halin has incorrectly determined the cluster leader,\n or your database is misconfigured. This should be investigated."}))})),t}],cr=[function(e){var t=[];return e.nodes.forEach((function(e){var n=e.basics.address,a=e.configuration["dbms.tx_log.rotation.retention_policy"];a&&"7 days"!==a?t.push(Qa.pass({addr:n,finding:"You have customized the default transaction log retention policy. That's good!"})):t.push(Qa.warn({addr:n,finding:"The log rotation policy is set to the default; TX logs can become\n large, and this may contribute to full disk errors.\n\n Generally speaking, you should set this parameter to slightly larger than the \n interval for incremental backups. If their schedule is a full backup on \n Sunday and incrementals Monday-Saturday, so as to support incremental \n backup we really only need to set this parameter to 1 days, or for \n extra safety for if/when an incremental fails set it to 2 days\n ",advice:"Consult https://neo4j.com/docs/operations-manual/3.5/configuration/transaction-logs/ for more information"}))})),t}],ur=[function(e){var t=[];return e.nodes.forEach((function(n){var a=n.basics.address;if("high_limit"===(n.configuration["dbms.record_format"]||"standard"))return t.push(Qa.info({addr:a,finding:"You are using dbms.record_format=high limit"})),null;e.databases.filter((function(e){return-1!==e.nodeCount})).forEach((function(e){var n=e.nodeCount,r=e.name;if(n>=306e8)t.push(Qa.warn({addr:a,database:r,finding:"On database ".concat(r," you have almost exhausted the number of available IDs"),advice:"Change dbms.record_format to high_limit; see https://neo4j.com/docs/operations-manual/current/reference/configuration-settings/#config_dbms.record_format for more details"}));else{var s=Se.roundPct(n/306e8);t.push(Qa.pass({addr:a,database:r,finding:"Database ".concat(r," has ").concat(n," nodes, or ").concat(s,"% of the threshold limit"),advice:"No action needed; see https://neo4j.com/docs/operations-manual/current/reference/configuration-settings/#config_dbms.record_format for what this is about"}))}}))})),t}],dr=function(e,t){return e.map((function(e){return function(e,n){return function(n){return(e(n)||[]).map((function(e){return e.category=t,e}))}}(e)}))},mr=[].concat(Object(ie.a)(dr([function(e){return[Qa.info({addr:Qa.CLUSTER,finding:"You're running Halin ".concat(e.halin.version,", good for you!"),advice:"You're already ahead of the game."})]}],"General")),Object(ie.a)(dr(Ka,"Memory")),Object(ie.a)(dr(Za,"Cluster")),Object(ie.a)(dr(rr,"Cluster")),Object(ie.a)(dr(er,"Network")),Object(ie.a)(dr(tr,"Graph Schema")),Object(ie.a)(dr(nr,"Users")),Object(ie.a)(dr(ar,"Configuration")),Object(ie.a)(dr(ir,"Security")),Object(ie.a)(dr(or,"Plugins")),Object(ie.a)(dr(lr,"Transactions")),Object(ie.a)(dr(cr,"Disk")),Object(ie.a)(dr(ur,"Storage"))),hr=function(e){if(d.a.isNil(e)||!d.a.isObject(e)||!e.halin)throw new Error("Invalid diagnostics package");return d.a.flatten(mr.map((function(t){return t(e)}))).filter((function(e){return e}))},pr=function(e){return function e(t,n,a,r){if(se.isNeo4jInt(a))return se.handleNeo4jInt(a);var s=!1;if(d.a.each(a,(function(i,o){o===t?s=!0:d.a.isArray(i)?a[o]=i.map((function(a,s){return e(t,n,a,"".concat(r,"[").concat(s,"]"))})):se.isNeo4jInt(i)?a[o]=se.handleNeo4jInt(i):d.a.isObject(i)&&(a[o]=e(t,n,i,"".concat(r,".").concat(o)))})),s){var i=d.a.cloneDeep(a);return i[t]=n,i}return a}("password","********",d.a.cloneDeep(e),"")},fr=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.catch((function(t){return I.reportError(t,e),n}))},gr=function(e,t,n,a){return function(){return e.run(n,{}).then((function(e){return 0===e.records.length?null:e.records[0].get("value")})).catch((function(e){return"".concat(e)})).then((function(e){var n={};return n[t]={},n[t][a]=se.handleNeo4jInt(e),n}))}},vr=function(e,t){var n,a=e.getMemberSet().getStats(),r={basics:t.asJSON(),utilization:a[t.getBoltAddress()]},s=(n=t,function(){var e=n.run(wt.JMX_ALL.query,{}).then((function(e){return se.unpackResults(e,{required:["name","attributes"]})})).then((function(e){return{JMX:pr(e)}}));return fr("Gather JMX",e,{JMX:[]})}),i=function(e,t){return function(){var n={users:[]};if(e.supportsAuth()&&e.supportsNativeAuth()){var a=t.run("CALL dbms.security.listUsers()",{},se.SYSTEM_DB).then((function(e){return se.unpackResults(e,{required:["username","flags"],optional:["roles"]})})).then((function(e){return{users:e}}));return fr("Gather Users",a,n)}return K.a.resolve(n)}}(e,t),o=function(e,t){return function(){var n={roles:[]};if(e.isEnterprise()&&e.supportsAuth()){var a=t.run("CALL dbms.security.listRoles()",{},se.SYSTEM_DB).then((function(e){return se.unpackResults(e,{required:["role","users"]})})).then((function(e){return{roles:e}}));return fr("Gather Roles",a,n)}return K.a.resolve(n)}}(e,t),l=function(e,t){return function(){var e=t.run("CALL dbms.listConfig()",{}).then((function(e){var t={};return e.records.forEach((function(e){var n=e.get("name"),a=e.get("value");if(t.hasOwnProperty(n)){var r=t[n];d.a.isArray(r)?r.push(a):t[n]=[r,a]}else se.isInt(a)?t[n]=se.integer.inSafeRange(a)?a.toNumber():se.integer.toString(a):t[n]=a})),t})).then((function(e){return{configuration:e}}));return fr("Gather Configuration",e,{configuration:{}})}}(0,t),c=function(e,t){return function(){var e=t.run(wt.GET_CONSTRAINTS.query,{}).then((function(e){return se.unpackResults(e,{required:["description"]})})).then((function(e){return{constraints:e}}));return fr("Gather Constraints",e,{constraints:[]})}}(0,t),u=function(e,t){return function(){var e=t.run("CALL db.indexes()",{}).then((function(e){return se.unpackResults(e,{optional:["description","label","tokenNames","properties","state","type","provider"]})})).then((function(e){return{indexes:e}}));return fr("Gather Indexes",e,{indexes:[]})}}(0,t),m=[gr(t,"apoc","RETURN apoc.version() as value","version"),gr(t,"nodes","MATCH (n) RETURN count(n) as value","count"),gr(t,"schema","call db.labels() yield label return collect(label) as value","labels"),gr(t,"schema","call db.relationshipTypes() YIELD relationshipType return collect(relationshipType) as value","relationshipTypes"),gr(t,"algo","RETURN algo.version() as value","version"),gr(t,"lastTXID",wt.JMX_LAST_TRANSACTION_ID.query,wt.JMX_LAST_TRANSACTION_ID.columns[0].accessor)],h=[i,o,u,c,s,l].concat(m);return K.a.map(h,(function(e){return e()}),{concurrency:2}).then((function(e){return d.a.merge.apply(d.a,[r].concat(Object(ie.a)(e)))}))},br=function(e){var t={halin:Object(Fn.a)({build:en,cluster:e.isCluster(),enterprise:e.isEnterprise(),nativeAuth:e.supportsNativeAuth(),pollRate:e.getPollRate(),user:e.getCurrentUser(),debug:d.a.get(e,"debug")||!1,eventLog:e.getClusterManager().getEventLog(),drivers:Object.keys(e.drivers).map((function(t){return{node:t,_config:d.a.get(e.drivers[t],"_config")||null}})),dataFeeds:d.a.values(e.dataFeeds).map((function(e){return e.stats()}))},c)};return K.a.resolve(t)},yr=function(e){var t=e.databases().map((function(t){var n=t.getLeader(e,!1);return t.getLabel()===se.SYSTEM_DB?K.a.resolve({nodeCount:-1}):n.run("MATCH (n) RETURN count(n) as n",{},t.getLabel()).then((function(e){return se.unpackResults(e,{required:["n"]})})).then((function(e){return{nodeCount:e[0].n}})).catch((function(e){return I.warn("Failed to run node count on ".concat(n.getBoltAddress()," for ").concat(t.getLabel()),e),{nodeCount:-1}})).then((function(e){return d.a.merge(e,t.asJSON())}))}));return K.a.all(t).then((function(e){return{databases:e}}))},Er=function(){var e=null;try{e=window.neo4jDesktopApi}catch(t){e=null}return e?e.getContext().then((function(e){return{neo4jDesktop:pr(d.a.cloneDeep(e))}})):K.a.resolve({neo4jDesktop:"MISSING"})},Cr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ue.a.v4(),n=K.a.all(e.members().map((function(t){return vr(e,t)}))).then((function(e){return{nodes:e}})),a=K.a.resolve({id:ue.a.v4(),generated:le()().utc().toISOString(),tag:t}),r=br(e),s=yr(e),i=Er();return K.a.all([a,r,s,n,i]).then((function(e){return d.a.merge.apply(d.a,Object(ie.a)(e))}))},Sr=(n(1577),function(e,t){return"all"===e.value||t[e.id]===e.value}),wr=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i-1},sortable:!0,filterable:!0,data:this.props.data,showPagination:!0,defaultPageSize:Math.min(this.props.data.length,10),columns:this.state.displayColumns})):"Loading..."}}]),n}(a.Component),Tr=function(e){var t=Object.keys(e),n=new Set([]),a=null,r={};t.forEach((function(t){var s=e[t],i=new Set(Object.keys(s));Object(ie.a)(i).forEach((function(e){var n="".concat(s[e]);r[e]=r[e]||{},r[e].hasOwnProperty(n)?r[e][n].push(t):r[e][n]=[t]})),n=n||new Set([]),a=a||new Set(Object(ie.a)(i)),n=new Set([].concat(Object(ie.a)(n),Object(ie.a)(i))),a=new Set(Object(ie.a)(a).filter((function(e){return i.has(e)})))}));var s={};t.forEach((function(t){var n=e[t],r=new Set(Object.keys(n));s[t]=Object(ie.a)(new Set(Object(ie.a)(r).filter((function(e){return!a.has(e)}))))}));var i=Object.keys(e).sort(),o=Object(ie.a)(n).sort().map((function(e){var t=r[e],n=Object.keys(t),a={name:e,unanimous:1===n.length};return i.forEach((function(e){n.forEach((function(n){t[n].indexOf(e)>-1&&(a[e]=n)})),a[e]||(a[e]="")})),a}));return{table:o,intersectAll:Object(ie.a)(a),unionAll:Object(ie.a)(n),unique:s,values:r}},kr=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s-1},columns:this.state.displayColumns,data:this.state.diff.table,sortable:!0,filterable:!0,defaultPageSize:20,showPagination:!0}),"I'm here! ",r.a.createElement("pre",{style:{textAlign:"left",maxWidth:800}},JSON.stringify(this.state.diff,null,2))):r.a.createElement("div",{className:"ConfigurationDiff"},r.a.createElement("h4",null,"Configuration Diff"),"No data specified.")}}]),n}(a.Component),Or=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s10,defaultPageSize:Math.min(e.length,10)}))}}]),n}(a.Component),jr=Zn(function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s=75?"green":this.props.strength>25?"yellow":"red",{borderRadius:2,width:"20%",height:"".concat(25*e,"%"),background:this.props.strength>=25*(e-1)+10?t:"lightgrey"}}},{key:"render",value:function(){return r.a.createElement("div",{style:Ir.containerStyle},r.a.createElement("div",{style:this.barStyle(1)}),r.a.createElement("div",{style:this.barStyle(2)}),r.a.createElement("div",{style:this.barStyle(3)}),r.a.createElement("div",{style:this.barStyle(4)}))}}]),n}(a.PureComponent),xr=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s=4)return window.halinContext.getClusterManager().getDatabaseStoreSizes().then((function(t){var n=Object.values(t).reduce((function(e,t){return e+t}),0);e.setState({storeSizes:t,totalSize:n})})).catch((function(t){e.setState({error:t,storeSizes:{}}),An.sentry.error("Error getting store sizes",t)}))}},{key:"componentWillUnmount",value:function(){this.mounted=!1,clearInterval(this.interval)}},{key:"databaseList",value:function(){var e=this,t=this.props.member.getDatabaseRoles(),n=window.halinContext.getDatabaseSet(),a=n.databases().map((function(e){return e.getLabel()}));a.sort();var s=a.map((function(a,s){var i=n.getDatabaseByName(a),o=t[a]||"SINGLE";return r.a.createElement(Wa.a.Item,{key:s},r.a.createElement(qn.a,null,r.a.createElement(Mr,{db:i}),a,d.a.isNil(e.state.storeSizes[a])?"":r.a.createElement(qn.a.Detail,null,Se.humanDataSize(e.state.storeSizes[a])),r.a.createElement(qn.a.Detail,null,o)))}));return r.a.createElement(Wa.a,{style:{textAlign:"left"}},s)}},{key:"render",value:function(){var e={textAlign:"left"};return r.a.createElement(Yn,{owner:this,header:"Overview",knowledgebase:"ClusterMember",id:"MemberOverviewCard"},this.databaseList(),r.a.createElement(Bn.a,null,r.a.createElement(Bn.a.Row,null,r.a.createElement(Bn.a.Column,{width:4},r.a.createElement(_r,{strength:Se.signalStrengthFromFreshRatio(this.state.fresh,this.state.total)})),r.a.createElement(Bn.a.Column,{width:12},r.a.createElement(Wa.a,{style:e},r.a.createElement(Wa.a.Item,null,r.a.createElement(Wa.a.Icon,{name:"tags"}),r.a.createElement(Wa.a.Content,null,this.props.member.id)),this.props.member.groups&&this.props.member.groups.length>0?r.a.createElement(Wa.a.Item,null,r.a.createElement(Wa.a.Icon,{name:"group"}),r.a.createElement(Wa.a.Content,null,this.props.member.groups)):"",r.a.createElement(Wa.a.Item,null,r.a.createElement(Wa.a.Icon,{name:"address book"}),r.a.createElement(Wa.a.Content,null,this.props.member.addresses.join(", "))),this.state.totalSize&&!d.a.isNil(this.state.storeSizes)?r.a.createElement(Wa.a.Item,null,r.a.createElement(Wa.a.Icon,{name:"disk"}),r.a.createElement(Wa.a.Content,null,Se.humanDataSize(this.state.totalSize)," store data on disk")):"")))),r.a.createElement("p",{style:e},this.state.performance.observations.length," observations;\xa0 mean ",Se.roundToPlaces(this.state.performance.mean,0),"ms stdev ",Se.roundToPlaces(this.state.performance.stdev,0),"ms"))}}],[{key:"iconFor",value:function(e){var t,n=(t={},Object(H.a)(t,Ut.ROLE_LEADER,"star"),Object(H.a)(t,Ut.ROLE_FOLLOWER,"circle"),Object(H.a)(t,Ut.ROLE_REPLICA,"copy"),t)[e]||"circle";return r.a.createElement(_n.a,{name:n})}}]),n}(a.Component);xr.props={member:un.a.object.isRequired};var Lr=xr,Pr=An.datautil,Hr=An.timewindow,Fr=An.sentry,qr=An.palette,Br=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(e,a){var r;if(Object(_.a)(this,n),(r=t.call(this,e,a)).state={startTime:new Date,query:null,data:null,events:null,time:new Date,lastDataArrived:new Date,disabled:{},minObservedValue:1/0,maxObservedValue:-1/0,tracker:null,timeRange:null,metadata:!0},r.legendClick=function(e){var t;Fr.debug("Legend clicked",e),r.displayColumns.forEach((function(n,a){n.accessor===e&&(t=a)}));!function(e){var t=d.a.cloneDeep(r.state.disabled);t[e]=!r.state.disabled[e],r.mounted&&r.setState({disabled:t})}(t)},r.handleTimeRangeChange=function(e){r.mounted&&Hr.setTimeWindow(e)},r.handleTrackerChanged=function(e,t){r.mounted&&r.setState({tracker:e,trackerEvent:e&&r.dataSeries.at(r.dataSeries.bisect(e)),trackerX:e&&t(e)})},r.id=ue.a.v4(),!e.query)throw new Error("query is required");if(!e.displayColumns)throw new Error("displayColumns is required");return r.query=e.query,r.rate=e.rate||1e3,r.width=e.width||380,r.min=e.min||function(){return r.state.minObservedValue},r.max=e.max||function(){return r.state.maxObservedValue},r.timeWindowWidth=e.timeWindowWidth||12e4,r.displayColumns=e.displayColumns,r.legendOnlyColumns=e.legendOnlyColumns||[],r.showGrid=!d.a.isNil(e.showGrid)&&e.showGrid,r.showGridPosition=d.a.isNil(e.showGridPosition)?"over":e.showGridPosition,r.startingEnabled=e.startingEnabled||e.displayColumns,r.dateStyle={fontSize:12,color:"#AAA",borderWidth:1,borderColor:"#F4F4F4"},r}return Object(x.a)(n,[{key:"componentDidMount",value:function(){var e=this;this.mounted=!0,this.feed=window.halinContext.getDataFeed({node:this.props.member,query:this.props.query,rate:this.props.rate,windowWidth:this.props.timeWindowWidth,displayColumns:this.props.displayColumns.concat(this.props.legendOnlyColumns||[]),params:{}});this.feed.on("data",(function(t,n){return e.onData(t,n)}));var t={};this.displayColumns.forEach((function(n,a){var r;r=!(e.startingEnabled.filter((function(e){return e.accessor===n.accessor})).length>0),t[a]=r}));var n=this.feed.currentState();this.setState(Object(Fn.a)(Object(Fn.a)({disabled:t},n),{},{startTime:new Date})),this.stream=new Xt.Stream,this.onData(n,this.feed)}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"onData",value:function(e){if(!this.mounted)return null;var t,n,a=.85*this.feed.min(this.displayColumns),r=1.15*this.feed.max(this.displayColumns),s=Math.max(this.state.maxObservedValue,r),i=Math.min(this.state.minObservedValue,a),o=this.feed.feedStartTime.getTime();e.time.getTime()-o>=this.timeWindowWidth?(t=e.time.getTime()-this.timeWindowWidth,n=e.time.getTime()+1e3):(t=o,n=o+this.timeWindowWidth+1e3);var l=new Xt.TimeRange(t,n),c=Object(Fn.a)(Object(Fn.a)({},e),{},{maxObservedValue:s,minObservedValue:i,timeRange:l});this.mounted&&this.setState(c),this.props.onUpdate&&this.props.onUpdate(c)}},{key:"getChartMin",value:function(){return this.mounted?d.a.isFunction(this.min)?this.min(this.state.data[0]):this.min:0}},{key:"getChartMax",value:function(){return this.mounted?d.a.isFunction(this.max)?this.max(this.state.data[0]):this.max:100}},{key:"chooseColor",value:function(e){return d.a.isNil(e)?qr.chooseColor(0):this.state.disabled[e]?"transparent":qr.chooseColor(e)}},{key:"renderLegendOnlyColumns",value:function(){var e=this;return this.legendOnlyColumns&&0!==this.legendOnlyColumns.length&&this.state.data?r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(Bn.a.Column,null,r.a.createElement(Wa.a,null,this.legendOnlyColumns.map((function(t,n){return r.a.createElement(Wa.a.Item,{key:n},t.Header,": ",d.a.get(e.state.data[0],t.accessor))}))))):""}},{key:"displayTimeRange",value:function(){return Hr.displayTimeRange(this.state.timeRange)}},{key:"renderChartMetadata",value:function(){if(!this.state.metadata)return"";var e=r.a.createElement(Bn.a,null,r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(qn.a,null,"Max",r.a.createElement(qn.a.Detail,null,Pr.roundToPlaces(this.getChartMax(),2))),r.a.createElement(qn.a,null,"Min",r.a.createElement(qn.a.Detail,null,Pr.roundToPlaces(this.getChartMin(),2))),r.a.createElement(va,{member:this.props.member})),this.renderLegendOnlyColumns());return r.a.createElement(zn.a,{on:"click",wide:"very",trigger:r.a.createElement(_n.a,{name:"database"}),content:e})}},{key:"heading",value:function(){return this.props.heading?r.a.createElement("h3",null,this.props.heading,this.props.explainer||"",this.renderChartMetadata()):""}},{key:"render",value:function(){var e=this;if(!this.state.events)return"Loading...";var t=Object(Un.styler)(this.displayColumns.map((function(t,n){return{key:t.accessor,color:e.chooseColor(n),width:3}})));return this.dataSeries=new Xt.TimeSeries({name:"Data Series",events:this.state.events.toArray()}),this.state.data&&this.mounted?r.a.createElement("div",{className:"CypherTimeseries"},this.heading(),r.a.createElement(Bn.a,null,r.a.createElement(Bn.a.Row,{columns:1,className:"CypherTimeseriesLegend"},r.a.createElement(Bn.a.Column,null,r.a.createElement(Un.Legend,{type:"swatch",style:t,onSelectionChange:this.legendClick,categories:this.displayColumns.map((function(t,n){return{key:t.accessor,label:t.Header||t.accessor,style:{fill:e.chooseColor(n)}}}))}))),r.a.createElement(Bn.a.Row,{columns:1,className:"CypherTimeseriesContent"},r.a.createElement(Bn.a.Column,{textAlign:"left"},r.a.createElement(Un.ChartContainer,{showGrid:this.showGrid,showGridPosition:this.showGridPosition,width:this.width,enablePanZoom:!0,trackerPosition:this.state.tracker,onTrackerChanged:this.handleTrackerChanged,onTimeRangeChanged:this.handleTimeRangeChange,timeRange:this.displayTimeRange()},r.a.createElement(Un.ChartRow,{height:"150"},r.a.createElement(Un.YAxis,{id:"y",min:this.getChartMin(),max:this.getChartMax(),width:"70",showGrid:!0,type:"linear"}),r.a.createElement(Un.Charts,null,this.displayColumns.map((function(n,a){return r.a.createElement(Un.LineChart,{key:"ct-".concat(a),axis:"y",style:t,columns:[n.accessor],series:e.dataSeries})}))))))))):r.a.createElement(hn,{active:!0})}}]),n}(a.Component);Br.props={member:un.a.object.isRequired,query:un.a.string.isRequired,displayColumns:un.a.array.isRequired};var Ur=Br,Wr=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s0?this.renderPieChart():r.a.createElement("h5",null,"None/Not Enabled"):r.a.createElement(hn,{active:!0}))}}]),n}(a.Component)),ts=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s-1?Se.humanDataSize(t):t},e}return Object(x.a)(n,[{key:"componentDidMount",value:function(){var e=this;this.mounted=!0,this.feed=window.halinContext.getDataFeed(d.a.merge({node:this.props.node},wt.OS_MEMORY_STATS));var t=function(t){if(e.mounted&&t){var n=d.a.cloneDeep(t.data[0]);e.setState({data:n})}};t(this.feed.currentState());this.feed.on("data",(function(e){return t(e)}))}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"render",value:function(){var e=d.a.get(this.state.data,"osName")||"unknown",t=d.a.get(this.state.data,"osVersion")||"unknown",n=d.a.get(this.state.data,"arch")||"unknown",a=d.a.get(this.state.data,"processors")||"unknown",s="".concat(e," v").concat(t," (").concat(n," architecture) with ").concat(a," cores");return this.state.data?r.a.createElement("div",{className:"OSStats",key:this.state.id},r.a.createElement("h4",null,s),r.a.createElement(Bn.a,{className:"OSStats",key:this.state.id},r.a.createElement(Bn.a.Row,{columns:3},r.a.createElement(Bn.a.Column,null,r.a.createElement(es,{dataMeasurement:!0,free:this.state.data.physFree,total:this.state.data.physTotal,label:"Physical Memory"})),r.a.createElement(Bn.a.Column,null,r.a.createElement(es,{dataMeasurement:!0,free:this.state.data.swapFree,total:this.state.data.swapTotal,label:"Swap Memory"})),r.a.createElement(Bn.a.Column,null,r.a.createElement(es,{free:this.state.data.fdOpen,total:this.state.data.fdMax,label:"File Descriptors"}))))):r.a.createElement(hn,{active:!0})}}]),n}(a.Component),ns=function(e){var t=ue.a.v4();return r.a.createElement("div",{className:"OSPage"},r.a.createElement(Bn.a,{divided:"vertically"},r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(Bn.a.Column,null,r.a.createElement(ts,{key:t,node:e.member}))),r.a.createElement(Bn.a.Row,{columns:1},r.a.createElement(Bn.a.Column,null,r.a.createElement(Xr,{key:t,node:e.member})))))};ns.props={member:un.a.object.isRequired};var as=ns,rs=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i-1},data:this.state.surface,sortable:!0,filterable:!0,defaultPageSize:10,showPagination:!0,columns:this.state.displayColumns})):r.a.createElement("div",{className:"CypherSurface"},r.a.createElement(hn,null))}}]),n}(a.Component),ss=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s1&&void 0!==arguments[1]?arguments[1]:"";if(d.a.isNil(e))return null;var n=function(){return t?"".concat(e.operator," (").concat(t,")"):e.operator},a={title:n(),subtitle:"ID ".concat(se.handleNeo4jInt(e.id)),expanded:!0,children:[]};return e.lhs&&a.children.push(this.qepToTreeData(e.lhs,"Left Hand Side")),e.rhs&&a.children.push(this.qepToTreeData(e.rhs,"Right Hand Side")),a.children=a.children.filter((function(e){return e})),a}},{key:"componentDidMount",value:function(){this.setState({treeData:[this.qepToTreeData(this.props.data.qep)]})}},{key:"render",value:function(){return this.state.treeData?r.a.createElement("div",{className:"QueryExecutionPlan"},r.a.createElement("div",{style:{height:400}},r.a.createElement(ls.a,{canDrag:function(){return!1},canDrop:function(){return!1},treeData:this.state.treeData,onChange:this.handleTreeOnChange})),r.a.createElement("h3",null,"Query"),r.a.createElement("pre",{style:cs},this.props.data.query)):""}}]),n}(a.Component),ds=function(e){return r.a.createElement(da.a,{defaultFilterMethod:function(e,t,n){var a=e.pivotId||e.id;return void 0===t[a]||String(t[a]).indexOf(e.value)>-1},sortable:!0,filterable:!0,data:e.data,showPagination:!0,defaultPageSize:Math.min(e.data.length,10),className:"-striped -highlight",columns:e.displayColumns})};ds.props={data:un.a.object.isRequired,displayColumns:un.a.arrayOf(un.a.object).isRequired};var ms=ds,hs=function(e){return r.a.createElement(q.a.Select,Object.assign({},e,{placeholder:"Select Database",options:window.halinContext.databases().map((function(e,t){return{key:e.getLabel(),value:e.getLabel(),text:e.getLabel(),disabled:e.getLabel()===se.SYSTEM_DB}}))}))},ps=(n(1645),n(1683)),fs=n(1674),gs="Collector stopped",vs="Gathering statistics...",bs=ea(function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i0&&void 0!==arguments[0])||arguments[0];return!!this.collector&&this.collector.stop().then((function(){return I.fine("Stopped collecting"),e.mounted&&e.setState({status:vs}),t?e.collector.stats():null})).then((function(t){e.stopAsync(),e.mounted&&e.setState({data:t,percent:1,timer:null,error:null,updateInterval:null,status:gs})})).catch((function(t){I.reportError(t,"When stopping collection"),e.stopAsync(),e.mounted&&e.setState({data:null,status:"Error",error:t})}))}},{key:"componentDidMount",value:function(){this.mounted=!0,this.setState({database:window.halinContext.getDatabaseSet().getDefaultDatabase().getLabel()})}},{key:"componentWillUnmount",value:function(){this.mounted=!1,I.fine("SampleQuery is unmounting"),this.stopAsync(),this.stop(!1)}},{key:"start",value:function(){var e=this;return this.collector=new os(this.props.node,this.state.database),this.setState({timer:null,progress:0,updateInterval:null,error:null,data:null,status:"Collecting queries..."}),this.collector.start().then((function(){var t=(new Date).getTime();e.setState({timer:setTimeout((function(){return e.stop()}),e.state.interval),updateInterval:setInterval((function(){var n=((new Date).getTime()-t)/e.state.interval;e.setState({percent:n>=1?.99:n})}),100)})})).catch((function(t){e.mounted&&e.setState({data:null,status:"Error",error:t})}))}},{key:"isRunning",value:function(){return this.collector&&this.collector.isStarted()||this.state.status===vs}},{key:"progressMessage",value:function(){return"Error"===this.state.status?"Error: ".concat(this.state.error):this.state.status}},{key:"progressBar",value:function(){return r.a.createElement("div",{className:"Progress"},r.a.createElement(fs.a,{progress:!0,error:"Error"===this.state.status,success:this.state.status===vs||this.state.status===gs,percent:Math.round(100*this.state.percent),autoSuccess:!0},this.progressMessage()),"Collecting queries..."===this.state.status||this.state.status===vs?r.a.createElement(hn,{text:"\xa0"}):"")}},{key:"filterData",value:function(){return this.state.includeHalinQueries?this.state.data:this.state.data.filter((function(e){return!pe.isDisclaimed(e.query)}))}},{key:"dataTable",value:function(){return this.state.data?r.a.createElement("div",{className:"ViewQueryStats"},r.a.createElement(ms,{data:this.filterData(),displayColumns:this.state.displayColumns})):""}},{key:"validInterval",value:function(){var e=Number(this.state.interval);return this.state.interval&&!Number.isNaN(e)&&e>0}},{key:"render",value:function(){var e=this;return r.a.createElement("div",{className:"SampleQueries"},r.a.createElement("h3",null,"Sample Query Performance ",r.a.createElement(Gn,{knowledgebase:"SampleQueries"})),this.progressBar(),r.a.createElement(q.a,null,r.a.createElement(q.a.Group,{inline:!0},r.a.createElement(q.a.Field,null,r.a.createElement(hs,{defaultValue:window.halinContext.getDatabaseSet().getDefaultDatabase().getLabel(),label:"Sample database:",onChange:this.selectDB})),r.a.createElement(q.a.Field,null,r.a.createElement(q.a.Input,{label:"for: (milliseconds)",name:"lastN",onChange:this.handleChange,style:{width:"100px"},value:this.state.interval})),r.a.createElement(q.a.Field,null,r.a.createElement(U.a,{onChange:this.toggleIncludeHalinQueries,label:"Show Halin Queries",checked:this.state.includeHalinQueries}))),r.a.createElement(q.a.Group,{inline:!0},r.a.createElement(q.a.Field,null,r.a.createElement(W.a,{primary:!0,onClick:function(){return e.start()},disabled:!this.validInterval()||this.isRunning()},r.a.createElement(_n.a,{name:"cogs"}),"Start Collection")),this.state.data?r.a.createElement(q.a.Field,null,r.a.createElement(Ea,{filename:"Halin-querystats-".concat(le.a.utc().format(),".csv"),data:this.filterData(),displayColumns:this.state.displayColumns})):"")),this.dataTable())}}]),n}(a.Component),"Sample Query Performance",!1),ys=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s0&&void 0!==arguments[0]?arguments[0]:-1;n&&a.length>0?(n.data=a,n.text=a.join("\n"),a=[],t.push(n)):0!==e&&console.warn("Finishing entry with no accumulated data on line ",e)};return e.forEach((function(e,t){var s=e.match(ws);if(s){r(t);var i=s[1],o=s[2],l=e.replace(ws,""),c="",u=new RegExp("^(\\[[^\\]]+\\]) "),d=l.match(u);d&&(c=d[1].replace("[","").replace("]",""),l=l.replace(u,"")),n=new Ss({timestamp:i,logLevel:o,classDesignator:c}),a=[l]}else a.push(e)})),r(),t},ks=Ts,Os=function(e){return r.a.createElement("span",{style:{fontFamily:"monospace"}},e)},Rs={textAlign:"left",fontFamily:"monospace",fontSize:"0.8em"},As={textAlign:"left",fontFamily:"monospace",fontSize:"0.8em",overflowWrap:"anywhere",whiteSpace:"unset"},js=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i-1&&t.indexOf("no procedure")?(I.fine("User does not have right version of APOC installed to stream logs"),this.unsupported=!0):I.reportError("Failed to stream logfile",e),this.setState({err:e,loadOp:null,data:null})}},{key:"load",value:function(){var e=this,t='\n CALL apoc.log.stream("'.concat(this.props.file,'", { last: $n }) \n YIELD lineNo, line \n RETURN lineNo, line\n ORDER BY lineNo DESC LIMIT $limit\n ');this.state.partial||(t='\n CALL apoc.log.stream("'.concat(this.props.file,'") \n YIELD lineNo, line \n RETURN lineNo, line\n ORDER BY lineNo DESC LIMIT $limit \n '));var n=parseInt(this.state.lastN,10);Number.isNaN(n)&&(n=20);var a={n:n,limit:$.a.int(5e3)},r=this.props.member.run(t,a).then((function(t){var n=$.a.unpackResults(t,{required:["lineNo","line"]}).reverse(),a=ks(n.map((function(e){return e.line}))),r=d.a.uniq(a.map((function(e){return e.classDesignator}))).sort();e.setState({err:null,data:n,events:a,classDesignators:r,loadOp:null})})).catch((function(t){return e.promiseErrorHandler(t)}));this.setState({loadOp:r})}},{key:"displayError",value:function(){if(!this.state.err)throw new Error("Only call me when error is in state");var e="".concat(this.state.err),t=e.indexOf("No log file exists by that name")>-1?En.LogTroubleshooting:"";return r.a.createElement(B.a,{negative:!0},r.a.createElement(B.a.Header,null,"Error Fetching Log File"),r.a.createElement("p",null,e),t)}},{key:"getData",value:function(){return this.state.parsed?this.state.events:this.state.data}},{key:"getDisplayColumns",value:function(){if(this.state.parsed){var e=this.state.parsedDisplayColumns;return 0===this.state.classDesignators.length||1===this.state.classDesignators.length&&!this.state.classDesignators[0]?e.filter((function(e){return"classDesignator"!==e.accessor})):e}return this.state.rawDisplayColumns}},{key:"render",value:function(){var e=this,t=function(){return r.a.createElement("div",{style:{paddingLeft:"15px",paddingRight:"15px"}},"\xa0")};return r.a.createElement("div",{className:"LogViewer",key:this.state.key},r.a.createElement("h3",null,this.props.file," ",r.a.createElement(Gn,{knowledgebase:this.props.file})),this.state.err?this.displayError():"",r.a.createElement(q.a,null,r.a.createElement(q.a.Field,null,r.a.createElement(q.a.Group,{inline:!0},r.a.createElement(Cs.a,{label:"Everything",name:"howMuch",value:"everything",checked:!this.state.partial,onChange:this.handleChange}),t(),r.a.createElement(Cs.a,{label:"Last few entries",name:"howMuch",value:"partial",checked:this.state.partial,onChange:this.handleChange}),t(),r.a.createElement(q.a.Input,{name:"lastN",onChange:this.handleChange,style:{width:"100px"},value:this.state.lastN}),t(),r.a.createElement(W.a,{primary:!0,icon:!0,labelPosition:"left",onClick:function(){return e.load()},disabled:!d.a.isNil(this.state.loadOp)},r.a.createElement(_n.a,{name:"feed"}),"Load"),r.a.createElement(W.a,{icon:!0,secondary:!0,onClick:function(){return e.download()}},r.a.createElement(_n.a,{name:"download"}),"Download Raw File"),this.state.events?r.a.createElement(Ea,{title:"Download as CSV",filename:"Halin-".concat(this.props.file,"-").concat(le.a.utc().format(),".csv"),data:this.state.events,displayColumns:this.state.parsedDisplayColumns}):"",r.a.createElement(U.a,{checked:this.state.parsed,onChange:this.toggleCheckBox,label:"Parse logs"})))),this.state.loadOp?r.a.createElement(hn,{active:!0}):"",this.state.data?r.a.createElement("div",{className:"LogViewerTable",style:{paddingTop:"15px"}},r.a.createElement(da.a,{defaultFilterMethod:function(e,t){var n=e.pivotId||e.id;return void 0===t[n]||String(t[n]).indexOf(e.value)>-1},data:this.getData(),sortable:!0,filterable:!0,resizable:!0,defaultPageSize:Math.min(20,this.state.lastN),showPagination:!this.state.partial||this.state.lastN>=50,columns:this.getDisplayColumns()})):"")}}]),n}(a.Component),Ds=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s0){var n=t[0];this.numericKeys=Object.keys(n.map).map((function(e){return{key:e,val:d.a.get(n.map,e)}})).filter((function(e){return"count"===e.key||"value"===e.key||d.a.isNumber(e.val)})).map((function(e){return e.key}))}else this.numericKeys=["value"];return r.a.createElement(Hn.a.Group,{className:"MetricsChartContainer"},this.numericKeys.map((function(t,n){return r.a.createElement(Ps,{key:n,mapKey:t,data:e.props.data,timeRange:e.displayTimeRange()})})))}}]),n}(a.PureComponent),qs=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r.a.createElement("div",{className:"MetricDescription"},r.a.createElement("h3",null,"Metric: ",e.metric||"Select a Metric",r.a.createElement(Gn,{intro:r.a.createElement("p",null,En.metricsReference[e.metric]),knowledgebase:"CSVMetrics"})))};qs.props={metric:un.a.string};var Bs=qs,Us=An.sentry,Ws=An.queryLibrary,zs=function(e){return r.a.createElement("span",{style:{fontFamily:"monospace"}},e)},Gs=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s200;return r.a.createElement("div",{style:{paddingLeft:"16px",paddingRight:"16px",paddingTop:"16px",paddingBottom:"16px",overflowX:"scroll"}},r.a.createElement("pre",null,e.currentQuery.slice(0,300)+(t?"\n...(rest ommitted)":"")))}return r.a.createElement("p",null,"Status: ",e.status)}},{key:"kill",value:function(e){var t=this;if(!d.a.get(e,"id"))throw new Error("No valid transaction data");return this.setState({pending:!0}),this.props.member.run("CALL dbms.killTransaction({id})",{id:e.id}).then((function(n){var a=se.unpackResults(n,{required:["transactionId","username","message"]})[0].message,s={header:"Killed transaction ".concat(e.id),body:r.a.createElement("span",null,r.a.createElement("p",null,a),a.indexOf("not found")>-1?r.a.createElement("p",null,"Your transaction may have completed before it could be killed."):"")};return t.setState({pending:!1,message:s,error:null})})).catch((function(e){return console.error("Bad",e),t.setState({pending:!1,message:null,error:ln.message("Failed to kill transaction","".concat(e))})})).finally((function(){return ln.toastify(t)}))}},{key:"render",value:function(){var e=this,t=function(){return e.setState({open:!1})};return r.a.createElement("span",{className:"KillTransaction"},r.a.createElement(W.a,{compact:!0,negative:!0,icon:"delete",onClick:function(){return e.setState({open:!0})}}),r.a.createElement(Pn.a,{header:"Are you sure you want to kill "+this.props.transaction.id+"?",content:this.getContent(),open:this.state.open,onCancel:t,onConfirm:function(){e.kill(e.props.transaction),t()}}))}}]),n}(a.Component),ni=function(e){var t=le.a.utc(e),n=le.a.utc();return le.a.duration(n.diff(t)).asSeconds()+" sec"},ai=function(e,t){var n="".concat(e,".").concat(t);return{Header:n,show:!1,accessor:n}},ri=function(e){var t=e.row;return d.a.get(t,"connection.clientAddress")&&d.a.get(t,"connection.userAgent")?(d.a.get(t,"connection.connector")||"bolt")+"://"+d.a.get(t,"connection.clientAddress")+" ("+d.a.get(t,"connection.userAgent")+")":"unknown"},si=function(e){return d.a.get(e,"major")>=3&&d.a.get(e,"minor")>=5},ii=function(){return!0},oi=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,s=new Array(a),i=0;i=3&&e.minor>=5&&(t=wt.DBMS_35_TASKS.getQuery()),this.setState({query:t,columns:n})}},{key:"render",value:function(){return r.a.createElement("div",{className:"Tasks"},r.a.createElement("h3",null,"Tasks ",r.a.createElement(Gn,{knowledgebase:"Tasks"})),r.a.createElement(Ca,{allowDownloadCSV:!0,node:this.props.member,query:this.state.query,allowColumnSelect:!1,sortable:!0,defaultPageSize:10,filterable:!1,refresh:this.state.childRefresh,displayColumns:this.state.columns,rate:this.rate}))}}]),n}(a.Component);oi.props={member:un.a.object.isRequired};var li=ta(oi,"Tasks"),ci=function(e){var t=le.a.utc(e),n=le.a.utc(),a=le.a.duration(n.diff(t));return Math.floor(a.asSeconds())+" sec"},ui=function(e){return d.a.get(e,"major")>=3&&d.a.get(e,"minor")>=5},di=function(){return!0},mi=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ue.a.v4();return[{menuItem:"Overview",visible:function(){return!0},render:function(){return e.paneWrapper(r.a.createElement(Yr,{key:n,member:t}))}},{menuItem:"Queries",visible:function(){return t.isEnterprise()},render:function(){return e.paneWrapper(r.a.createElement(li,{key:n,member:t}))}},{menuItem:"Connections",visible:function(){return t.isEnterprise()},render:function(){return e.paneWrapper(r.a.createElement(pi,{key:n,member:t}))}},{menuItem:"Configuration",visible:function(){return!0},render:function(){return e.paneWrapper(r.a.createElement(Jr,{key:n,member:t}))}},{menuItem:"OS",visible:function(){return!0},render:function(){return e.paneWrapper(r.a.createElement(as,{key:n,member:t}))}},{menuItem:"Plugins",visible:function(){return!0},render:function(){return e.paneWrapper(r.a.createElement(is,{key:n,member:t}))}},{menuItem:"Query Performance",visible:function(){return window.halinContext.userIsAdmin()},render:function(){return e.paneWrapper(r.a.createElement(Es,{key:n,member:t}))}},{menuItem:"Metrics",visible:function(){return!0},render:function(){return e.paneWrapper(r.a.createElement(Vs,{key:n,member:t}))}},{menuItem:"Logs",visible:function(){return!0},render:function(){return e.paneWrapper(r.a.createElement(Ns,{key:n,member:t}))}}]}},e.paneWrapper=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"secondary";return r.a.createElement(ca.a.Pane,null,r.a.createElement("div",{className:"PaneWrapper ".concat(t)},e))},e.select=function(t){return e.setState({member:t})},e}return Object(x.a)(n,[{key:"renderChildContent",value:function(){return r.a.createElement(ca.a,{style:{paddingLeft:14,paddingRight:14,paddingTop:14,paddingBottom:14},menu:{secondary:!0,pointing:!0},panes:this.state.panes(this.state.member).filter((function(e){return e.visible()}))})}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){var t=e.clickCount%2===0;this.setState({visible:t})}},{key:"render",value:function(){var e=this;return r.a.createElement(xn.a.Pushable,{id:"MemberSelector",as:In.a,style:{marginTop:0,marginBottom:0,borderLeft:"1px solid white",borderRight:"none",borderTop:"none",borderBottom:"none"}},r.a.createElement(xn.a,{id:"MemberSelectorSidebar",as:Ln.a,animation:this.state.animation,direction:this.state.direction,icon:"labeled",inverted:!0,vertical:!0,visible:this.state.visible,width:"thin"},window.halinContext.members().sort(gi).map((function(t,n){return r.a.createElement(fi,{member:t,key:n,active:e.state.member===t,onSelect:e.select})})),r.a.createElement(Dr.a,{horizontal:!0,inverted:!0})),r.a.createElement(xn.a.Pusher,{id:"MemberPane",dimmed:!1,className:this.state.visible?"sidebarVisible":"sidebarClosed"},this.renderChildContent()))}}]),n}(a.Component),bi=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s0?t.value/a:0}})),["value"]);return e.setState({data:s,error:null,total:a,units:r})})).catch((function(t){var n="".concat(t);An.sentry.reportError("Error getting pie chart data (".concat(n,")"),t),e.setState({error:t,total:1,data:null})})):null}},{key:"formatNumberWithUnits",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state.units;return Se.roundToPlaces(e,2).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+" "+t}},{key:"renderPieChart",value:function(){return r.a.createElement(Zr.a,{data:this.state.data,label:this.assignLabel,labelStyle:{fontSize:"5px",fontFamily:"sans-serif",fill:"black"},radius:42,labelPosition:112,style:{height:this.state.height,width:this.state.width}})}},{key:"render",value:function(){var e=this.formatNumberWithUnits(this.state.total);return r.a.createElement("div",{className:"CypherPieChart"},r.a.createElement("h5",null,"Total: ",e),this.state.data?this.state.total&&this.state.total>0?this.renderPieChart():r.a.createElement("h5",null,"None/Not Enabled"):r.a.createElement(hn,{active:!0}))}}]),n}(a.Component),wi=function(e){return r.a.createElement(Yn,null,r.a.createElement("h3",null,"Data on Disk ",r.a.createElement(Gn,{knowledgebase:"DiskUtilization"})),r.a.createElement(Si,{query:An.queryLibrary.JMX_DISK_UTILIZATION.query,member:e.node,title:"Title",units:"GB"}))};wi.props={node:un.a.object.isRequired};var Ti=wi,ki=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s0?i=r.a.createElement("strong",null,r.a.createElement(_n.a,{name:"plus",color:"green"})," ",Ai(s),"/sec"):s<0&&(i=r.a.createElement("strong",null,r.a.createElement(_n.a,{name:"minus",color:"red"})," ",Ai(s),"/sec")),r.a.createElement(Wa.a.Item,{key:n},t,": ",a," nodes ",i)},e}return Object(x.a)(n,[{key:"componentWillMount",value:function(){this.df=window.halinContext.getDataFeed({node:this.props.node,database:this.props.database,query:An.queryLibrary.APOC_COUNT_STORE.query,displayColumns:An.queryLibrary.APOC_COUNT_STORE.columns}),this.df.on("data",this.onData),this.df.addAugmentationFunction(this.augmentData)}},{key:"componentDidMount",value:function(){this.mounted=!0}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"render",value:function(){var e=this,t=this.state.data;return d.a.isEmpty(t)?"":r.a.createElement("div",null,r.a.createElement("p",null,Ai(t.nodeCount)," nodes, ",Ai(t.relCount)," relationships, and \xa0",Ai(t.propertyKeyCount)," properties."),r.a.createElement("h4",null,"Labels"),r.a.createElement(Wa.a,{id:"label_list"},0===Object.keys(t.labels).length?"None":Object.keys(t.labels).sort().map((function(t,n){return e.labelListEntry(t,n)}))),r.a.createElement("h4",null,"Relationships"),r.a.createElement(Wa.a,{id:"rel_list"},0===Object.keys(t.relTypes).length?"None":Object.keys(t.relTypes).sort().map((function(e,n){return r.a.createElement(Wa.a.Item,{key:n},e,": ",Ai(An.driver.handleNeo4jInt(t.relTypes[e])))}))))}}]),n}(a.Component)),Di=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){return Object(_.a)(this,n),t.apply(this,arguments)}return Object(x.a)(n,[{key:"render",value:function(){return r.a.createElement(Yn,{id:"ApocMetaStats"},r.a.createElement("h3",null,"Database Statistics ",r.a.createElement(Gn,{knowledgebase:"ApocMetaStats"})),r.a.createElement(ji,this.props))}}]),n}(a.Component);Di.props={node:un.a.object.isRequired};var Ni=Di,Mi=function(e){return r.a.createElement(Wa.a.Item,null,r.a.createElement(qn.a,null,r.a.createElement(_n.a,{name:"cubes"}),"Fabric Database",r.a.createElement(qn.a.Detail,null,r.a.createElement(Gn,{knowledgebase:"Fabric"}))))},Ii=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){return Object(_.a)(this,n),t.apply(this,arguments)}return Object(x.a)(n,[{key:"status",value:function(e){return e.currentStatus!==e.requestedStatus?"Transitioning from ".concat(e.currentStatus," \u2192 ").concat(e.requestedStatus):e.currentStatus}},{key:"errorInformation",value:function(e){return e.error?"Error Information: ".concat(e.error):""}},{key:"membersByRole",value:function(){var e=this.props.database.getMembersByRole(window.halinContext),t=Object.keys(e);t.sort();return r.a.createElement(Wa.a,null,t.map((function(t,n){return function(t,n){return e[t].map((function(e,n){return r.a.createElement(Wa.a.Item,{key:n},r.a.createElement(va,{member:e,detail:t}))}))}(t)})))}},{key:"unavailable",value:function(){return r.a.createElement(Yn,{id:"DatabaseOverview",header:"Overview",knowledgebase:"Database"},r.a.createElement("strong",null,"Database details are unavailable"))}},{key:"render",value:function(){var e=this;if(!this.props.database)return this.unavailable();var t=this.props.database.getLeader(window.halinContext,!1),n=!!t&&t.usesFabric(),a=d.a.get(n,"database")===this.props.database.getLabel();return r.a.createElement(Yn,{id:"DatabaseOverview",header:"Overview",knowledgebase:"Database"},this.membersByRole(),r.a.createElement(Wa.a,null,a?r.a.createElement(Mi,null):"",d.a.sortBy(this.props.database.getMemberStatuses(),["address"]).map((function(t,n){return r.a.createElement(Wa.a.Item,{key:n},t.address,"\xa0",r.a.createElement("strong",null,(""+t.role).toUpperCase()),"\xa0 \xa0Status: ",e.status(t),"\xa0",e.errorInformation(t))}))),r.a.createElement("p",null,"Last updated: ",le()(this.props.database.created).fromNow()),t?"":r.a.createElement("p",null,r.a.createElement("strong",null,"No leader detected"),"; \xa0database may be starting, stopping, or \xa0undergoing leader election"))}}]),n}(a.Component);Ii.props={node:un.a.object.isRequired,database:un.a.object.isRequired};var _i=Ii,xi=na(ta(function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s1&&void 0!==arguments[1]?arguments[1]:"secondary";return r.a.createElement(ca.a.Pane,null,r.a.createElement("div",{className:"PaneWrapper ".concat(t)},e))},e.select=function(t){return e.setState({selected:t,create:!1})},e}return Object(x.a)(n,[{key:"UNSAFE_componentWillMount",value:function(){var e=this;this.listenerFn=function(t){var n=window.halinContext.databases(),a=n.filter((function(t){return t.getLabel()===e.state.selected.getLabel()}))[0];a||(a=n[0]),e.state.create?e.setState({id:ue.a.v4(),create:!0}):e.setState({selected:a,id:ue.a.v4(),create:!1})},window.halinContext.getClusterManager().on("data",this.listenerFn),this.setState({selected:window.halinContext.databases()[0],create:!1})}},{key:"componentWillUnmount",value:function(){window.halinContext.getClusterManager().removeListener(this.listenerFn)}},{key:"renderChildContent",value:function(){return r.a.createElement(ca.a,{style:{paddingLeft:14,paddingRight:14,paddingTop:14,paddingBottom:14},menu:{secondary:!0,pointing:!0},panes:this.state.create?this.state.createPanes():this.state.panes(this.state.member).filter((function(e){return e.visible()}))})}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){var t=e.clickCount%2===0;this.setState({visible:t})}},{key:"render",value:function(){var e=this;return r.a.createElement(xn.a.Pushable,{id:"MemberSelector",as:In.a,style:{marginTop:0,marginBottom:0,borderLeft:"1px solid white",borderRight:"none",borderTop:"none",borderBottom:"none"}},r.a.createElement(xn.a,{id:"MemberSelectorSidebar",as:Ln.a,animation:this.state.animation,direction:this.state.direction,icon:"labeled",inverted:!0,vertical:!0,visible:this.state.visible,width:"thin"},window.halinContext.databases().map((function(t,n){return r.a.createElement(bi,{database:t,key:n,active:e.state.selected&&e.state.selected.getLabel()===t.getLabel(),onSelect:e.select})})),window.halinContext.getVersion().major>=4?r.a.createElement(Ln.a.Item,{as:"a",active:!1,onClick:function(){return e.setState({create:!0})}},r.a.createElement(_n.a,{name:"add",color:"green"}),"Create New Database"):"",r.a.createElement(Dr.a,{horizontal:!0,inverted:!0})),r.a.createElement(xn.a.Pusher,{id:"MemberPane",dimmed:!1,className:this.state.visible?"sidebarVisible":"sidebarClosed"},this.renderChildContent()))}}]),n}(a.Component)),Fi={height:"100%",minHeight:500,paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},qi=function(e,t,n){return r.a.createElement("div",{key:n},t)},Bi=function(e){Object(L.a)(n,e);var t=Object(P.a)(n);function n(){var e;Object(_.a)(this,n);for(var a=arguments.length,r=new Array(a),s=0;s