Skip to content

Commit

Permalink
feat: support duration data type (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
hetao92 authored Dec 30, 2021
1 parent c25cfe4 commit 02eb29c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/assets/config/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@
"geography(point)Format": "Supported data inserting methods: <br /> Call function ST_GeogFromText('POINT()'), for example:ST_GeogFromText('POINT(6 10)')",
"geography(linestring)Format": "Supported data inserting methods: <br /> Call function ST_GeogFromText('LINESTRING()'), for example:ST_GeogFromText('LINESTRING(3 4,10 50,20 25)')",
"geography(polygon)Format": "Supported data inserting methods: <br /> 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: <br /> Call function duration(<map>), 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.",
Expand Down
1 change: 1 addition & 0 deletions app/assets/config/locale/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@
"geography(point)Format": "geo(point) 类型支持插入方式: <br /> 调用函数 ST_GeogFromText('POINT()'),例如:ST_GeogFromText('POINT(6 10)')",
"geography(linestring)Format": "geo(linestring) 类型支持插入方式: <br /> 调用函数 ST_GeogFromText('LINESTRING()'),例如:ST_GeogFromText('LINESTRING(3 4,10 50,20 25)')",
"geography(polygon)Format": "geo(polygon) 类型支持插入方式: <br /> 调用函数 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 类型支持插入方式: <br /> 调用函数 duration(<map>),例如:duration({years: 1, seconds: 0})",
"cancelOperation": "是否取消配置并关闭面板",
"cancelPropmt": "关闭面板将删除所有属性,是否继续?",
"fieldDisabled": "该属性被 ttl_col 引用,不支持更改操作,如要更改,请先更新 ttl",
Expand Down
13 changes: 12 additions & 1 deletion app/assets/modules/Explore/NebulaGraph/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,18 @@ class NebulaGraph extends React.Component<IProps, IState> {
const edgeFieldsValuePairStr = Object.keys(properties)
.map(property => {
const value = properties[property];
return `<div key=${property}><span>${link.type}.${property}: </span><span>${value}</span></div>`;
return `<div key=${property}><span>${
link.type
}.${property}: </span><span>${
typeof value !== 'string'
? convertBigNumberToString(value)
: JSON.stringify(value, (_, value) => {
if (typeof value === 'string') {
return value.replace(/\u0000+$/, '');
}
return value;
})
}</span></div>`;
})
.join('');
this.$tooltip.html(
Expand Down
5 changes: 5 additions & 0 deletions app/assets/utils/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ export const DATA_TYPE = [
value: 'geography(polygon)',
label: 'geography(polygon)',
},
{
value: 'duration',
label: 'duration',
},
];

export const RELATION_OPERATORS = [
Expand Down Expand Up @@ -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_]*$/;
Expand Down

0 comments on commit 02eb29c

Please sign in to comment.