From b7824053f0844dcb834ef756b3b47cfb65d5e1bd Mon Sep 17 00:00:00 2001 From: Nut He <18328704+hetao92@users.noreply.github.com> Date: Thu, 30 Dec 2021 17:09:12 +0800 Subject: [PATCH] feat: support duration data type --- app/assets/config/locale/en-US.json | 1 + app/assets/config/locale/zh-CN.json | 1 + app/assets/modules/Explore/NebulaGraph/index.tsx | 13 ++++++++++++- app/assets/utils/constant.ts | 5 +++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/assets/config/locale/en-US.json b/app/assets/config/locale/en-US.json index 5bb88bcf..342dccb8 100644 --- a/app/assets/config/locale/en-US.json +++ b/app/assets/config/locale/en-US.json @@ -321,6 +321,7 @@ "geography(point)Format": "Supported data inserting methods:
Call function ST_GeogFromText('POINT()'), for example:ST_GeogFromText('POINT(6 10)')", "geography(linestring)Format": "Supported data inserting methods:
Call function ST_GeogFromText('LINESTRING()'), for example:ST_GeogFromText('LINESTRING(3 4,10 50,20 25)')", "geography(polygon)Format": "Supported data inserting methods:
Call function ST_GeogFromText('POLYGON()'), for example:ST_GeogFromText('POLYGON((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2))')", + "durationFormat": "Supported data inserting methods:
Call function duration(), for example:duration({years: 1, seconds: 0})", "cancelOperation": "Do you want to close this panel", "cancelPropmt": "If you close the panel, the configuration will be deleted automatically. Are you sure that you want to close the panel?", "fieldDisabled": "A TTL configuration is set for this property, so it cannot be edited. If you want to edit this property, delete the TTL configuration.", diff --git a/app/assets/config/locale/zh-CN.json b/app/assets/config/locale/zh-CN.json index 75463d41..63b7755f 100644 --- a/app/assets/config/locale/zh-CN.json +++ b/app/assets/config/locale/zh-CN.json @@ -317,6 +317,7 @@ "geography(point)Format": "geo(point) 类型支持插入方式:
调用函数 ST_GeogFromText('POINT()'),例如:ST_GeogFromText('POINT(6 10)')", "geography(linestring)Format": "geo(linestring) 类型支持插入方式:
调用函数 ST_GeogFromText('LINESTRING()'),例如:ST_GeogFromText('LINESTRING(3 4,10 50,20 25)')", "geography(polygon)Format": "geo(polygon) 类型支持插入方式:
调用函数 ST_GeogFromText('POLYGON()'),例如:ST_GeogFromText('POLYGON((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2))')", + "durationFormat": "duration 类型支持插入方式:
调用函数 duration(),例如:duration({years: 1, seconds: 0})", "cancelOperation": "是否取消配置并关闭面板", "cancelPropmt": "关闭面板将删除所有属性,是否继续?", "fieldDisabled": "该属性被 ttl_col 引用,不支持更改操作,如要更改,请先更新 ttl", diff --git a/app/assets/modules/Explore/NebulaGraph/index.tsx b/app/assets/modules/Explore/NebulaGraph/index.tsx index 0e4ad10b..04799e6c 100644 --- a/app/assets/modules/Explore/NebulaGraph/index.tsx +++ b/app/assets/modules/Explore/NebulaGraph/index.tsx @@ -116,7 +116,18 @@ class NebulaGraph extends React.Component { const edgeFieldsValuePairStr = Object.keys(properties) .map(property => { const value = properties[property]; - return `
${link.type}.${property}: ${value}
`; + return `
${ + link.type + }.${property}: ${ + typeof value !== 'string' + ? convertBigNumberToString(value) + : JSON.stringify(value, (_, value) => { + if (typeof value === 'string') { + return value.replace(/\u0000+$/, ''); + } + return value; + }) + }
`; }) .join(''); this.$tooltip.html( diff --git a/app/assets/utils/constant.ts b/app/assets/utils/constant.ts index 6cd9d9a0..0c65e14d 100644 --- a/app/assets/utils/constant.ts +++ b/app/assets/utils/constant.ts @@ -172,6 +172,10 @@ export const DATA_TYPE = [ value: 'geography(polygon)', label: 'geography(polygon)', }, + { + value: 'duration', + label: 'duration', + }, ]; export const RELATION_OPERATORS = [ @@ -202,6 +206,7 @@ export const EXPLAIN_DATA_TYPE = [ 'geography(point)', 'geography(linestring)', 'geography(polygon)', + 'duration', ]; export const NAME_REGEX = /^[a-zA-Z][a-zA-Z0-9_]*$/;