diff --git a/app/config/service.ts b/app/config/service.ts
index 7b592162..c3903f84 100644
--- a/app/config/service.ts
+++ b/app/config/service.ts
@@ -63,12 +63,12 @@ const service = {
deleteSketch: (id: string, config?) => {
return _delete(`/api/sketches/${id}`)(undefined, config);
},
- getSchemaSnapshot: (space, config?) => {
- return get(`/api/schema/${encodeURIComponent(space)}/snapshot`)(undefined, config);
+ getSchemaSnapshot: (params, config?) => {
+ return get(`/api/schema/snapshot`)(params, config);
},
updateSchemaSnapshot: (params, config?) => {
- const { space, ...restParams } = params;
- return put(`/api/schema/${encodeURIComponent(space)}/snapshot`)(restParams, config);
+ const { ...restParams } = params;
+ return put(`/api/schema/snapshot`)(restParams, config);
},
deleteFavorite: (id, config?) => {
return _delete(`/api/favorites/${id}`)(undefined, config);
diff --git a/app/pages/MainPage/Header/HelpMenu/index.tsx b/app/pages/MainPage/Header/HelpMenu/index.tsx
index cf8b1b70..314ff02f 100644
--- a/app/pages/MainPage/Header/HelpMenu/index.tsx
+++ b/app/pages/MainPage/Header/HelpMenu/index.tsx
@@ -43,7 +43,7 @@ const HelpMenu = () => {
},
{
- key: 'feedback',
+ key: 'feedbackEntrance',
popupClassName: styles.accountMenu,
popupOffset: [-35, 20],
label: ,
diff --git a/app/pages/Schema/SchemaConfig/List/SchemaVisualization/index.tsx b/app/pages/Schema/SchemaConfig/List/SchemaVisualization/index.tsx
index a58f5797..6eef7313 100644
--- a/app/pages/Schema/SchemaConfig/List/SchemaVisualization/index.tsx
+++ b/app/pages/Schema/SchemaConfig/List/SchemaVisualization/index.tsx
@@ -54,7 +54,11 @@ const SchemaVisualization = () => {
try {
await getEdgeList();
await getTagList();
- const { vids, edges } = await getRandomEdgeData();
+ const { vids, edges, err } = await getRandomEdgeData();
+ if(err) {
+ message.warning(err);
+ return;
+ }
if(vids.length === 0) {
message.warning(intl.get('sketch.noData'));
return;
diff --git a/app/stores/schema.ts b/app/stores/schema.ts
index ce140390..ebfefef3 100644
--- a/app/stores/schema.ts
+++ b/app/stores/schema.ts
@@ -693,33 +693,42 @@ export class SchemaStore {
const vids:Set = new Set();
const edges = [];
const edgeQuery = this.edgeList.map(edge => `MATCH ()-[e:${handleKeyword(edge.name)}]->() RETURN e LIMIT 10;`);
- const { code, data } = await service.batchExecNGQL({
+ const { code, data, message } = await service.batchExecNGQL({
gqls: edgeQuery
});
- if(code === 0) {
- data.forEach(item => {
- if(item.code === 0) {
- const edgeList = item.data?.tables || [];
- edgeList.forEach(item => {
- const { dstID, srcID, edgeName } = item._edgesParsedList[0];
- vids.add(srcID);
- vids.add(dstID);
- edges.push({
- src: srcID,
- dst: dstID,
- name: edgeName,
- properties: this.edgeList.find(i => i.name === edgeName).fields.map(field => ({
- name: field.Field,
- type: field.Type,
- }))
- });
+ let err;
+ if(code !== 0) {
+ return {
+ err: message
+ };
+ }
+ for(let i = 0; i < data.length; i++) {
+ const item = data[i];
+ if(item.code !== 0) {
+ err = item.message;
+ break;
+ } else {
+ const edgeList = item.data?.tables || [];
+ edgeList.forEach(item => {
+ const { dstID, srcID, edgeName } = item._edgesParsedList[0];
+ vids.add(srcID);
+ vids.add(dstID);
+ edges.push({
+ src: srcID,
+ dst: dstID,
+ name: edgeName,
+ properties: this.edgeList.find(i => i.name === edgeName).fields.map(field => ({
+ name: field.Field,
+ type: field.Type,
+ }))
});
- }
- });
+ });
+ }
}
return {
vids: [...vids],
- edges
+ edges,
+ err
};
};
@@ -744,7 +753,7 @@ export class SchemaStore {
};
getSchemaSnapshot = async (space) => {
- const res = await service.getSchemaSnapshot(space, {
+ const res = await service.getSchemaSnapshot({ space }, {
trackEventConfig: {
category: 'schema',
action: 'get_schema_visualization',
diff --git a/server/api/studio/internal/handler/routes.go b/server/api/studio/internal/handler/routes.go
index 0e3f701e..06e57a93 100644
--- a/server/api/studio/internal/handler/routes.go
+++ b/server/api/studio/internal/handler/routes.go
@@ -168,12 +168,12 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
[]rest.Route{
{
Method: http.MethodPut,
- Path: "/api/schema/:space/snapshot",
+ Path: "/api/schema/snapshot",
Handler: schema.UpdateHandler(serverCtx),
},
{
Method: http.MethodGet,
- Path: "/api/schema/:space/snapshot",
+ Path: "/api/schema/snapshot",
Handler: schema.GetSnapshotHandler(serverCtx),
},
},
diff --git a/server/api/studio/internal/types/types.go b/server/api/studio/internal/types/types.go
index 6632e6b3..9472eccb 100644
--- a/server/api/studio/internal/types/types.go
+++ b/server/api/studio/internal/types/types.go
@@ -285,11 +285,11 @@ type SketchIDResult struct {
}
type GetSchemaSnapshotRequest struct {
- Space string `path:"space"`
+ Space string `form:"space"`
}
type UpdateSchemaSnapshotRequest struct {
- Space string `path:"space"`
+ Space string `json:"space"`
Snapshot string `json:"snapshot"`
}
diff --git a/server/api/studio/restapi/schema.api b/server/api/studio/restapi/schema.api
index a59e51b4..13f8acb4 100644
--- a/server/api/studio/restapi/schema.api
+++ b/server/api/studio/restapi/schema.api
@@ -1,10 +1,10 @@
type (
GetSchemaSnapshotRequest {
- Space string `path:"space"`
+ Space string `form:"space"`
}
UpdateSchemaSnapshotRequest {
- Space string `path:"space"`
+ Space string `json:"space"`
Snapshot string `json:"snapshot"`
}
@@ -21,9 +21,9 @@ type (
service studio-api {
@doc "Update Schema Snapshot"
@handler Update
- put /api/schema/:space/snapshot (UpdateSchemaSnapshotRequest)
+ put /api/schema/snapshot (UpdateSchemaSnapshotRequest)
@doc "Get Schema Snapshot"
@handler GetSnapshot
- get /api/schema/:space/snapshot (GetSchemaSnapshotRequest) returns (SchemaSnapshot)
+ get /api/schema/snapshot (GetSchemaSnapshotRequest) returns (SchemaSnapshot)
}
\ No newline at end of file