Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/browser/modules/Editor/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import ratingStar from 'icons/rating-star.svg'
import controlsPlay from 'icons/controls-play.svg'
import eraser2 from 'icons/eraser-2.svg'
import pencil from 'icons/pencil.svg'
import { NEO4J_BROWSER_USER_ACTION_QUERY } from 'services/bolt/txMetadata'

const shouldCheckForHints = code =>
code.trim().length > 0 &&
Expand Down Expand Up @@ -280,7 +281,10 @@ export class Editor extends Component {
;((text, offset) => {
this.props.bus.self(
CYPHER_REQUEST,
{ query: 'EXPLAIN ' + text },
{
query: 'EXPLAIN ' + text,
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
response => {
if (
response.success === true &&
Expand Down
44 changes: 28 additions & 16 deletions src/browser/modules/Stream/CypherFrame/VisualizationView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { ExplorerComponent } from '../../D3Visualization/components/Explorer'
import { StyledVisContainer } from './VisualizationView.styled'

import { CYPHER_REQUEST } from 'shared/modules/cypher/cypherDuck'
import { NEO4J_BROWSER_USER_ACTION_QUERY } from 'services/bolt/txMetadata'

export class Visualization extends Component {
state = {
Expand Down Expand Up @@ -95,22 +96,29 @@ export class Visualization extends Component {
currentNeighbourIds.length}`
return new Promise((resolve, reject) => {
this.props.bus &&
this.props.bus.self(CYPHER_REQUEST, { query: query }, response => {
if (!response.success) {
reject(new Error())
} else {
let count =
response.result.records.length > 0
? parseInt(response.result.records[0].get('c').toString())
: 0
const resultGraph = bolt.extractNodesAndRelationshipsFromRecordsForOldVis(
response.result.records,
false
)
this.autoCompleteRelationships(this.graph._nodes, resultGraph.nodes)
resolve({ ...resultGraph, count: count })
this.props.bus.self(
CYPHER_REQUEST,
{ query: query, queryType: NEO4J_BROWSER_USER_ACTION_QUERY },
response => {
if (!response.success) {
reject(new Error())
} else {
let count =
response.result.records.length > 0
? parseInt(response.result.records[0].get('c').toString())
: 0
const resultGraph = bolt.extractNodesAndRelationshipsFromRecordsForOldVis(
response.result.records,
false
)
this.autoCompleteRelationships(
this.graph._nodes,
resultGraph.nodes
)
resolve({ ...resultGraph, count: count })
}
}
})
)
})
}
getInternalRelationships (existingNodeIds, newNodeIds) {
Expand All @@ -123,7 +131,11 @@ export class Visualization extends Component {
this.props.bus &&
this.props.bus.self(
CYPHER_REQUEST,
{ query, params: { existingNodeIds, newNodeIds } },
{
query,
params: { existingNodeIds, newNodeIds },
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
response => {
if (!response.success) {
reject(new Error())
Expand Down
6 changes: 5 additions & 1 deletion src/browser/modules/Stream/Queries/QueriesFrame.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import { EnterpriseOnlyFrame } from 'browser-components/EditionView'
import { RefreshIcon } from 'browser-components/icons/Icons'
import Render from 'browser-components/Render'
import FrameError from '../FrameError'
import { NEO4J_BROWSER_USER_ACTION_QUERY } from 'services/bolt/txMetadata'

export class QueriesFrame extends Component {
state = {
Expand Down Expand Up @@ -97,7 +98,10 @@ export class QueriesFrame extends Component {
getRunningQueries (suppressQuerySuccessMessage = false) {
this.props.bus.self(
this.isCC() ? CLUSTER_CYPHER_REQUEST : CYPHER_REQUEST,
{ query: listQueriesProcedure() },
{
query: listQueriesProcedure(),
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
response => {
if (response.success) {
const queries = this.extractQueriesFromBoltResult(response.result)
Expand Down
7 changes: 5 additions & 2 deletions src/browser/modules/Stream/SchemaFrame.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { withBus } from 'react-suber'
import { CYPHER_REQUEST } from 'shared/modules/cypher/cypherDuck'
import FrameTemplate from '../Stream/FrameTemplate'
import { StyledSchemaBody } from './styled'
import { NEO4J_BROWSER_USER_ACTION_QUERY } from 'services/bolt/txMetadata'

export class SchemaFrame extends Component {
constructor (props) {
Expand Down Expand Up @@ -53,15 +54,17 @@ export class SchemaFrame extends Component {
this.props.bus.self(
CYPHER_REQUEST,
{
query: 'CALL db.indexes()'
query: 'CALL db.indexes()',
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
this.responseHandler('indexes')
)
// Constraints
this.props.bus.self(
CYPHER_REQUEST,
{
query: 'CALL db.constraints()'
query: 'CALL db.constraints()',
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
this.responseHandler('constraints')
)
Expand Down
7 changes: 5 additions & 2 deletions src/browser/modules/Stream/SysInfoFrame/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
AutoRefreshSpan,
StatusbarWrapper
} from '../AutoRefresh/styled'
import { NEO4J_BROWSER_USER_ACTION_QUERY } from 'services/bolt/txMetadata'

export class SysInfoFrame extends Component {
constructor (props) {
Expand Down Expand Up @@ -235,15 +236,17 @@ export class SysInfoFrame extends Component {
this.props.bus.self(
CYPHER_REQUEST,
{
query: 'CALL dbms.queryJmx("org.neo4j:*")'
query: 'CALL dbms.queryJmx("org.neo4j:*")',
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
this.responseHandler.bind(this)
)
if (this.props.isACausalCluster) {
this.props.bus.self(
CYPHER_REQUEST,
{
query: 'CALL dbms.cluster.overview'
query: 'CALL dbms.cluster.overview',
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
this.clusterResponseHandler.bind(this)
)
Expand Down
13 changes: 10 additions & 3 deletions src/browser/modules/User/UserAdd.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
StyledTh
} from 'browser-components/DataTables'
import { StyledUserTd, StyledInput, StyledButtonContainer } from './styled'
import { NEO4J_BROWSER_USER_ACTION_QUERY } from 'services/bolt/txMetadata'

export class UserAdd extends Component {
constructor (props) {
Expand Down Expand Up @@ -93,7 +94,10 @@ export class UserAdd extends Component {
this.props.bus &&
this.props.bus.self(
CYPHER_REQUEST,
{ query: addRoleToUser(this.state.username, role) },
{
query: addRoleToUser(this.state.username, role),
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
response => {
if (!response.success) {
return errors.add(response.error)
Expand All @@ -110,7 +114,7 @@ export class UserAdd extends Component {
this.props.bus &&
this.props.bus.self(
CYPHER_REQUEST,
{ query: listRolesQuery() },
{ query: listRolesQuery(), queryType: NEO4J_BROWSER_USER_ACTION_QUERY },
response => {
if (!response.success) {
const error =
Expand Down Expand Up @@ -153,7 +157,10 @@ export class UserAdd extends Component {
this.props.bus &&
this.props.bus.self(
CYPHER_REQUEST,
{ query: createDatabaseUser(this.state) },
{
query: createDatabaseUser(this.state),
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
response => {
if (!response.success) {
const error =
Expand Down
26 changes: 21 additions & 5 deletions src/browser/modules/User/UserInformation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { StyledBodyTr } from 'browser-components/DataTables'
import { StyledUserTd, StyledButtonContainer } from './styled'

import RolesSelector from './RolesSelector'
import { NEO4J_BROWSER_USER_ACTION_QUERY } from 'services/bolt/txMetadata'

export class UserInformation extends Component {
constructor (props) {
Expand All @@ -51,21 +52,30 @@ export class UserInformation extends Component {
removeClick (thing) {
this.props.bus.self(
CYPHER_REQUEST,
{ query: deleteUser(this.state.username) },
{
query: deleteUser(this.state.username),
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
this.handleResponse.bind(this)
)
}
suspendUser () {
this.props.bus.self(
CYPHER_REQUEST,
{ query: suspendUser(this.state.username) },
{
query: suspendUser(this.state.username),
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
this.handleResponse.bind(this)
)
}
activateUser () {
this.props.bus.self(
CYPHER_REQUEST,
{ query: activateUser(this.state.username) },
{
query: activateUser(this.state.username),
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
this.handleResponse.bind(this)
)
}
Expand Down Expand Up @@ -96,7 +106,10 @@ export class UserInformation extends Component {
onClick={() => {
this.props.bus.self(
CYPHER_REQUEST,
{ query: removeRoleFromUser(role, this.state.username) },
{
query: removeRoleFromUser(role, this.state.username),
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
this.handleResponse.bind(this)
)
}}
Expand All @@ -107,7 +120,10 @@ export class UserInformation extends Component {
onRoleSelect (event) {
this.props.bus.self(
CYPHER_REQUEST,
{ query: addRoleToUser(this.state.username, event.target.value) },
{
query: addRoleToUser(this.state.username, event.target.value),
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
this.handleResponse.bind(this)
)
}
Expand Down
5 changes: 3 additions & 2 deletions src/browser/modules/User/UserList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { StyledButtonContainer } from './styled'

import FrameTemplate from '../Stream/FrameTemplate'
import { forceFetch } from 'shared/modules/currentUser/currentUserDuck'
import { NEO4J_BROWSER_USER_ACTION_QUERY } from 'services/bolt/txMetadata'

export class UserList extends Component {
constructor (props) {
Expand All @@ -52,7 +53,7 @@ export class UserList extends Component {
getUserList () {
this.props.bus.self(
CYPHER_REQUEST,
{ query: listUsersQuery() },
{ query: listUsersQuery(), queryType: NEO4J_BROWSER_USER_ACTION_QUERY },
response => {
if (response.success) {
this.setState({
Expand All @@ -66,7 +67,7 @@ export class UserList extends Component {
getRoles () {
this.props.bus.self(
CYPHER_REQUEST,
{ query: listRolesQuery() },
{ query: listRolesQuery(), queryType: NEO4J_BROWSER_USER_ACTION_QUERY },
response => {
const flatten = arr =>
arr.reduce((a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), [])
Expand Down
7 changes: 6 additions & 1 deletion src/shared/modules/cypher/cypherDuck.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { getCausalClusterAddresses } from './queriesProcedureHelper'
import { getEncryptionMode } from 'services/bolt/boltHelpers'
import { flatten } from 'services/utils'
import { shouldUseCypherThread } from 'shared/modules/settings/settingsDuck'
import { getUserTxMetadata } from 'services/bolt/txMetadata'
import { canSendTxMetadata } from '../features/versionedFeatures'

const NAME = 'cypher'
export const CYPHER_REQUEST = NAME + '/REQUEST'
Expand Down Expand Up @@ -80,7 +82,10 @@ export const cypherRequestEpic = (some$, store) =>
if (!action.$$responseChannel) return Rx.Observable.of(null)
return bolt
.directTransaction(action.query, action.params || undefined, {
useCypherThread: shouldUseCypherThread(store.getState())
useCypherThread: shouldUseCypherThread(store.getState()),
...getUserTxMetadata(action.queryType || null)({
hasServerSupport: canSendTxMetadata(store.getState())
})
})
.then(r => ({ type: action.$$responseChannel, success: true, result: r }))
.catch(e => ({
Expand Down
Loading