Skip to content

Commit

Permalink
fix: get src when path has no relationship (#216) (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
hetao92 committed May 19, 2022
1 parent 37b8f7c commit 3e171a5
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 75 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/auto-cherry-pick.yml
Original file line number Diff line number Diff line change
@@ -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$
92 changes: 22 additions & 70 deletions app/utils/parseData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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}}`,
});
});
});
}
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nebula-graph-studio",
"version": "3.3.1",
"version": "3.3.2",
"description": "nebula-graph-studio",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions server/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 3e171a5

Please sign in to comment.