From 9a8bf5a031c0293fca4a3bfc8c7eea31efafbfba Mon Sep 17 00:00:00 2001 From: Bruce Date: Tue, 23 Apr 2024 16:19:42 +0800 Subject: [PATCH] cherry-pick (#794) * fix: create tag/edge statement with empty [NULL|NOT NULL] value (#762) mod: version@3.9.1 (cherry picked from commit f48cef763e905210a9b0255433437bb5584ac71c) * fix: resolves page crash issue during to many attribute editing on `/import/edit/${id}` page (#792) docs: assistant (cherry picked from commit 9c19645abfe64d874192fd36065e14a42306059d) * fix: import template file (#793) (cherry picked from commit 2db7ea275c7830655be65e24f05f3e67dc0e2d03) --- README.md | 2 +- app/components/CSVPreviewLink/index.tsx | 3 +- app/components/FileConfigSetting/index.tsx | 3 +- .../LocalFileList/PreviewFileModal/index.tsx | 3 +- app/pages/LLMBot/chat.tsx | 2 +- app/pages/LLMBot/index.tsx | 2 +- app/stores/llm.ts | 4 +- app/utils/gql.ts | 6 +- app/utils/import.ts | 319 +++++++++--------- deployment/docker/docker-compose.yml | 2 +- package-lock.json | 4 +- package.json | 2 +- 12 files changed, 181 insertions(+), 171 deletions(-) diff --git a/README.md b/README.md index 92898250..7648b490 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Use when you want shutdown the web app kill -9 $(lsof -t -i :7001) ``` -## Documentation 3.9.0 +## Documentation 3.9.2 [中文](https://docs.nebula-graph.com.cn/3.6.0/nebula-studio/about-studio/st-ug-what-is-graph-studio/) [ENGLISH](https://docs.nebula-graph.io/3.6.0/nebula-studio/about-studio/st-ug-what-is-graph-studio/) diff --git a/app/components/CSVPreviewLink/index.tsx b/app/components/CSVPreviewLink/index.tsx index ff51c030..8b73347b 100644 --- a/app/components/CSVPreviewLink/index.tsx +++ b/app/components/CSVPreviewLink/index.tsx @@ -31,7 +31,8 @@ const CSVPreviewLink = (props: IProps) => { let data = []; readString(sample, { delimiter, - worker: true, + // @ts-ignore + worker: false, skipEmptyLines: true, step: (row) => { data = [...data, row.data]; diff --git a/app/components/FileConfigSetting/index.tsx b/app/components/FileConfigSetting/index.tsx index f9fe9096..94495b11 100644 --- a/app/components/FileConfigSetting/index.tsx +++ b/app/components/FileConfigSetting/index.tsx @@ -75,7 +75,8 @@ const FileConfigSetting = (props: IProps) => { if (activeItem.sample !== undefined) { readString(activeItem.sample, { delimiter: activeItem.delimiter || ',', - worker: true, + // @ts-ignore + worker: false, skipEmptyLines: true, step: (row) => { content = [...content, row.data]; diff --git a/app/pages/Import/DatasourceList/LocalFileList/PreviewFileModal/index.tsx b/app/pages/Import/DatasourceList/LocalFileList/PreviewFileModal/index.tsx index 504deba2..a16bf09a 100644 --- a/app/pages/Import/DatasourceList/LocalFileList/PreviewFileModal/index.tsx +++ b/app/pages/Import/DatasourceList/LocalFileList/PreviewFileModal/index.tsx @@ -53,7 +53,8 @@ const PreviewFileModal = (props: IProps) => { let data = []; readString(sample, { delimiter: delimiter || file.delimiter, - worker: true, + // @ts-ignore + worker: false, skipEmptyLines: true, step: (row) => { data = [...data, row.data]; diff --git a/app/pages/LLMBot/chat.tsx b/app/pages/LLMBot/chat.tsx index ec900caf..2cfb4d2a 100644 --- a/app/pages/LLMBot/chat.tsx +++ b/app/pages/LLMBot/chat.tsx @@ -24,7 +24,7 @@ function Chat() { const newMessages = [ ...beforeMessages, { role: 'user', content: currentInput }, - { role: 'assistant', content: '', status: 'pending' }, // asistant can't be changed + { role: 'assistant', content: '', status: 'pending' }, // assistant can't be changed ]; llm.update({ currentInput: '', diff --git a/app/pages/LLMBot/index.tsx b/app/pages/LLMBot/index.tsx index 8ff9665c..c1ded399 100644 --- a/app/pages/LLMBot/index.tsx +++ b/app/pages/LLMBot/index.tsx @@ -26,7 +26,7 @@ function LLMBot() { content={} title={
-
AI Asistant
+
AI Assistant
text2match { const { indexes, prefix, suffix, vidFunction, type } = payload; const id = { type, function: vidFunction, } as any; - if(indexes.length > 1 || !!prefix || !!suffix) { + if (indexes.length > 1 || !!prefix || !!suffix) { id.concatItems = [...indexes]; prefix && id.concatItems.unshift(prefix); suffix && id.concatItems.push(suffix); @@ -77,14 +71,22 @@ const getIdConfig = (payload: { } return id; }; -export function edgeDataToJSON( - configs: IEdgeItem[], - spaceVidType: string, -) { +export function edgeDataToJSON(configs: IEdgeItem[], spaceVidType: string) { const result = configs.reduce((acc: any, cur) => { const { name, files } = cur; - const _config = files.map(item => { - const { file, props, srcIdIndex, srcIdFunction, dstIdIndex, dstIdFunction, srcIdPrefix, srcIdSuffix, dstIdPrefix, dstIdSuffix } = item; + const _config = files.map((item) => { + const { + file, + props, + srcIdIndex, + srcIdFunction, + dstIdIndex, + dstIdFunction, + srcIdPrefix, + srcIdSuffix, + dstIdPrefix, + dstIdSuffix, + } = item; const vidType = spaceVidType === 'INT64' ? 'int' : 'string'; // rank is the last prop const rank = props[props.length - 1]; @@ -99,37 +101,39 @@ export function edgeDataToJSON( }); return acc; }, []); - const edges = [{ - name: handleEscape(name), - src: { - id: getIdConfig({ - indexes: srcIdIndex, - prefix: srcIdPrefix, - suffix: srcIdSuffix, - vidFunction: srcIdFunction, - type: vidType, - }) - }, - dst: { - id: getIdConfig({ - indexes: dstIdIndex, - prefix: dstIdPrefix, - suffix: dstIdSuffix, - vidFunction: dstIdFunction, - type: vidType, - }) + const edges = [ + { + name: handleEscape(name), + src: { + id: getIdConfig({ + indexes: srcIdIndex, + prefix: srcIdPrefix, + suffix: srcIdSuffix, + vidFunction: srcIdFunction, + type: vidType, + }), + }, + dst: { + id: getIdConfig({ + indexes: dstIdIndex, + prefix: dstIdPrefix, + suffix: dstIdSuffix, + vidFunction: dstIdFunction, + type: vidType, + }), + }, + rank: typeof rank.mapping == 'number' ? { index: rank.mapping } : null, + props: edgeProps, }, - rank: typeof rank.mapping == 'number' ? { index: rank.mapping } : null, - props: edgeProps, - }]; + ]; const edgeConfig = { csv: { withHeader: file.withHeader || false, - delimiter: file.delimiter + delimiter: file.delimiter, }, edges, } as any; - if(file.datasourceId) { + if (file.datasourceId) { edgeConfig.datasourceId = file.datasourceId; edgeConfig.datasourceFilePath = file.path; } else { @@ -143,13 +147,10 @@ export function edgeDataToJSON( return result; } -export function tagDataToJSON( - configs: ITagItem[], - spaceVidType: string, -) { +export function tagDataToJSON(configs: ITagItem[], spaceVidType: string) { const result = configs.reduce((acc: any, cur) => { const { name, files } = cur; - const _config = files.map(item => { + const _config = files.map((item) => { const { file, props, vidIndex, vidFunction, vidPrefix, vidSuffix } = item; const _props = props.reduce((acc: any, cur) => { if (isEmpty(cur.mapping) && (cur.allowNull || cur.isDefault)) { @@ -162,25 +163,27 @@ export function tagDataToJSON( }); return acc; }, []); - const tags = [{ - name: handleEscape(name), - id: getIdConfig({ - indexes: vidIndex, - prefix: vidPrefix, - suffix: vidSuffix, - vidFunction, - type: spaceVidType === 'INT64' ? 'int' : 'string', - }), - props: _props.filter(prop => prop), - }]; + const tags = [ + { + name: handleEscape(name), + id: getIdConfig({ + indexes: vidIndex, + prefix: vidPrefix, + suffix: vidSuffix, + vidFunction, + type: spaceVidType === 'INT64' ? 'int' : 'string', + }), + props: _props.filter((prop) => prop), + }, + ]; const result = { csv: { withHeader: file.withHeader || false, - delimiter: file.delimiter + delimiter: file.delimiter, }, - tags + tags, } as any; - if(file.datasourceId) { + if (file.datasourceId) { result.datasourceId = file.datasourceId; result.datasourceFilePath = file.path; } else { @@ -195,116 +198,118 @@ export function tagDataToJSON( } export const exampleJson = { - 'client': { - 'version': 'v3', - 'user': '', - 'password': '', - 'address': '' + client: { + version: 'v3', + user: '', + password: '', + address: '', }, - 'manager': { - 'spaceName': 'sales', + manager: { + spaceName: 'sales', }, - 'sources': [ + sources: [ { - 'path': 'item.csv', - 'csv': { - 'withHeader': false, - 'delimiter': null + path: 'item.csv', + csv: { + withHeader: false, + delimiter: null, }, - 'tags': [ + tags: [ { - 'name': 'item', - 'vid': { - 'index': 0, - 'function': null, - 'type': 'string', + name: 'item', + id: { + index: 0, + function: null, + type: 'string', }, - 'props': [ + props: [ { - 'name': 'id_single_item', - 'type': 'string', - 'index': 0 + name: 'id_single_item', + type: 'string', + index: 0, }, { - 'name': 'region', - 'type': 'string', - 'index': 1 + name: 'region', + type: 'string', + index: 1, }, { - 'name': 'country', - 'type': 'string', - 'index': 2 + name: 'country', + type: 'string', + index: 2, }, { - 'name': 'item_type', - 'type': 'string', - 'index': 3 + name: 'item_type', + type: 'string', + index: 3, }, { - 'name': 'sales_channel', - 'type': 'string', - 'index': 4 - } - ] - } - ] + name: 'sales_channel', + type: 'string', + index: 4, + }, + ], + }, + ], }, { - 'path': 'orderr.csv', - 'csv': { - 'withHeader': false, - 'delimiter': null + path: 'orderr.csv', + csv: { + withHeader: false, + delimiter: null, }, - 'edges': [{ - 'name': 'order', - 'props': [ - { - 'name': 'order_id', - 'type': 'string', - 'index': 0 - }, - { - 'name': 'id_item', - 'type': 'string', - 'index': 0 - }, - { - 'name': 'unit_sold', - 'type': 'string', - 'index': 2 - }, - { - 'name': 'unit_price', - 'type': 'string', - 'index': 3 + edges: [ + { + name: 'order', + props: [ + { + name: 'order_id', + type: 'string', + index: 0, + }, + { + name: 'id_item', + type: 'string', + index: 0, + }, + { + name: 'unit_sold', + type: 'string', + index: 2, + }, + { + name: 'unit_price', + type: 'string', + index: 3, + }, + { + name: 'unit_cost', + type: 'string', + index: 4, + }, + { + name: 'total_profit', + type: 'string', + index: 5, + }, + ], + src: { + id: { + index: 1, + function: null, + type: 'string', + }, }, - { - 'name': 'unit_cost', - 'type': 'string', - 'index': 4 + dst: { + id: { + index: 1, + function: null, + type: 'string', + }, }, - { - 'name': 'total_profit', - 'type': 'string', - 'index': 5 - } - ], - 'src': { - 'id': { - 'index': 1, - 'function': null, - 'type': 'string', - } - }, - 'dst': { - 'id': { - 'index': 1, - 'function': null, - 'type': 'string', - } + rank: null, }, - 'rank': null - }], - } - ] -}; \ No newline at end of file + ], + }, + ], +}; diff --git a/deployment/docker/docker-compose.yml b/deployment/docker/docker-compose.yml index 5f64bee9..760a2c83 100644 --- a/deployment/docker/docker-compose.yml +++ b/deployment/docker/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.4' services: web: - image: vesoft/nebula-graph-studio:v3.9.0 + image: vesoft/nebula-graph-studio:v3.9.2 environment: USER: root ports: diff --git a/package-lock.json b/package-lock.json index 25b43e12..ba7ea5ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nebula-graph-studio", - "version": "3.9.0", + "version": "3.9.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "nebula-graph-studio", - "version": "3.9.0", + "version": "3.9.2", "hasInstallScript": true, "license": "Apache 2.0", "dependencies": { diff --git a/package.json b/package.json index dd9360b1..a4f09ccc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nebula-graph-studio", - "version": "3.9.0", + "version": "3.9.2", "description": "nebula-graph-studio", "private": true, "repository": {