Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Fix several issues and release version 0.1.12 #642

Merged
merged 12 commits into from
Dec 17, 2024
12 changes: 12 additions & 0 deletions examples/graphy/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @graphscope/graphy-website

## 0.1.6

### Patch Changes

- update studio graph
- Updated dependencies
- @graphscope/[email protected]
- @graphscope/[email protected]
- @graphscope/[email protected]
- @graphscope/[email protected]
- @graphscope/[email protected]

## 0.1.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/graphy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/graphy-website",
"version": "0.1.5",
"version": "0.1.6",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
30 changes: 20 additions & 10 deletions examples/graphy/src/kuzu-driver/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export class KuzuDriver {

console.log('Schema created: ', result);
}
async uploadCsvFile(file: File): Promise<any> {
async uploadCsvFile(file: File, meta): Promise<any> {
return new Promise((resolve, reject) => {
if (file) {
const reader = new FileReader();
Expand All @@ -258,10 +258,11 @@ export class KuzuDriver {
var label_name = file.name.split('.')[0];
await this.FS.writeFile(filePath, fileData);
var res;

const { delimiter } = meta;
res = await this.conn?.execute(
`COPY ${label_name} FROM "${filePath}" (HEADER=true, DELIM="|", ESCAPE='"', QUOTE='"');`,
`COPY ${label_name} FROM "${filePath}" (HEADER=true, DELIM='${delimiter}');`,
);
console.log('File uploaded successfully!', filePath);
resolve(res); // Resolve the Promise
} catch (error) {
reject(error); // Reject the Promise on error
Expand All @@ -279,15 +280,23 @@ export class KuzuDriver {
});
}
async loadGraph(data_files: File[]): Promise<any> {
const logs: any = {
nodes: [],
edges: [],
};

for (const node of this.schema.nodes) {
const file = data_files.find(item => {
//@ts-ignore
return item.name === node.label + '.csv';
});
if (file) {
console.log('node: ', file.name);
await this.uploadCsvFile(file).then(res => {
console.log('Response received:', res.toString());
await this.uploadCsvFile(file, node.meta).then(res => {
logs.nodes.push({
name: file.name,
message: res.toString(),
});
});
}
}
Expand All @@ -297,14 +306,15 @@ export class KuzuDriver {
return item.name === edge.label + '.csv';
});
if (file) {
console.log('edge: ', file.name);
await this.uploadCsvFile(file).then(res => {
console.log('Response received:', res.toString());
await this.uploadCsvFile(file, edge.meta).then(res => {
logs.edges.push({
name: file.name,
message: res.toString(),
});
});
}
}

return true;
return logs;
}

pathJoin(...segments) {
Expand Down
6 changes: 6 additions & 0 deletions packages/studio-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @graphscope/studio-components

## 0.1.12

### Patch Changes

- update studio graph

## 0.1.11

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/studio-components",
"version": "0.1.11",
"version": "0.1.12",
"description": "A components for graphscope studio",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
9 changes: 9 additions & 0 deletions packages/studio-draw-pattern/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @graphscope/studio-draw-pattern

## 0.0.8

### Patch Changes

- update studio graph
- Updated dependencies
- @graphscope/[email protected]
- @graphscope/[email protected]

## 0.0.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-draw-pattern/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/studio-draw-pattern",
"version": "0.0.7",
"version": "0.0.8",
"description": "Experiment draw pattern code for GrapeScope",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
Expand Down
6 changes: 6 additions & 0 deletions packages/studio-driver/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @graphscope/studio-driver

## 0.1.10

### Patch Changes

- update studio graph

## 0.1.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-driver/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/studio-driver",
"version": "0.1.9",
"version": "0.1.10",
"description": "A library provides a unified interface for interacting with graph databases",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
13 changes: 13 additions & 0 deletions packages/studio-explore/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @graphscope/studio-explore

## 0.1.10

### Patch Changes

- update studio graph
- Updated dependencies
- @graphscope/[email protected]
- @graphscope/[email protected]
- @graphscope/[email protected]
- @graphscope/[email protected]
- @graphscope/[email protected]
- @graphscope/[email protected]

## 0.1.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-explore/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/studio-explore",
"version": "0.1.9",
"version": "0.1.10",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const ImportIntoKuzu: React.FunctionComponent<IImportIntoKuzuProps> = props => {
files: csvFiles,
});

//@ts-ignore
const { success, message } = await useKuzuGraph(datasetId);
const notifyKey = success ? 'success' : 'error';
notification[notifyKey]({
Expand All @@ -55,6 +54,7 @@ const ImportIntoKuzu: React.FunctionComponent<IImportIntoKuzuProps> = props => {
if (success) {
handleClose();
Utils.storage.set('query_endpoint', `kuzu_wasm://${datasetId}`);
window.location.reload();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const transform = (schemaData: ISchema): GraphSchema => {
label,
source,
target,

meta,
properties: properties
.map(p => {
const { name, type } = p;
Expand Down Expand Up @@ -85,6 +85,7 @@ export const transform = (schemaData: ISchema): GraphSchema => {
),
};
});

return {
nodes,
edges,
Expand Down
18 changes: 15 additions & 3 deletions packages/studio-explore/src/services/kuzu-wasm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ export const useKuzuGraph = async (dataset_id: string) => {
// 新的实例,需要清除默认的样式
localStorage.removeItem('GRAPH__STYLE');
const res = await createKuzuGraph(dataset_id);
//自动刷新页面
window.location.reload();
return res;
};

Expand All @@ -56,6 +54,20 @@ export const createKuzuGraph = async (dataset_id: string) => {
const { files, schema } = await getFiles(dataset_id);
await driver.use(dataset_id);
await driver.createSchema(schema);
await driver.loadGraph(files);
const logs = await driver.loadGraph(files);
const error = [...logs.nodes, ...logs.edges].some(item => item.message === 'false');

if (error) {
const message = [...logs.nodes, ...logs.edges]
.map(item => {
const { message, name } = item;
return `${name}: ${message}`;
})
.join(';\n');
return {
success: false,
message: `Some nodes or edges failed to load, please check the data format: ${message}`,
};
}
return await driver.writeBack();
};
8 changes: 8 additions & 0 deletions packages/studio-graph-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @graphscope/studtio-graph-editor

## 0.1.6

### Patch Changes

- update studio graph
- Updated dependencies
- @graphscope/[email protected]

## 0.1.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-graph-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/studio-graph-editor",
"version": "0.1.5",
"version": "0.1.6",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
9 changes: 9 additions & 0 deletions packages/studio-graph/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @graphscope/studio-graph

## 0.1.12

### Patch Changes

- update studio graph
- Updated dependencies
- @graphscope/[email protected]
- @graphscope/[email protected]

## 0.1.11

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-graph/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/studio-graph",
"version": "0.1.11",
"version": "0.1.12",
"description": "A React toolkit for graph analysis based on g6",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ const useEdgeClick = () => {
const { emitter, data, graph } = store;

useEffect(() => {
const dataMap = getDataMap(data);
const handleClick = edge => {
const { id } = edge;
const { source, target } = dataMap.get(id) || {};

const { id, source, target } = edge;
if (edge && source && target) {
updateStore(draft => {
draft.nodeStatus = {
Expand All @@ -20,6 +17,7 @@ const useEdgeClick = () => {
draft.edgeStatus = {
[id]: { selected: true },
};

draft.selectEdges = [edge];
});
}
Expand Down
Loading
Loading