From 5026d1d3d9d0d5a47ad63ccc506e47aeb37d1ac2 Mon Sep 17 00:00:00 2001 From: Nut He <18328704+hetao92@users.noreply.github.com> Date: Wed, 18 May 2022 18:59:37 +0800 Subject: [PATCH] fix: get src when path has no relationship (#216) --- .github/workflows/auto-cherry-pick.yml | 21 ++++++ app/utils/parseData.ts | 92 ++++++-------------------- package-lock.json | 2 +- package.json | 2 +- server/go.mod | 2 +- server/go.sum | 4 +- 6 files changed, 48 insertions(+), 75 deletions(-) create mode 100644 .github/workflows/auto-cherry-pick.yml diff --git a/.github/workflows/auto-cherry-pick.yml b/.github/workflows/auto-cherry-pick.yml new file mode 100644 index 00000000..3d52805a --- /dev/null +++ b/.github/workflows/auto-cherry-pick.yml @@ -0,0 +1,21 @@ +name: Auto Cherry Pick +on: workflow_dispatch + +defaults: + run: + shell: bash + +jobs: + auto-cherry-pick: + runs-on: [self-hosted, nebula-fast] + container: + image: reg.vesoft-inc.com/dashboard/dashboard-dev:centos7 + credentials: + username: ${{ secrets.HARBOR_USERNAME }} + password: ${{ secrets.HARBOR_PASSWORD }} + steps: + - name: auto cherry pick + uses: xigongdaEricyang/cherry-pick-robot@with-python + with: + from_repo: vesoft-inc/nebula-studio + pr_label: ^v[0-9]*\.[0-9]*-cherry-pick$ diff --git a/app/utils/parseData.ts b/app/utils/parseData.ts index 5ba4e861..94e7fa37 100644 --- a/app/utils/parseData.ts +++ b/app/utils/parseData.ts @@ -2,28 +2,6 @@ import { convertBigNumberToString, handleVidStringName } from '@app/utils/functi import { uniq } from 'lodash'; import { DEFAULT_COLOR_PICK_LIST } from '@app/config/explore'; -export function parseEdgeToGraph(data, spaceVidType) { - const vertexes: any = []; - const edges: any = []; - const relationships = data.map((i) => i._edgesParsedList).flat(); - relationships.forEach((relationship) => { - const { srcID: srcId, dstID: dstId, edgeName: edgeType, rank } = relationship; - vertexes.push(srcId); - vertexes.push(dstId); - edges.push({ - srcId, - dstId, - edgeType, - rank, - id: `${edgeType} ${handleVidStringName(srcId, spaceVidType)}->${handleVidStringName( - dstId, - spaceVidType - )}@${rank}}`, - }); - }); - return { vertexes, edges }; -} - export const whichColor = (() => { const colorsTotal = DEFAULT_COLOR_PICK_LIST.length; let colorIndex = 0; @@ -81,36 +59,6 @@ export function getBidrectVertexIds(data) { return uniq(vertexIds); } -export function parsePathToGraph(data, spaceVidType) { - const vertexes: any = []; - const edges: any = []; - const relationships = data - .map(i => i._pathsParsedList) - .flat() - .map(i => i.relationships) - .flat(); - relationships.forEach(relationship => { - const { - srcID: srcId, - dstID: dstId, - edgeName: edgeType, - rank, - } = relationship; - vertexes.push(srcId); - vertexes.push(dstId); - edges.push({ - srcId, - dstId, - edgeType, - rank, - id: `${edgeType} ${handleVidStringName( - srcId, - spaceVidType, - )}->${handleVidStringName(dstId, spaceVidType)}@${rank}}`, - }); - }); - return { vertexes, edges }; -} export function parseSubGraph(data, spaceVidType) { const vertexes: any = []; @@ -142,26 +90,30 @@ export function parseSubGraph(data, spaceVidType) { if (_pathsParsedList) { _pathsParsedList.forEach(path => { const relationships = path.relationships; - relationships.forEach(relationship => { - const { - srcID: srcId, - dstID: dstId, - edgeName: edgeType, - rank, - } = relationship; - vertexes.push(srcId); - vertexes.push(dstId); - edges.push({ - srcId, - dstId, - edgeType, - rank, - id: `${edgeType} ${handleVidStringName( + if(!relationships && path.srcID) { + vertexes.push(path.srcID); + } else if (relationships !== null) { + relationships.forEach(relationship => { + const { + srcID: srcId, + dstID: dstId, + edgeName: edgeType, + rank, + } = relationship; + vertexes.push(srcId); + vertexes.push(dstId); + edges.push({ srcId, - spaceVidType, - )}->${handleVidStringName(dstId, spaceVidType)}@${rank}}`, + dstId, + edgeType, + rank, + id: `${edgeType} ${handleVidStringName( + srcId, + spaceVidType, + )}->${handleVidStringName(dstId, spaceVidType)}@${rank}}`, + }); }); - }); + } }); } }); diff --git a/package-lock.json b/package-lock.json index 3b9d990c..aaf79e63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "nebula-graph-studio", - "version": "3.3.1", + "version": "3.3.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f9c0193e..ca0f6dbc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nebula-graph-studio", - "version": "3.3.1", + "version": "3.3.2", "description": "nebula-graph-studio", "private": true, "scripts": { diff --git a/server/go.mod b/server/go.mod index cca645d5..ca003863 100644 --- a/server/go.mod +++ b/server/go.mod @@ -8,7 +8,7 @@ require ( github.com/kataras/iris/v12 v12.2.0-alpha4 github.com/mattn/go-sqlite3 v2.0.3+incompatible github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca - github.com/vesoft-inc/nebula-http-gateway/ccore v0.0.0-20220507025253-cb342db9786d + github.com/vesoft-inc/nebula-http-gateway/ccore v0.0.0-20220518092450-316a5f6420ef github.com/vesoft-inc/nebula-importer v1.0.1-0.20220505095506-93febd41c2be go.uber.org/zap v1.17.0 gopkg.in/yaml.v2 v2.4.0 diff --git a/server/go.sum b/server/go.sum index 510a8b38..da600684 100644 --- a/server/go.sum +++ b/server/go.sum @@ -254,8 +254,8 @@ github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyC github.com/vesoft-inc/nebula-go/v3 v3.0.0-20220425030225-cdb52399b40a/go.mod h1:+sXv05jYQBARdTbTcIEsWVXCnF/6ttOlDK35xQ6m54s= github.com/vesoft-inc/nebula-go/v3 v3.1.0 h1:Fp99YPk3/kNY1HERagDfty3To+hdi97dCO73FNwkhwE= github.com/vesoft-inc/nebula-go/v3 v3.1.0/go.mod h1:+sXv05jYQBARdTbTcIEsWVXCnF/6ttOlDK35xQ6m54s= -github.com/vesoft-inc/nebula-http-gateway/ccore v0.0.0-20220507025253-cb342db9786d h1:XcYk0eLTCrTY9RTAK7raKHqy7VYahH+d9ZFdsNhMIbQ= -github.com/vesoft-inc/nebula-http-gateway/ccore v0.0.0-20220507025253-cb342db9786d/go.mod h1:sFEvE+cY4TgwqWx6H6msOqAUzRhsEHHKaaMgIZENHuQ= +github.com/vesoft-inc/nebula-http-gateway/ccore v0.0.0-20220518092450-316a5f6420ef h1:Hco8JsAXm2ujRpJjo+qGnVyASHXDnopHwA20anmmnV4= +github.com/vesoft-inc/nebula-http-gateway/ccore v0.0.0-20220518092450-316a5f6420ef/go.mod h1:sFEvE+cY4TgwqWx6H6msOqAUzRhsEHHKaaMgIZENHuQ= github.com/vesoft-inc/nebula-importer v1.0.1-0.20220505095506-93febd41c2be h1:7YGSREZ6uS1WjCdKTlHEvhSeYURJFY7UXQZ008+EB2Y= github.com/vesoft-inc/nebula-importer v1.0.1-0.20220505095506-93febd41c2be/go.mod h1:8xAQi6KI2qe40Dop/GqDXmBEurt7qGp5Pjd1MESAVNA= github.com/vmihailenco/msgpack/v5 v5.0.0/go.mod h1:HVxBVPUK/+fZMonk4bi1islLa8V3cfnBug0+4dykPzo=