【前端】Neo4j前端源代码阅读笔记-创新互联
目的
- neo4j自带的前端页面无法嵌入到iframe中
- 在vue中实现类似于neo4j的前端页面一样的展示。
详细
先从代码输入框入手,找到Editor.jsx文件
西平ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:13518219792(备注:SSL证书合作)期待与您的合作!/// vim src/modules/Editor/Editor.jsx
this.execCurrent()}
disabled={this.getEditorValue().length < 1}
title='Play'
icon={controlsPlay}
/>
execCurrent () {
this.props.onExecute(this.getEditorValue())
this.clearEditor()
this.setState({
notifications: [],
historyIndex: -1,
buffer: null,
expanded: false
})
}
onExecute: cmd => {
const action = executeCommand(cmd)
ownProps.bus.send(action.type, action)
}
追踪executeCommand函数到commandsDuck.js
/// vim commandsDuck.js
// 这个文件定义了很多前后端连接的函数
handleCommandEpic() { }
然后是Graph.jsx
initGraphView () {
if (!this.graphView) {
let NeoConstructor = graphView
let measureSize = () => {
return {
width: this.svgElement.offsetWidth,
height: this.getVisualAreaHeight()
}
}
this.graph = createGraph(this.props.nodes, this.props.relationships)
this.graphView = new NeoConstructor(
this.svgElement,
measureSize,
this.graph,
this.props.graphStyle
)
this.graphEH = new GraphEventHandler(
this.graph,
this.graphView,
this.props.getNodeNeighbours,
this.props.onItemMouseOver,
this.props.onItemSelect,
this.props.onGraphModelChange
)
this.graphEH.bindEventHandlers()
this.props.onGraphModelChange(getGraphStats(this.graph))
this.graphView.resize()
this.graphView.update()
}
}
这个文件中出现了createGraph(this.props.nodes, this.props.relationships)
这个重要的语句
追踪relationships到VisualizationView.jsx
populateDataToStateFromProps (props) {
const {
nodes,
relationships
} = bolt.extractNodesAndRelationshipsFromRecordsForOldVis(
props.result.records
)
这个文件中说明了relationships
与nodes
的来源
接着是bolt.js
function setupBoltWorker (id, workFn, onLostConnection = () => {}) {
const workerPromise = new Promise((resolve, reject) => {
const work = boltWorkPool.doWork({
id,
payload: workFn,
onmessage: msg => {
if (msg.data.type === BOLT_CONNECTION_ERROR_MESSAGE) {
work.finish()
onLostConnection(msg.data.error)
return reject(msg.data.error)
}
if (msg.data.type === CYPHER_ERROR_MESSAGE) {
work.finish()
reject(msg.data.error)
} else if (msg.data.type === CYPHER_RESPONSE_MESSAGE) {
work.finish()
resolve(addTypesAsField(msg.data.result))
} else if (msg.data.type === POST_CANCEL_TRANSACTION_MESSAGE) {
work.finish()
}
}
})
})
return workerPromise
}
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
本文名称:【前端】Neo4j前端源代码阅读笔记-创新互联
文章分享:http://hbruida.cn/article/ccpgos.html