91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

【前端】Neo4j前端源代碼閱讀筆記

發布時間:2020-06-15 23:31:06 來源:網絡 閱讀:2015 作者:對唔住 欄目:web開發

目的

  • neo4j自帶的前端頁面無法嵌入到iframe中
  • 在vue中實現類似于neo4j的前端頁面一樣的展示。

詳細

先從代碼輸入框入手,找到Editor.jsx文件

/// vim src/modules/Editor/Editor.jsx
          <EditorButton
            data-testid='submitQuery'
            onClick={() => 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
    )

這個文件中說明了relationshipsnodes的來源
接著是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
}
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

海南省| 扎鲁特旗| 宁武县| 德化县| 乌兰浩特市| 板桥市| 贡山| 井研县| 望城县| 亳州市| 开江县| 咸丰县| 衡水市| 镇江市| 百色市| 广饶县| 乳山市| 拜城县| 广宗县| 台南市| 嘉善县| 仁布县| 黔江区| 石泉县| 大姚县| 宜城市| 双城市| 翁牛特旗| 左权县| 突泉县| 康保县| 红桥区| 盐池县| 株洲县| 东乡县| 南阳市| 景宁| 佛坪县| 呈贡县| 云林县| 开化县|