From 90bbe204f6eeb3a3c94048caf909ef452153f8ea Mon Sep 17 00:00:00 2001 From: Nut He <18328704+hetao92@users.noreply.github.com> Date: Thu, 24 Feb 2022 16:12:48 +0800 Subject: [PATCH] mod: remove files (#129) --- app-v2/app.less | 166 --- app-v2/common.less | 8 - app-v2/components/GQLCodeMirror/index.less | 16 - app-v2/components/GQLCodeMirror/index.tsx | 29 - app-v2/components/Icon/index.tsx | 7 - app-v2/components/Modal.tsx | 79 -- app-v2/components/index.ts | 1 - app-v2/config/codeLog.ts | 1 - app-v2/config/constants.ts | 18 - app-v2/config/explore.ts | 228 ----- app-v2/config/index.ts | 5 - app-v2/config/locale/en-US.json | 394 ------- app-v2/config/locale/zh-CN.json | 390 ------- app-v2/config/nebulaQL.ts | 231 ----- app-v2/config/rules.ts | 68 -- app-v2/config/service.ts | 48 - app-v2/context/LanguageContext.ts | 14 - app-v2/context/index.ts | 5 - app-v2/index.html | 84 -- app-v2/index.tsx | 76 -- app-v2/static/import.d.ts | 7 - app-v2/utils/constant.ts | 213 ---- app-v2/utils/fetch.ts | 83 -- app-v2/utils/file.ts | 20 - app-v2/utils/function.ts | 39 - app-v2/utils/gql.ts | 268 ----- app-v2/utils/http.ts | 110 -- app-v2/utils/import.ts | 286 ------ app-v2/utils/index.ts | 4 - app-v2/utils/interface.ts | 17 - app-v2/utils/parseData.ts | 196 ---- app-v2/utils/stat.ts | 79 -- app-v2/utils/url.ts | 9 - app/App.less | 263 +++-- app/App.tsx | 380 ------- {app-v2 => app}/AuthorizedRoute.tsx | 2 +- app/PrivateRoute.tsx | 33 - app/common.less | 10 +- {app-v2 => app}/components/Avatar/index.tsx | 0 .../components/Breadcrumb/index.less | 0 .../components/Breadcrumb/index.tsx | 2 +- app/components/Button/index.less | 27 - app/components/Button/index.tsx | 120 --- app/components/CSVPreviewLink.less | 25 - app/components/CSVPreviewLink.tsx | 95 -- .../components/CSVPreviewLink/index.less | 2 +- .../components/CSVPreviewLink/index.tsx | 0 app/components/CodeMirror.tsx | 193 ---- .../components/CodeMirror/index.less | 0 .../components/CodeMirror/index.tsx | 2 +- app/components/Codemirror.less | 9 - app/components/ColorPicker/index.less | 20 - app/components/ColorPicker/index.tsx | 57 -- app/components/ConfigServerForm/index.less | 7 - app/components/ConfigServerForm/index.tsx | 59 -- .../DisplayPanel/ExpandForm/index.less | 103 -- .../DisplayPanel/ExpandForm/index.tsx | 184 ---- .../DisplayPanel/ExpandItem/index.less | 60 -- .../DisplayPanel/ExpandItem/index.tsx | 132 --- .../SelectedGraphDetailShowModal/index.less | 36 - .../SelectedGraphDetailShowModal/index.tsx | 284 ------ app/components/DisplayPanel/index.less | 89 -- app/components/DisplayPanel/index.tsx | 101 -- .../Expand/AddFilterForm/index.less | 26 - app/components/Expand/AddFilterForm/index.tsx | 47 - app/components/Expand/ExpandForm/index.less | 168 --- app/components/Expand/ExpandForm/index.tsx | 537 ---------- app/components/Expand/index.less | 86 -- app/components/Expand/index.tsx | 88 -- app/components/GQLCodeMirror/index.less | 8 + app/components/GQLCodeMirror/index.tsx | 6 +- app/components/GQLModal/index.less | 10 - app/components/GQLModal/index.tsx | 62 -- app/components/Icon/index.tsx | 17 +- app/components/IconPicker/iconCfg.ts | 124 --- app/components/IconPicker/index.less | 24 - app/components/IconPicker/index.tsx | 71 -- app/components/Instruction/index.less | 4 - app/components/Instruction/index.tsx | 18 - app/components/NebulaD3/Links.tsx | 96 -- app/components/NebulaD3/NodeTexts.tsx | 54 - app/components/NebulaD3/SelectIds.tsx | 212 ---- app/components/NebulaD3/index.less | 56 - app/components/NebulaD3/index.tsx | 575 ----------- app/components/OutputBox/Export.less | 34 - app/components/OutputBox/Export.tsx | 170 ---- app/components/OutputBox/Graphviz.less | 9 - app/components/OutputBox/Graphviz.tsx | 38 - app/components/OutputBox/index.less | 85 -- app/components/OutputBox/index.tsx | 261 ----- app/components/OutputCsv/index.tsx | 62 -- app/components/VertexStyleSet/DisplayBtn.tsx | 30 - .../VertexStyleSet/StyleSetTabs.tsx | 34 - app/components/VertexStyleSet/index.tsx | 46 - app/components/index.ts | 5 - app/config/explore.ts | 3 +- app/config/locale/en-US.json | 103 +- app/config/locale/zh-CN.json | 101 +- app/config/rules.ts | 2 +- app/config/service.ts | 7 +- app/context/LanguageContext.ts | 14 +- app/index.html | 4 +- app/index.tsx | 83 +- {app-v2 => app}/interfaces/import.ts | 0 {app-v2 => app}/interfaces/schema.ts | 0 app/modules/ConfigServer/index.less | 19 - app/modules/ConfigServer/index.tsx | 46 - app/modules/Console/SpaceSearchInput.tsx | 56 - app/modules/Console/index.less | 153 --- app/modules/Console/index.tsx | 294 ------ .../Explore/Control/AlgorithmQuery/index.less | 16 - .../Explore/Control/AlgorithmQuery/index.tsx | 205 ---- .../Explore/Control/CustomQuery/index.less | 20 - .../Explore/Control/CustomQuery/index.tsx | 39 - .../Explore/Control/IdQuery/index.less | 46 - app/modules/Explore/Control/IdQuery/index.tsx | 120 --- app/modules/Explore/Control/ImportNode.tsx | 48 - .../Control/IndexQuery/IndexIntroduction.less | 45 - .../Control/IndexQuery/IndexIntroduction.tsx | 76 -- .../Control/IndexQuery/IndexMatch.less | 77 -- .../Explore/Control/IndexQuery/IndexMatch.tsx | 505 --------- .../Explore/Control/IndexQuery/index.tsx | 50 - app/modules/Explore/Control/index.less | 49 - app/modules/Explore/Control/index.tsx | 129 --- app/modules/Explore/Init.tsx | 79 -- app/modules/Explore/InitVertexes.less | 16 - app/modules/Explore/InitVertexes.tsx | 87 -- .../Explore/NebulaGraph/Menu/index.less | 81 -- .../Explore/NebulaGraph/Menu/index.tsx | 132 --- .../NebulaGraph/Panel/Delete/index.tsx | 56 - .../NebulaGraph/Panel/Expand/index.tsx | 51 - .../NebulaGraph/Panel/Export/index.less | 16 - .../NebulaGraph/Panel/Export/index.tsx | 158 --- .../Panel/HotKeysDescription/index.tsx | 71 -- .../Explore/NebulaGraph/Panel/Lock/index.tsx | 66 -- .../Explore/NebulaGraph/Panel/Move/index.tsx | 83 -- .../NebulaGraph/Panel/PropsDisplay/index.less | 22 - .../NebulaGraph/Panel/PropsDisplay/index.tsx | 173 ---- .../Panel/PropsDisplay/setting.less | 19 - .../Panel/PropsDisplay/setting.tsx | 59 -- .../NebulaGraph/Panel/Rollback/index.tsx | 80 -- .../NebulaGraph/Panel/Search/index.tsx | 161 --- .../NebulaGraph/Panel/UnExpandBtn/index.tsx | 41 - .../NebulaGraph/Panel/Unlock/index.tsx | 67 -- .../Panel/VertexStyleSetBtn/index.less | 122 --- .../Panel/VertexStyleSetBtn/index.tsx | 116 --- .../Explore/NebulaGraph/Panel/Zoom/index.tsx | 100 -- .../Explore/NebulaGraph/Panel/index.less | 37 - .../Explore/NebulaGraph/Panel/index.tsx | 152 --- app/modules/Explore/NebulaGraph/index.less | 52 - app/modules/Explore/NebulaGraph/index.tsx | 269 ----- app/modules/Explore/index.less | 42 - app/modules/Explore/index.tsx | 69 -- app/modules/Import/Progress/index.tsx | 81 -- app/modules/Import/Tasks/Add.less | 20 - app/modules/Import/Tasks/Add.tsx | 102 -- app/modules/Import/Tasks/ConfigEdge/Edge.less | 13 - app/modules/Import/Tasks/ConfigEdge/Edge.tsx | 170 ---- .../Import/Tasks/ConfigEdge/index.less | 43 - app/modules/Import/Tasks/ConfigEdge/index.tsx | 115 --- .../Import/Tasks/ConfigVertex/Tag.less | 51 - app/modules/Import/Tasks/ConfigVertex/Tag.tsx | 256 ----- .../Import/Tasks/ConfigVertex/TagList.less | 14 - .../Import/Tasks/ConfigVertex/TagList.tsx | 50 - .../Import/Tasks/ConfigVertex/index.less | 49 - .../Import/Tasks/ConfigVertex/index.tsx | 115 --- app/modules/Import/Tasks/Import.less | 9 - app/modules/Import/Tasks/Import.tsx | 377 ------- app/modules/Import/Tasks/Init.less | 64 -- app/modules/Import/Tasks/Init.tsx | 96 -- app/modules/Import/Tasks/Next.tsx | 71 -- app/modules/Import/Tasks/Prev.tsx | 49 - app/modules/Import/Tasks/Upload.less | 43 - app/modules/Import/Tasks/Upload.tsx | 194 ---- app/modules/Import/Tasks/index.tsx | 39 - app/modules/Import/index.less | 102 -- app/modules/Import/index.tsx | 43 - app/modules/Schema/CreateSpace/index.less | 39 - app/modules/Schema/CreateSpace/index.tsx | 257 ----- app/modules/Schema/Edge/Create.less | 57 -- app/modules/Schema/Edge/Create.tsx | 451 -------- app/modules/Schema/Edge/Edit.less | 43 - app/modules/Schema/Edge/Edit.tsx | 959 ------------------ app/modules/Schema/Edge/index.less | 12 - app/modules/Schema/Edge/index.tsx | 229 ----- app/modules/Schema/Index/Create.less | 66 -- app/modules/Schema/Index/Create.tsx | 417 -------- app/modules/Schema/Index/DraggableTags.tsx | 91 -- app/modules/Schema/Index/index.less | 18 - app/modules/Schema/Index/index.tsx | 264 ----- app/modules/Schema/Search/index.less | 3 - app/modules/Schema/Search/index.tsx | 24 - app/modules/Schema/SpaceConfig/index.less | 110 -- app/modules/Schema/SpaceConfig/index.tsx | 224 ---- app/modules/Schema/Tag/Create.less | 61 -- app/modules/Schema/Tag/Create.tsx | 452 --------- app/modules/Schema/Tag/Edit.less | 43 - app/modules/Schema/Tag/Edit.tsx | 957 ----------------- app/modules/Schema/Tag/index.less | 12 - app/modules/Schema/Tag/index.tsx | 230 ----- app/modules/Schema/index.less | 30 - app/modules/Schema/index.tsx | 236 ----- .../pages/Import/FileUpload/index.less | 2 +- .../pages/Import/FileUpload/index.tsx | 10 +- .../Import/TaskCreate/FileSelect/index.less | 0 .../Import/TaskCreate/FileSelect/index.tsx | 4 +- .../TaskCreate/PasswordInputModal/index.less | 0 .../TaskCreate/PasswordInputModal/index.tsx | 0 .../SchemaConfig/EdgeConfig/index.tsx | 4 +- .../SchemaConfig/TagConfig/index.tsx | 4 +- .../Import/TaskCreate/SchemaConfig/index.less | 2 +- .../Import/TaskCreate/SchemaConfig/index.tsx | 6 +- .../pages/Import/TaskCreate/index.less | 2 +- .../pages/Import/TaskCreate/index.tsx | 10 +- .../pages/Import/TaskList/TaskItem/index.less | 2 +- .../pages/Import/TaskList/TaskItem/index.tsx | 4 +- .../pages/Import/TaskList/index.less | 2 +- .../pages/Import/TaskList/index.tsx | 8 +- {app-v2 => app}/pages/Import/index.less | 0 {app-v2 => app}/pages/Import/index.tsx | 2 +- .../pages/Login/LanguageSelect/index.less | 2 +- .../pages/Login/LanguageSelect/index.tsx | 6 +- {app-v2 => app}/pages/Login/index.less | 2 +- {app-v2 => app}/pages/Login/index.tsx | 8 +- .../pages/MainPage/Header/HelpMenu/index.less | 0 .../pages/MainPage/Header/HelpMenu/index.tsx | 10 +- .../pages/MainPage/Header/index.less | 0 .../pages/MainPage/Header/index.tsx | 4 +- {app-v2 => app}/pages/MainPage/index.less | 2 +- {app-v2 => app}/pages/MainPage/index.tsx | 0 {app-v2 => app}/pages/MainPage/routes.tsx | 10 +- .../Create/CommonCreate/PropertiesForm.tsx | 6 +- .../Create/CommonCreate/TTLForm.tsx | 0 .../Create/CommonCreate/index.less | 2 +- .../Create/CommonCreate/index.tsx | 10 +- .../Edit/CommonEdit/PropertiesForm.tsx | 4 +- .../Edit/CommonEdit/PropertiesRow.tsx | 6 +- .../SchemaConfig/Edit/CommonEdit/TTLForm.tsx | 2 +- .../SchemaConfig/Edit/CommonEdit/index.less | 2 +- .../SchemaConfig/Edit/CommonEdit/index.tsx | 8 +- .../SchemaConfig/List/CommonLayout/index.less | 0 .../SchemaConfig/List/CommonLayout/index.tsx | 2 +- .../Schema/SchemaConfig/List/Edge/index.tsx | 8 +- .../Schema/SchemaConfig/List/Index/index.less | 2 +- .../Schema/SchemaConfig/List/Index/index.tsx | 8 +- .../SchemaConfig/List/Search/index.less | 0 .../Schema/SchemaConfig/List/Search/index.tsx | 0 .../Schema/SchemaConfig/List/Tag/index.tsx | 8 +- .../pages/Schema/SchemaConfig/index.less | 2 +- .../pages/Schema/SchemaConfig/index.tsx | 6 +- .../pages/Schema/SpaceCreate/index.less | 2 +- .../pages/Schema/SpaceCreate/index.tsx | 12 +- {app-v2 => app}/pages/Schema/index.less | 2 +- {app-v2 => app}/pages/Schema/index.tsx | 6 +- {app-v2 => app}/static/fonts/Roboto-Black.ttf | Bin {app-v2 => app}/static/fonts/Roboto-Bold.ttf | Bin {app-v2 => app}/static/fonts/Roboto-Light.ttf | Bin .../static/fonts/Roboto-Medium.ttf | Bin .../static/fonts/Roboto-Regular.ttf | Bin app/static/fonts/iconfont.css | 487 --------- {app-v2 => app}/static/fonts/iconfont.js | 0 app/static/fonts/iconfont.ttf | Bin 35776 -> 0 bytes app/static/fonts/iconfont.woff | Bin 22760 -> 0 bytes app/static/fonts/iconfont.woff2 | Bin 19260 -> 0 bytes .../static/images/background_login.png | Bin app/static/images/explore-empty.png | Bin 121792 -> 0 bytes app/static/images/go-to-explore_en.png | Bin 63714 -> 0 bytes app/static/images/go-to-explore_zh.png | Bin 58913 -> 0 bytes {app-v2 => app}/static/images/nebula_logo.png | Bin app/static/images/studio-logo.png | Bin 8957 -> 0 bytes app/store/index.ts | 24 - app/store/models/app.ts | 33 - app/store/models/console.ts | 91 -- app/store/models/d3Graph.ts | 31 - app/store/models/explore.ts | 651 ------------ app/store/models/import.ts | 526 ---------- app/store/models/index.ts | 18 - app/store/models/nebula.ts | 778 -------------- {app-v2 => app}/stores/console.ts | 2 +- {app-v2 => app}/stores/files.ts | 2 +- {app-v2 => app}/stores/global.ts | 2 +- {app-v2 => app}/stores/import.ts | 4 +- {app-v2 => app}/stores/index.ts | 0 {app-v2 => app}/stores/schema.ts | 8 +- {app-v2 => app}/stores/types.d.ts | 0 app/utils/file.ts | 14 +- app/utils/function.ts | 2 +- app/utils/gql.ts | 53 +- app/utils/http.ts | 8 +- app/utils/import.ts | 36 +- config/webpack.base.ts | 4 +- config/webpack.dev2.ts | 71 -- package.json | 5 +- tsconfig.json | 2 +- 294 files changed, 548 insertions(+), 23303 deletions(-) delete mode 100644 app-v2/app.less delete mode 100644 app-v2/common.less delete mode 100644 app-v2/components/GQLCodeMirror/index.less delete mode 100644 app-v2/components/GQLCodeMirror/index.tsx delete mode 100644 app-v2/components/Icon/index.tsx delete mode 100644 app-v2/components/Modal.tsx delete mode 100644 app-v2/components/index.ts delete mode 100644 app-v2/config/codeLog.ts delete mode 100644 app-v2/config/constants.ts delete mode 100644 app-v2/config/explore.ts delete mode 100644 app-v2/config/index.ts delete mode 100644 app-v2/config/locale/en-US.json delete mode 100644 app-v2/config/locale/zh-CN.json delete mode 100644 app-v2/config/nebulaQL.ts delete mode 100644 app-v2/config/rules.ts delete mode 100644 app-v2/config/service.ts delete mode 100644 app-v2/context/LanguageContext.ts delete mode 100644 app-v2/context/index.ts delete mode 100644 app-v2/index.html delete mode 100644 app-v2/index.tsx delete mode 100644 app-v2/static/import.d.ts delete mode 100644 app-v2/utils/constant.ts delete mode 100644 app-v2/utils/fetch.ts delete mode 100644 app-v2/utils/file.ts delete mode 100644 app-v2/utils/function.ts delete mode 100644 app-v2/utils/gql.ts delete mode 100644 app-v2/utils/http.ts delete mode 100644 app-v2/utils/import.ts delete mode 100644 app-v2/utils/index.ts delete mode 100644 app-v2/utils/interface.ts delete mode 100644 app-v2/utils/parseData.ts delete mode 100644 app-v2/utils/stat.ts delete mode 100644 app-v2/utils/url.ts delete mode 100644 app/App.tsx rename {app-v2 => app}/AuthorizedRoute.tsx (93%) delete mode 100644 app/PrivateRoute.tsx rename {app-v2 => app}/components/Avatar/index.tsx (100%) rename {app-v2 => app}/components/Breadcrumb/index.less (100%) rename {app-v2 => app}/components/Breadcrumb/index.tsx (96%) delete mode 100644 app/components/Button/index.less delete mode 100644 app/components/Button/index.tsx delete mode 100644 app/components/CSVPreviewLink.less delete mode 100644 app/components/CSVPreviewLink.tsx rename {app-v2 => app}/components/CSVPreviewLink/index.less (94%) rename {app-v2 => app}/components/CSVPreviewLink/index.tsx (100%) delete mode 100644 app/components/CodeMirror.tsx rename {app-v2 => app}/components/CodeMirror/index.less (100%) rename {app-v2 => app}/components/CodeMirror/index.tsx (98%) delete mode 100644 app/components/Codemirror.less delete mode 100644 app/components/ColorPicker/index.less delete mode 100644 app/components/ColorPicker/index.tsx delete mode 100644 app/components/ConfigServerForm/index.less delete mode 100644 app/components/ConfigServerForm/index.tsx delete mode 100644 app/components/DisplayPanel/ExpandForm/index.less delete mode 100644 app/components/DisplayPanel/ExpandForm/index.tsx delete mode 100644 app/components/DisplayPanel/ExpandItem/index.less delete mode 100644 app/components/DisplayPanel/ExpandItem/index.tsx delete mode 100644 app/components/DisplayPanel/SelectedGraphDetailShowModal/index.less delete mode 100644 app/components/DisplayPanel/SelectedGraphDetailShowModal/index.tsx delete mode 100644 app/components/DisplayPanel/index.less delete mode 100644 app/components/DisplayPanel/index.tsx delete mode 100644 app/components/Expand/AddFilterForm/index.less delete mode 100644 app/components/Expand/AddFilterForm/index.tsx delete mode 100644 app/components/Expand/ExpandForm/index.less delete mode 100644 app/components/Expand/ExpandForm/index.tsx delete mode 100644 app/components/Expand/index.less delete mode 100644 app/components/Expand/index.tsx delete mode 100644 app/components/GQLModal/index.less delete mode 100644 app/components/GQLModal/index.tsx delete mode 100644 app/components/IconPicker/iconCfg.ts delete mode 100644 app/components/IconPicker/index.less delete mode 100644 app/components/IconPicker/index.tsx delete mode 100644 app/components/Instruction/index.less delete mode 100644 app/components/Instruction/index.tsx delete mode 100644 app/components/NebulaD3/Links.tsx delete mode 100644 app/components/NebulaD3/NodeTexts.tsx delete mode 100644 app/components/NebulaD3/SelectIds.tsx delete mode 100644 app/components/NebulaD3/index.less delete mode 100644 app/components/NebulaD3/index.tsx delete mode 100644 app/components/OutputBox/Export.less delete mode 100644 app/components/OutputBox/Export.tsx delete mode 100644 app/components/OutputBox/Graphviz.less delete mode 100644 app/components/OutputBox/Graphviz.tsx delete mode 100644 app/components/OutputBox/index.less delete mode 100644 app/components/OutputBox/index.tsx delete mode 100644 app/components/OutputCsv/index.tsx delete mode 100644 app/components/VertexStyleSet/DisplayBtn.tsx delete mode 100644 app/components/VertexStyleSet/StyleSetTabs.tsx delete mode 100644 app/components/VertexStyleSet/index.tsx rename {app-v2 => app}/interfaces/import.ts (100%) rename {app-v2 => app}/interfaces/schema.ts (100%) delete mode 100644 app/modules/ConfigServer/index.less delete mode 100644 app/modules/ConfigServer/index.tsx delete mode 100644 app/modules/Console/SpaceSearchInput.tsx delete mode 100644 app/modules/Console/index.less delete mode 100644 app/modules/Console/index.tsx delete mode 100644 app/modules/Explore/Control/AlgorithmQuery/index.less delete mode 100644 app/modules/Explore/Control/AlgorithmQuery/index.tsx delete mode 100644 app/modules/Explore/Control/CustomQuery/index.less delete mode 100644 app/modules/Explore/Control/CustomQuery/index.tsx delete mode 100644 app/modules/Explore/Control/IdQuery/index.less delete mode 100644 app/modules/Explore/Control/IdQuery/index.tsx delete mode 100644 app/modules/Explore/Control/ImportNode.tsx delete mode 100644 app/modules/Explore/Control/IndexQuery/IndexIntroduction.less delete mode 100644 app/modules/Explore/Control/IndexQuery/IndexIntroduction.tsx delete mode 100644 app/modules/Explore/Control/IndexQuery/IndexMatch.less delete mode 100644 app/modules/Explore/Control/IndexQuery/IndexMatch.tsx delete mode 100644 app/modules/Explore/Control/IndexQuery/index.tsx delete mode 100644 app/modules/Explore/Control/index.less delete mode 100644 app/modules/Explore/Control/index.tsx delete mode 100644 app/modules/Explore/Init.tsx delete mode 100644 app/modules/Explore/InitVertexes.less delete mode 100644 app/modules/Explore/InitVertexes.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Menu/index.less delete mode 100644 app/modules/Explore/NebulaGraph/Menu/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/Delete/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/Expand/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/Export/index.less delete mode 100644 app/modules/Explore/NebulaGraph/Panel/Export/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/HotKeysDescription/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/Lock/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/Move/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/PropsDisplay/index.less delete mode 100644 app/modules/Explore/NebulaGraph/Panel/PropsDisplay/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/PropsDisplay/setting.less delete mode 100644 app/modules/Explore/NebulaGraph/Panel/PropsDisplay/setting.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/Rollback/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/Search/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/UnExpandBtn/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/Unlock/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/VertexStyleSetBtn/index.less delete mode 100644 app/modules/Explore/NebulaGraph/Panel/VertexStyleSetBtn/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/Zoom/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/Panel/index.less delete mode 100644 app/modules/Explore/NebulaGraph/Panel/index.tsx delete mode 100644 app/modules/Explore/NebulaGraph/index.less delete mode 100644 app/modules/Explore/NebulaGraph/index.tsx delete mode 100644 app/modules/Explore/index.less delete mode 100644 app/modules/Explore/index.tsx delete mode 100644 app/modules/Import/Progress/index.tsx delete mode 100644 app/modules/Import/Tasks/Add.less delete mode 100644 app/modules/Import/Tasks/Add.tsx delete mode 100644 app/modules/Import/Tasks/ConfigEdge/Edge.less delete mode 100644 app/modules/Import/Tasks/ConfigEdge/Edge.tsx delete mode 100644 app/modules/Import/Tasks/ConfigEdge/index.less delete mode 100644 app/modules/Import/Tasks/ConfigEdge/index.tsx delete mode 100644 app/modules/Import/Tasks/ConfigVertex/Tag.less delete mode 100644 app/modules/Import/Tasks/ConfigVertex/Tag.tsx delete mode 100644 app/modules/Import/Tasks/ConfigVertex/TagList.less delete mode 100644 app/modules/Import/Tasks/ConfigVertex/TagList.tsx delete mode 100644 app/modules/Import/Tasks/ConfigVertex/index.less delete mode 100644 app/modules/Import/Tasks/ConfigVertex/index.tsx delete mode 100644 app/modules/Import/Tasks/Import.less delete mode 100644 app/modules/Import/Tasks/Import.tsx delete mode 100644 app/modules/Import/Tasks/Init.less delete mode 100644 app/modules/Import/Tasks/Init.tsx delete mode 100644 app/modules/Import/Tasks/Next.tsx delete mode 100644 app/modules/Import/Tasks/Prev.tsx delete mode 100644 app/modules/Import/Tasks/Upload.less delete mode 100644 app/modules/Import/Tasks/Upload.tsx delete mode 100644 app/modules/Import/Tasks/index.tsx delete mode 100644 app/modules/Import/index.less delete mode 100644 app/modules/Import/index.tsx delete mode 100644 app/modules/Schema/CreateSpace/index.less delete mode 100644 app/modules/Schema/CreateSpace/index.tsx delete mode 100644 app/modules/Schema/Edge/Create.less delete mode 100644 app/modules/Schema/Edge/Create.tsx delete mode 100644 app/modules/Schema/Edge/Edit.less delete mode 100644 app/modules/Schema/Edge/Edit.tsx delete mode 100644 app/modules/Schema/Edge/index.less delete mode 100644 app/modules/Schema/Edge/index.tsx delete mode 100644 app/modules/Schema/Index/Create.less delete mode 100644 app/modules/Schema/Index/Create.tsx delete mode 100644 app/modules/Schema/Index/DraggableTags.tsx delete mode 100644 app/modules/Schema/Index/index.less delete mode 100644 app/modules/Schema/Index/index.tsx delete mode 100644 app/modules/Schema/Search/index.less delete mode 100644 app/modules/Schema/Search/index.tsx delete mode 100644 app/modules/Schema/SpaceConfig/index.less delete mode 100644 app/modules/Schema/SpaceConfig/index.tsx delete mode 100644 app/modules/Schema/Tag/Create.less delete mode 100644 app/modules/Schema/Tag/Create.tsx delete mode 100644 app/modules/Schema/Tag/Edit.less delete mode 100644 app/modules/Schema/Tag/Edit.tsx delete mode 100644 app/modules/Schema/Tag/index.less delete mode 100644 app/modules/Schema/Tag/index.tsx delete mode 100644 app/modules/Schema/index.less delete mode 100644 app/modules/Schema/index.tsx rename {app-v2 => app}/pages/Import/FileUpload/index.less (91%) rename {app-v2 => app}/pages/Import/FileUpload/index.tsx (92%) rename {app-v2 => app}/pages/Import/TaskCreate/FileSelect/index.less (100%) rename {app-v2 => app}/pages/Import/TaskCreate/FileSelect/index.tsx (96%) rename {app-v2 => app}/pages/Import/TaskCreate/PasswordInputModal/index.less (100%) rename {app-v2 => app}/pages/Import/TaskCreate/PasswordInputModal/index.tsx (100%) rename {app-v2 => app}/pages/Import/TaskCreate/SchemaConfig/EdgeConfig/index.tsx (96%) rename {app-v2 => app}/pages/Import/TaskCreate/SchemaConfig/TagConfig/index.tsx (96%) rename {app-v2 => app}/pages/Import/TaskCreate/SchemaConfig/index.less (97%) rename {app-v2 => app}/pages/Import/TaskCreate/SchemaConfig/index.tsx (94%) rename {app-v2 => app}/pages/Import/TaskCreate/index.less (94%) rename {app-v2 => app}/pages/Import/TaskCreate/index.tsx (96%) rename {app-v2 => app}/pages/Import/TaskList/TaskItem/index.less (97%) rename {app-v2 => app}/pages/Import/TaskList/TaskItem/index.tsx (97%) rename {app-v2 => app}/pages/Import/TaskList/index.less (91%) rename {app-v2 => app}/pages/Import/TaskList/index.tsx (92%) rename {app-v2 => app}/pages/Import/index.less (100%) rename {app-v2 => app}/pages/Import/index.tsx (96%) rename {app-v2 => app}/pages/Login/LanguageSelect/index.less (95%) rename {app-v2 => app}/pages/Login/LanguageSelect/index.tsx (86%) rename {app-v2 => app}/pages/Login/index.less (95%) rename {app-v2 => app}/pages/Login/index.tsx (93%) rename {app-v2 => app}/pages/MainPage/Header/HelpMenu/index.less (100%) rename {app-v2 => app}/pages/MainPage/Header/HelpMenu/index.tsx (91%) rename {app-v2 => app}/pages/MainPage/Header/index.less (100%) rename {app-v2 => app}/pages/MainPage/Header/index.tsx (95%) rename {app-v2 => app}/pages/MainPage/index.less (61%) rename {app-v2 => app}/pages/MainPage/index.tsx (100%) rename {app-v2 => app}/pages/MainPage/routes.tsx (77%) rename {app-v2 => app}/pages/Schema/SchemaConfig/Create/CommonCreate/PropertiesForm.tsx (98%) rename {app-v2 => app}/pages/Schema/SchemaConfig/Create/CommonCreate/TTLForm.tsx (100%) rename {app-v2 => app}/pages/Schema/SchemaConfig/Create/CommonCreate/index.less (97%) rename {app-v2 => app}/pages/Schema/SchemaConfig/Create/CommonCreate/index.tsx (91%) rename {app-v2 => app}/pages/Schema/SchemaConfig/Edit/CommonEdit/PropertiesForm.tsx (98%) rename {app-v2 => app}/pages/Schema/SchemaConfig/Edit/CommonEdit/PropertiesRow.tsx (96%) rename {app-v2 => app}/pages/Schema/SchemaConfig/Edit/CommonEdit/TTLForm.tsx (98%) rename {app-v2 => app}/pages/Schema/SchemaConfig/Edit/CommonEdit/index.less (97%) rename {app-v2 => app}/pages/Schema/SchemaConfig/Edit/CommonEdit/index.tsx (96%) rename {app-v2 => app}/pages/Schema/SchemaConfig/List/CommonLayout/index.less (100%) rename {app-v2 => app}/pages/Schema/SchemaConfig/List/CommonLayout/index.tsx (97%) rename {app-v2 => app}/pages/Schema/SchemaConfig/List/Edge/index.tsx (94%) rename {app-v2 => app}/pages/Schema/SchemaConfig/List/Index/index.less (73%) rename {app-v2 => app}/pages/Schema/SchemaConfig/List/Index/index.tsx (95%) rename {app-v2 => app}/pages/Schema/SchemaConfig/List/Search/index.less (100%) rename {app-v2 => app}/pages/Schema/SchemaConfig/List/Search/index.tsx (100%) rename {app-v2 => app}/pages/Schema/SchemaConfig/List/Tag/index.tsx (94%) rename {app-v2 => app}/pages/Schema/SchemaConfig/index.less (93%) rename {app-v2 => app}/pages/Schema/SchemaConfig/index.tsx (96%) rename {app-v2 => app}/pages/Schema/SpaceCreate/index.less (93%) rename {app-v2 => app}/pages/Schema/SpaceCreate/index.tsx (95%) rename {app-v2 => app}/pages/Schema/index.less (96%) rename {app-v2 => app}/pages/Schema/index.tsx (97%) rename {app-v2 => app}/static/fonts/Roboto-Black.ttf (100%) rename {app-v2 => app}/static/fonts/Roboto-Bold.ttf (100%) rename {app-v2 => app}/static/fonts/Roboto-Light.ttf (100%) rename {app-v2 => app}/static/fonts/Roboto-Medium.ttf (100%) rename {app-v2 => app}/static/fonts/Roboto-Regular.ttf (100%) delete mode 100644 app/static/fonts/iconfont.css rename {app-v2 => app}/static/fonts/iconfont.js (100%) delete mode 100644 app/static/fonts/iconfont.ttf delete mode 100644 app/static/fonts/iconfont.woff delete mode 100644 app/static/fonts/iconfont.woff2 rename {app-v2 => app}/static/images/background_login.png (100%) delete mode 100644 app/static/images/explore-empty.png delete mode 100644 app/static/images/go-to-explore_en.png delete mode 100644 app/static/images/go-to-explore_zh.png rename {app-v2 => app}/static/images/nebula_logo.png (100%) delete mode 100644 app/static/images/studio-logo.png delete mode 100644 app/store/index.ts delete mode 100644 app/store/models/app.ts delete mode 100644 app/store/models/console.ts delete mode 100644 app/store/models/d3Graph.ts delete mode 100644 app/store/models/explore.ts delete mode 100644 app/store/models/import.ts delete mode 100644 app/store/models/index.ts delete mode 100644 app/store/models/nebula.ts rename {app-v2 => app}/stores/console.ts (95%) rename {app-v2 => app}/stores/files.ts (97%) rename {app-v2 => app}/stores/global.ts (97%) rename {app-v2 => app}/stores/import.ts (98%) rename {app-v2 => app}/stores/index.ts (100%) rename {app-v2 => app}/stores/schema.ts (98%) rename {app-v2 => app}/stores/types.d.ts (100%) delete mode 100644 config/webpack.dev2.ts diff --git a/app-v2/app.less b/app-v2/app.less deleted file mode 100644 index 951b4be0..00000000 --- a/app-v2/app.less +++ /dev/null @@ -1,166 +0,0 @@ -@import './common.less'; - -@font-face { - font-family: 'Roboto-Black'; - src: url(~@appv2/static/fonts/Roboto-Black.ttf); -} - -@font-face { - font-family: 'Roboto-Bold'; - src: url(~@appv2/static/fonts/Roboto-Bold.ttf); -} - -@font-face { - font-family: 'Roboto-Light'; - src: url(~@appv2/static/fonts/Roboto-Light.ttf); -} - -@font-face { - font-family: 'Roboto-Medium'; - src: url(~@appv2/static/fonts/Roboto-Medium.ttf); -} - -@font-face { - font-family: 'Roboto-Regular'; - src: url(~@appv2/static/fonts/Roboto-Regular.ttf); -} - -#app { - font-family: Roboto-Regular, sans-serif; -} - -.center-layout { - width: @containerWidth; - margin: 0 auto; -} - -.studio-tab-header { - display: flex; - justify-content: center; - padding-bottom: 16px; - border-bottom: 1px solid @gray; -} - -.ant-radio-group.nebula-tab-group { - background: @lightGray; - border-radius: 20px; - padding: 4px; - min-width: 400px; - display: flex; - justify-content: center; - - .ant-radio-button-wrapper { - border-radius: 20px; - flex: 1; - text-align: center; - border: none; - white-space: nowrap; - color: #465b7a; - - &:not(.ant-radio-button-wrapper-checked) { - background: none; - } - - &::before { - width: 0; - } - } -} - -.ant-btn.warning-btn { - color: @red; - border-color: @red; - - svg { - width: 20px; - height: 20px; - } - - &:hover { - color: @red; - border-color: @red; - } -} - -.ant-btn.primary-btn { - color: @blue; - border-color: @blue; - - svg { - width: 20px; - height: 20px; - } - - &:hover { - color: @blue; - border-color: @blue; - } -} - -.ant-btn.cancel-btn { - color: @darkGray; - border-color: @darkGray; - - svg { - width: 20px; - height: 20px; - } - - &:hover { - color: @darkGray; - border-color: @darkGray; - } -} - -.ant-btn.studio-add-btn { - border-radius: 3px; - display: inline-flex; - align-items: center; - padding: 0 29px; - - a { - display: flex; - align-items: center; - } - - .studio-add-btn-icon { - display: inline-flex; - margin-right: 10px; - height: 22px; - - > svg { - width: 22px; - height: 22px; - } - - & ~ span { - margin-left: 0; - } - } -} - -.studio-form-footer { - position: fixed; - left: 0; - bottom: 0; - z-index: 10; - width: 100%; - height: 98px; - display: flex; - align-items: center; - justify-content: center; - background: #fff; - box-shadow: 0 -4px 4px rgba(0, 0, 0, 0.1); - - button { - width: 236px; - - &:not(:last-child) { - margin-right: 50px; - } - } -} - -.ant-form-item-label label { - font-family: Roboto-Bold, sans-serif; -} diff --git a/app-v2/common.less b/app-v2/common.less deleted file mode 100644 index 2fd5a506..00000000 --- a/app-v2/common.less +++ /dev/null @@ -1,8 +0,0 @@ -@gray: #D5DDEB; -@lightWhite: #F8F8F8; -@containerWidth: 1180px; -@darkGray: #8697B0; -@red: #EB5757; -@blue: #2F80ED; -@lightGray: #E9EDEF; -@lightBlue: #F3F6F9; diff --git a/app-v2/components/GQLCodeMirror/index.less b/app-v2/components/GQLCodeMirror/index.less deleted file mode 100644 index 783de287..00000000 --- a/app-v2/components/GQLCodeMirror/index.less +++ /dev/null @@ -1,16 +0,0 @@ -@import '~@appv2/common.less'; -.export-gql { - text-align: left; - margin-top: 24px; - background: #FFFFFF; - border: 1px solid @gray; - .ant-collapse-item { - border-bottom: none; - } - box-sizing: border-box; - border-radius: 3px; -} - -.export-gql .ant-collapse-content-box div { - cursor: not-allowed; -} diff --git a/app-v2/components/GQLCodeMirror/index.tsx b/app-v2/components/GQLCodeMirror/index.tsx deleted file mode 100644 index 5ee85d09..00000000 --- a/app-v2/components/GQLCodeMirror/index.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Collapse } from 'antd'; -import React from 'react'; -import intl from 'react-intl-universal'; - -import CodeMirror from '@appv2/components/CodeMirror'; - -import './index.less'; -const Panel = Collapse.Panel; -interface IOptions { - [propName: string]: any; -} -const GQLCodeMirror = (props: { currentGQL: string; option?: IOptions }) => { - const options = { - keyMap: 'sublime', - fullScreen: true, - mode: 'nebula', - readOnly: true, - ...props.option, - }; - return ( - - - - - - ); -}; - -export default GQLCodeMirror; diff --git a/app-v2/components/Icon/index.tsx b/app-v2/components/Icon/index.tsx deleted file mode 100644 index 8919e717..00000000 --- a/app-v2/components/Icon/index.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { createFromIconfontCN } from '@ant-design/icons'; -import icon from '@appv2/static/fonts/iconfont.js'; -const IconFont = createFromIconfontCN({ - scriptUrl: icon, -}); - -export default IconFont; diff --git a/app-v2/components/Modal.tsx b/app-v2/components/Modal.tsx deleted file mode 100644 index bd67a3fb..00000000 --- a/app-v2/components/Modal.tsx +++ /dev/null @@ -1,79 +0,0 @@ -import { Modal as AntModal } from 'antd'; -import { ModalProps } from 'antd/lib/modal'; -import React, { Component } from 'react'; - -interface IModalState { - visible: boolean; -} - -interface IModalHandler { - show: (callback?: any) => void; - hide: (callback?: any) => void; -} - -interface IModalProps extends ModalProps { - /** - * use this hook you can get the handler of Modal - * handlerRef => ({ visible, show, hide }) - */ - handlerRef?: (handler: IModalHandler) => void; - children?: any; -} -export default class Modal extends Component { - constructor(props: IModalProps) { - super(props); - this.state = { - visible: false, - }; - } - componentDidMount() { - if (this.props.handlerRef) { - this.props.handlerRef({ - show: this.show, - hide: this.hide, - }); - } - } - - show = (callback?: any) => { - this.setState( - { - visible: true, - }, - () => { - if (callback) { - callback(); - } - }, - ); - }; - - hide = (callback?: any) => { - this.setState( - { - visible: false, - }, - () => { - if (callback) { - callback(); - } - }, - ); - }; - - render() { - return ( - this.state.visible && ( - { - this.hide(); - }} - {...this.props} - > - {this.props.children} - - ) - ); - } -} diff --git a/app-v2/components/index.ts b/app-v2/components/index.ts deleted file mode 100644 index c6b35681..00000000 --- a/app-v2/components/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as Modal } from './Modal'; diff --git a/app-v2/config/codeLog.ts b/app-v2/config/codeLog.ts deleted file mode 100644 index 75651aac..00000000 --- a/app-v2/config/codeLog.ts +++ /dev/null @@ -1 +0,0 @@ -export const codeLog: string[] = ['请求成功']; diff --git a/app-v2/config/constants.ts b/app-v2/config/constants.ts deleted file mode 100644 index 0a773f02..00000000 --- a/app-v2/config/constants.ts +++ /dev/null @@ -1,18 +0,0 @@ -import enUS from './locale/en-US.json'; -import zhCN from './locale/zh-CN.json'; - -export const INTL_LOCALE_SELECT = { - EN_US: { - TEXT: 'English', - NAME: 'EN_US', - }, - ZH_CN: { - TEXT: '中文', - NAME: 'ZH_CN', - }, -}; - -export const INTL_LOCALES = { - EN_US: enUS, - ZH_CN: zhCN, -}; diff --git a/app-v2/config/explore.ts b/app-v2/config/explore.ts deleted file mode 100644 index e7461073..00000000 --- a/app-v2/config/explore.ts +++ /dev/null @@ -1,228 +0,0 @@ -import BigNumber from 'bignumber.js'; -import JSONBigint from 'json-bigint'; -import json2csv from 'json2csv'; - -import { INode, IPath } from '#app/utils/interface'; - -export const MIN_SCALE = 0.3; -export const MAX_SCALE = 1; - -export const HOT_KEYS = intl => [ - { - operation: `Shift + 'Enter'`, - desc: intl.get('explore.expand'), - }, - { - operation: `Shift + '-'`, - desc: intl.get('common.zoomOut'), - }, - { - operation: `Shift + '+'`, - desc: intl.get('common.zoomIn'), - }, - { - operation: `Shift + 'l'`, - desc: intl.get('common.show'), - }, - { - operation: `Shift + 'z'`, - desc: intl.get('common.rollback'), - }, - { - operation: intl.get('common.selected') + ` + Shift + 'del'`, - desc: intl.get('common.delete'), - }, -]; - -export const GRAPH_ALOGORITHM = intl => [ - { - label: intl.get('explore.allPath'), - value: 'ALL', - }, - { - label: intl.get('explore.shortestPath'), - value: 'SHORTEST', - }, - { - label: intl.get('explore.noLoopPath'), - value: 'NOLOOP', - }, -]; - -export const DEFAULT_COLOR_PICKER = '#5CDBD3'; -export const DEFAULT_COLOR_MIX = - 'linear-gradient(225deg, #32C5FF 0%, #B620E0 51%, #F7B500 100%)'; -export const COLOR_PICK_LIST = [ - '#B93431', - '#B95C31', - '#B98031', - '#B9B031', - '#68B931', - '#31B9B1', - '#3180B9', - '#7331B9', - '#FF7875', - '#FF9C6E', - '#FFC069', - '#FFF566', - '#95DE64', - '#5CDBD3', - '#69C0FF', - '#B37FEB', - '#FFB9B8', - '#FFCEB8', - '#FFE1B8', - '#FFFAB8', - '#D7F2C4', - '#C5F2EF', - '#B8E1FF', - '#DAC1F5', - '#FFE6E6', - '#FFEEE6', - '#FFF4E6', - '#FFFDE6', - '#F1FBEA', - '#EAFAF9', - '#E6F4FF', - '#F2E9FC', -]; -export const DEFAULT_COLOR_PICK_LIST = [ - '#FF7875', - '#FF9C6E', - '#FFC069', - '#FFF566', - '#95DE64', - '#5CDBD3', - '#69C0FF', - '#B37FEB', - '#FFB9B8', - '#FFCEB8', - '#FFE1B8', - '#FFFAB8', - '#D7F2C4', - '#C5F2EF', - '#B8E1FF', - '#DAC1F5', - '#FFE6E6', - '#FFEEE6', - '#FFF4E6', - '#FFFDE6', - '#F1FBEA', - '#EAFAF9', - '#E6F4FF', - '#F2E9FC', - '#B93431', - '#B95C31', - '#B98031', - '#B9B031', - '#68B931', - '#31B9B1', - '#3180B9', - '#7331B9', -]; - -export const flattenData = data => { - const result = {}; - const fieldData = [] as any; - function recurse(cur: any, prop) { - if (Object(cur) !== cur) { - fieldData.push(prop); - result[prop] = cur; - } else if (Array.isArray(cur)) { - for (let i = 0, l = cur.length; i < l; i++) { - recurse(cur[i], prop ? prop + '.' + i : '' + i); - if (l === 0) { - result[prop] = []; - } - } - } else if (BigNumber.isBigNumber(cur)) { - result[prop] = cur; - } else { - let isEmpty = true; - Object.keys(cur).forEach(p => { - isEmpty = false; - recurse(cur[p], prop ? prop + '.' + p : p); - if (isEmpty) { - result[prop] = {}; - } - }); - } - } - recurse(data, ''); - return { result, fieldData }; -}; - -export const downloadCSVFiles = ({ headers, tables, title }) => { - try { - const result = json2csv.parse(tables, { - fields: headers, - }); - // Determine browser type - if ( - (navigator.userAgent.indexOf('compatible') > -1 && - navigator.userAgent.indexOf('MSIE') > -1) || - navigator.userAgent.indexOf('Edge') > -1 - ) { - // IE10 or Edge browsers - const BOM = '\uFEFF'; - const csvData = new Blob([BOM + result], { type: 'text/csv' }); - // @ts-ignore - navigator.msSaveBlob(csvData, `test.csv`); - } else { - // Non-Internet Explorer - const csvContent = 'data:text/csv;charset=utf-8,\uFEFF' + result; - // Use the download property of the A tag to implement the download function - const link = document.createElement('a'); - link.href = encodeURI(csvContent); - link.download = `${title}.csv`; - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - } - } catch (err) { - alert(err); - } -}; - -export const parseData = (data: INode[] | IPath[], type: 'vertex' | 'edge') => { - const fields = - type === 'vertex' - ? ['vid', 'attributes'] - : ['type', 'srcId', 'dstId', 'rank', 'attributes']; - const tables: any = []; - data.forEach((item: any) => { - const _result = {} as any; - const properties = - type === 'vertex' ? item.nodeProp.properties : item.edgeProp.properties; - const { result } = flattenData(properties) as any; - if (type === 'vertex') { - _result.vid = item.name; - _result.attributes = JSONBigint.stringify(result); - tables.push(_result); - } else if (type === 'edge') { - _result.type = item.type; - _result.srcId = item.source.name; - _result.dstId = item.target.name; - _result.rank = item.rank; - _result.attributes = JSONBigint.stringify(result); - tables.push(_result); - } - }); - return { tables, headers: fields }; -}; - -export const exportDataToCSV = ( - data: INode[] | IPath[], - type: 'vertex' | 'edge', -) => { - const { headers, tables } = parseData(data, type); - downloadCSVFiles({ headers, tables, title: type }); -}; -export const DEFAULT_EXPLORE_RULES = { - edgeTypes: [], - edgeDirection: 'outgoing', - stepsType: 'single', - step: 1, - vertexStyle: 'colorGroupByTag', - quantityLimit: 100, -}; diff --git a/app-v2/config/index.ts b/app-v2/config/index.ts deleted file mode 100644 index 31c4dee0..00000000 --- a/app-v2/config/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * this folder for config - */ - -export * from './constants'; diff --git a/app-v2/config/locale/en-US.json b/app-v2/config/locale/en-US.json deleted file mode 100644 index 2a3f3b7c..00000000 --- a/app-v2/config/locale/en-US.json +++ /dev/null @@ -1,394 +0,0 @@ -{ - "common": { - "requestError": "Request Error", - "currentSpace": "Current Graph Space", - "languageSelect": "Language", - "seeTheHistory": "History", - "table": "Table", - "log": "Log", - "record": "Record", - "sorryNGQLCannotBeEmpty": "Sorry, nGQL cannot be empty", - "disablesUseToSwitchSpace": "Switching space from console is not allowed by current role", - "NGQLHistoryList": "nGQL History", - "spaceTip": "Only required when you need to execute queries in a specified space.", - "empty": "Clear", - "run": "Run", - "console": "Console", - "explore": "Explore", - "ok": "OK", - "success": "Success", - "fail": "Fail", - "noData": "There is no data", - "cancel": "Cancel", - "confirm": "Confirm", - "import": "Import", - "ask": "Are you sure to proceed?", - "output": "Export CSV File", - "openInExplore": "Open In Explore", - "schema": "Schema", - "create": "Create", - "serialNumber": "No.", - "name": "Name", - "operation": "Operations", - "delete": "Delete", - "optional": "Optional", - "exportNGQL": "View nGQL", - "field": "Field", - "relatedProperties": "Related Properties", - "type": "Type", - "edit": "Edit", - "deleteSuccess": "Deleted successfully", - "propertyName": "Property Name", - "dataType": "Data Type", - "allowNull": "Allow Null", - "defaults": "Defaults", - "addProperty": "Add Property", - "updateSuccess": "Updated Successfully", - "add": "Add", - "tag": "Tag", - "edge": "Edge Type", - "index": "Index", - "list": "List", - "yes": "Yes", - "no": "No", - "graph": "Graph", - "description": "Description", - "zoomOut": "Zoom Out", - "zoomIn": "Zoom In", - "move": "Move", - "rollback": "Rollback", - "unlock": "Unlock", - "lock": "Lock", - "moreSuggestion": "More Suggestions", - "algorithm": "Algorithm", - "viewDocs": "View Docs", - "hotKeys": "Shortcut Keys", - "show": "Show", - "selected": "Selected", - "search": "Search", - "color": "Color", - "icon": "Icon", - "copy": "Copy", - "copySuccess": "Copied to clipboard", - "expansionConditions": "Expansion conditions", - "total": "Total", - "exportSelectVertexes": "Export Vertexes to CSV", - "exportSelectEdges": "Export Edges to CSV", - "noSelectedData": "No data currently selected", - "namePlaceholder": "Please enter the {name} name", - "comment": "Comment", - "space": "Space", - "version": "Version", - "statistics": "Statistics" - }, - "NGQLOutput": { - "success": "Execution successful!" - }, - "warning": { - "configServer": "Please configure the nebula server", - "connectError": "Connection refused, please configure server again" - }, - "configServer": { - "connect": "Connect", - "host": "Host", - "username": "Username", - "password": "Password", - "success": "succeed", - "fail": "Failed", - "clear": "Clear Connection", - "title": "Configure Server" - }, - "formRules": { - "hostRequired": "Host Required", - "usernameRequired": "Username Required", - "passwordRequired": "Password Required", - "nodeIdError": "The format is invalid, should be one node per line, split by \\n like: \nid1\nid2\nid3", - "idRequired": "The id field is mandatory", - "positiveIntegerRequired": "Please enter a non-negative integer", - "nameValidate": "The name must start with a letter, and it only supports English letters, numbers and underscores", - "nameRequired": "Please enter the name", - "numberRequired": "Please enter a positive integer", - "replicaLimit": "Replica factor must not exceed the number of your current online machines({number})", - "propertyRequired": "Please enter the property name", - "defaultRequired": "Please enter the default value", - "ttlRequired": "Please select the corresponding property, and the data type of the property must be integer or timestamp", - "ttlDurationRequired": "Please enter the time (in seconds)", - "dataTypeRequired": "Please select the data type", - "fixedStringLength": "Fixed String length must be a positive integer" - }, - "console": { - "cost": "Cost", - "execTime": "Execution Time", - "exportVertex": "Please choose the column representing vertex IDs from the table", - "exportEdge": "Please choose the columns representing source vertex ID, destination vertex ID, and rank of an edge", - "showSubgraphs": "View Subgraphs", - "deleteHistory": "Clear History", - "parameterDisplay": "Custom Parameters Display" - }, - "explore": { - "clear": "Clear", - "clearTip": "Are you sure to proceed the cleanup of the renderred graph view?", - "startWithVertices": "Start with Vertices", - "addConfirm": "Add", - "expand": "Expand", - "unExpand": "Undo Expand", - "undo": "Undo", - "deleteSelectNodes": "Remove Selected Nodes", - "fileImport": "Import File", - "sampleImport": "Import Sample", - "importPlaceholder": "Enter VIDs or other data for VID generation, one data per line, and split them by pressing the Enter key. Here is an example:\nstring1\nstring2\nstring3", - "outgoing": "Outgoing", - "incoming": "Incoming", - "bidirect": "Bidirect", - "filter": "Custom filter conditions", - "operator": "Operator", - "value": "Value", - "selectSpace": "Please select the space", - "selectReminder": "The selection of space will cleanup the renderred graph view, are you sure to proceed?", - "zoom": "Zoom", - "showTags": "Show Tags", - "showEdges": "Show Edges", - "confirm": "Confirm", - "vertexStyle": "Vertex Color/Icon", - "quantityLimit": "Query Limit", - "colorGroupByTag": "Group by vertex tag", - "noVertexPrompt": "No vertices on the board. ", - "search": "Start graph exploration", - "queryById": "Query by VID", - "queryByIndex": "Query by Index", - "queryByCustom": "Custom Query", - "idToBeQueried": "Specify Vertex ID", - "idPretreatment": "Pre-process Vertex IDs", - "indexQueryPrompt_prefix": "In the ", - "indexQueryPrompt_suffix": " space, no tag indexes are found, so query by index is not available.", - "indexQueryPrompt2": "Please create indexes on the tags. Here is an example:", - "runCodeInConsole": "Execute queries in the console", - "indexLink": "For more information about index, see its ", - "documentIntroduction": "documentation", - "selectIndex": "Select a Index", - "paramFilter": "Use Index", - "relationship": "Logical Operator", - "operationConfirm": "This Delete operation will clear the following fields. Are you sure you want to continue the operation?", - "quiry": "Query", - "customQueryDescription": "Enter the statements in the console. When the results are returned, click the Open in Explore button as shown in the preceding figure to explore the graph.", - "openInConsole": "Go to Console", - "insertMethodSelect": "How do you like to render the new data with the existing graph view, incrementally or wipe the graph view first?", - "incrementalInsertion": "Incrementally Render", - "insertAfterClear": "Wipe and Render", - "emptyIndex": "No Index", - "indexConditionDescription": "To use a composite index for a query, we should either filter all fields or the left matching contiguous fields in sequence. That is, the first field is mandatory and skipping field is not allowed", - "timestampInput": "Only numbers are supported for the timestamp field", - "documentIntroductionUrl": "https://docs.nebula-graph.io/2.6.1/3.ngql-guide/14.native-index-statements/", - "customQueryUrl": "https://cloud-cdn.nebula-graph.com.cn/studio-resource/go-to-explore_en.png", - "pretreatmentExplaination": "Hash can pre-process data of the bool, double, int, or string type to generate VIDs, but UUID can pre-process data of the string type only. To generate VIDs by pre-processing strings, enclose each string with single or double quotes.", - "exportToImg": "Export Graph", - "exportToCSV":"Export CSV", - "export":"Export", - "toBlobError": "Export failed. The current canvas size is too large. Please zoom out to retry.", - "expandTip": "Double-click any vertex to explore its related vertices and edges.", - "hotKeysInstructions": "Shortcut Keys Instruction", - "graphAlgorithm": "Graph Algorithm", - "srcId": "Src ID", - "dstId": "Dst ID", - "relation": "Relation", - "direction": "Direction", - "stepLimit": "Step Limit", - "allPath": "All path", - "shortestPath": "Shortest Path", - "noLoopPath": "NoLoop Path", - "algorithmParams": "Algorithm Parameters", - "steps": "Steps", - "singleStep": "Single", - "rangeStep": "Range", - "addCondition": "Add condition", - "customStyle": "Custom Color/Icon", - "nodeSearch":"Artboard node search", - "searchEmpty": "No data found", - "selectedVertexes": "Selected Vertexes", - "selectedEdges": "Selected Edges", - "viewDetails": "View Details", - "expandItem": "Expand", - "collapseItem": "Collapse", - "searchTip": "The following comparison operators are currently supported [=, >, <, !=, <>, <=, >=]", - "expressionError": "Expression error", - "expandTips": "Double-click the vertex to quickly expand according to the current configuration by default", - "missingParams": "Missing parameters", - "emptyIndexTips": "No attribute index currently does not support the data query function in Explore, Please select index with attribute for query", - "docForFindPath": "https://docs.nebula-graph.io/2.5.0/3.ngql-guide/16.subgraph-and-path/2.find-path/" - }, - "import": { - "vertexID": "Vertex ID", - "import": "Import", - "selectSpace": "Select Space", - "uploadFile": "Upload Files", - "uploadSuccess": "Upload Successfully.", - "importData": "Import Data", - "createTask": "New Import", - "uploadTemp": "Import Template", - "downloadConfig": "Download Config", - "viewLogs": "View Logs", - "details": "Details", - "lines": "Lines", - "taskList": "Task List", - "taskName": "Task Name", - "vertices": "Map Vertices", - "edge": "Map Edges", - "runImport": "Import", - "next": "Next", - "goback": "Prev", - "mountPath": "Mount Path", - "importConfigValidationSuccess": "The configuration validation was successful", - "mountPathPlaceholder": "Please input the docker data mount path", - "fileName": "File Name", - "withHeader": "Header", - "fileType": "Type", - "fileSize": "Size", - "fileTitle": "Select Files", - "fileSizeErrorMsg": "File must smaller than 100 MB", - "preview": "Preview", - "bindDatasource": "Bind Datasource", - "confirm": "Confirm", - "stopImportFailed": "Stop Import Failed", - "uploadFailed": "Upload Failed", - "importResults": "Import Information", - "newImport": "New Import", - "endImport": "Stop Import", - "againImport": "Import Again", - "prop": "Prop", - "propTip": "{name}'s Property", - "mapping": "CSV Index", - "mappingTip": "The index of the csv file", - "typeTip": "Prop Type", - "setVertexId": "Set ID", - "setVertexIdTip": "Set current prop as vertex id", - "useHash": "ID Hash", - "useHashTip": "VertexId Process Method", - "unset": "Original ID", - "uuid": "UUID", - "hash": "Hash", - "setSrc": "Set SrcId", - "setSrcTip": "Set field's value as edge source id", - "setDst": "Set DstId", - "setDstTip": "Set field's value as edge destination id", - "setRank": "Set Rank", - "setRankTip": "Set field's value as edge rank", - "edgeText": "Edge", - "choose": "Mapping", - "ignore": "Ignore", - "vertexText": "Vertex", - "importErrorInfo": "Error importing data. Please check the configuration or data file", - "clearAllConfigInfo": "Confirm to clear all config?", - "promptConfigInfo": "The configuration cannot be empty", - "configFile": "Configuration File: ", - "logFile":"Log File: ", - "vertexesFile": "Vertices Files: ", - "vertexFile": "The Vertex File: ", - "vertexErrorFilePath": "Error Vertex File: ", - "edgesFilePath": "Edges Files: ", - "edgeFilePath": "The Edge Files: ", - "edgeErrorFilePath": "Error Edge File Path: ", - "clearoAllConfigInfo": "Confirm to clear all config?", - "all": "All", - "mountPathWarning": "Import data need to config the WORKING_DIR env variable before starting.", - "notExist": "Not exist", - "importError": "Import Error", - "importMappingError": "The data file configuration map import failed", - "importFormatError": "Data file format is not uniform", - "importFileConfigError": "Data file configuration related error", - "importFileDownloadError": "Data file download failed", - "importFileError": "File related error", - "importNebulaError": "Error associated with instance interaction", - "datasource": "DataSource", - "indexNotEmpty": "column index can't be null.", - "reset": "Reset", - "importFinished": "Import task has ended.", - "enterPassword": "Please enter your nebula account password", - "isEmpty": "is empty", - "startImporting": "Start importing", - "stopImportingSuccess": "Stop import successfully.", - "deleteSuccess": "Delete task successfully", - "batchSize": "Batch Size", - "importCompleted": "Import completed", - "importStopped": "Import stopped", - "importFailed": "Failed", - "notImported": "{total} lines not imported", - "readFailed": "{total} lines read failed", - "selectFile": "Select bind source file", - "addTag": "Add Tag" - }, - "schema": { - "spaceList": "Graph Space List", - "backToSpaceList": "Graph Space List", - "useSpaceErrTip": "Space not found. Trying to use a newly created graph space may fail because the creation is implemented asynchronously. To make sure the follow-up operations work as expected, Wait for two heartbeat cycles, i.e., 20 seconds.", - "partitionNumDescription": "partition_num specifies the number of partitions in one replica. The default value is 100. It is usually 5 times the number of hard disks in the cluster.", - "replicaFactorDescription": "replica_factor specifies the number of replicas in the cluster. The default replica factor is 1. The suggested number is 3 in cluster. It is usually 3 in production. Due to the majority voting principle, it must set to be odd.", - "charsetDescription": "charset is short for character set. A character set is a set of symbols and encodings. The default value is utf8.", - "collateDescription": "A collation is a set of rules for comparing characters in a character set. The default value is utf8_bin.", - "vidTypeDescription": "Specifies the data type of vertex IDs (VIDs) in a graph space. ", - "createSuccess": "Create Successfully", - "defineFields": "Define Properties", - "uniqProperty": "Property name cannot be duplicated", - "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.", - "ttlRequired": "ttl_col and ttl_duration are required.", - "fieldRequired": "Property name and its data type are required", - "indexExist": "An index exists, so TTL configuration is not permitted. A tag or edge type cannot have both an index and TTL configuration.", - "indexType": "Index Type", - "indexName": "Index Name", - "indexFields": "Indexed Properties", - "dragSorting": "(Drag to Sort)", - "selectFields": "Choose Property", - "indexedLength": "Indexed length", - "indexedLengthDescription": "Set the indexed string length. If you are indexing fixed strings, you must not set this option.", - "indexedLengthRequired": "Indexed length must be a positive integer", - "backToTagList": "Back to Tag List", - "backToEdgeList": "Back to Edge Type List", - "backToIndexList": "Back to Index List", - "leavePage": "Whether to leave the current page?", - "leavePagePrompt": "You have unsaved changes to the record on this tab. If you leave this tab without saving the changes, they will be lost. Are you sure that you want to leave?" - }, - "menu": { - "use": "Use Manual", - "release": "New Version", - "forum": "Help Forum", - "nGql": "nGQL" - }, - "link": { - "nGQLHref": "https://docs.nebula-graph.io/3.0.0/3.ngql-guide/1.nGQL-overview/1.overview/", - "mannualHref": "https://docs.nebula-graph.io/3.0.0/nebula-studio/about-studio/st-ug-what-is-graph-studio/", - "versionLogHref": "https://docs.nebula-graph.io/3.0.0/nebula-studio/about-studio/st-ug-release-note/", - "forumLink": "https://discuss.nebula-graph.io/" - }, - "_schema": { - "spaceList": "Graph Space List", - "createSpace": "Create Space", - "No": "No", - "spaceName": "Name", - "partitionNumber": "Partition Number", - "replicaFactor": "Replica Factor", - "charset": "Charset", - "collate": "Collate", - "vidType": "Vid Type", - "atomicEdge": "Atomic Edge", - "group": "Group", - "comment": "Comment", - "operations": "Operations", - "useSpaceErrTip": "Space not found. Trying to use a newly created graph space may fail because the creation is implemented asynchronously. To make sure the follow-up operations work as expected, Wait for two heartbeat cycles, i.e., 20 seconds.", - "spaceNameEnter": "Please enter the space name", - "propertyCount": "Property Num", - "configTypeList": "{space} {type} List", - "configTypeAction": "{action} {type}", - "defineFields": "Define Properties", - "timestampFormat": "Supported data inserting methods:
1. call function now()
2. call function timestamp(), for example: timestamp('2021-07-05T06:18:43.984000')
3. Input the timestamp directly, namely the number of seconds from 1970-01-01 00:00:00", - "dateFormat": "Supported data inserting methods:
Call function date(), for example: date('2021-03-17')", - "timeFormat": "Supported data inserting methods:
Call function time(), for example: time('17:53:59')", - "datetimeFormat": "Supported data inserting methods:
Call function datetime(), for example: datetime('2021-03-17T17:53:59')", - "geographyFormat": "Supported data inserting methods:
Call function ST_GeogFromText(), for example:ST_GeogFromText('POINT(6 10)')", - "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})", - "setTTL": "Set TTL (Time To Live)" - } -} diff --git a/app-v2/config/locale/zh-CN.json b/app-v2/config/locale/zh-CN.json deleted file mode 100644 index f8c8363a..00000000 --- a/app-v2/config/locale/zh-CN.json +++ /dev/null @@ -1,390 +0,0 @@ -{ - "common": { - "requestError": "请求错误", - "currentSpace": "当前图空间", - "languageSelect": "语言" , - "seeTheHistory":"查看历史", - "table": "表格", - "log":"日志", - "record": "记录", - "sorryNGQLCannotBeEmpty": "对不起,nGQL语句不能为空", - "disablesUseToSwitchSpace": "禁止使用命令切换Space", - "NGQLHistoryList": "nGQL历史列表", - "spaceTip": "仅对某个Space进行操作时需要", - "empty": "清空", - "run":"运行", - "console": "控制台", - "explore": "图探索", - "ok": "确认", - "success": "成功", - "fail": "失败", - "noData": "没有相应数据", - "cancel": "取消", - "confirm": "确认", - "import": "导入", - "ask": "确定进行当前操作?", - "output":"导出CSV文件", - "openInExplore": "导入图探索", - "schema": "Schema", - "create": "创建", - "serialNumber": "序号", - "name": "名称", - "operation": "操作", - "delete": "删除", - "optional": "可选", - "exportNGQL": "对应的nGQL语句", - "field": "字段", - "relatedProperties": "相关属性", - "type": "类型", - "edit": "编辑", - "deleteSuccess": "删除成功", - "propertyName": "属性名称", - "dataType": "数据类型", - "allowNull": "允许空值", - "defaults": "默认值", - "addProperty": "添加属性", - "updateSuccess": "更新成功", - "add": "添加", - "tag": "标签", - "edge": "边类型", - "index": "索引", - "list": "列表", - "yes": "确定", - "no": "取消", - "graph": "可视化", - "description": "说明", - "zoomOut": "缩小", - "zoomIn": "放大", - "move": "移动", - "rollback": "撤销", - "unlock": "解锁", - "lock": "锁定", - "moreSuggestion": "更多建议", - "algorithm": "算法", - "viewDocs": "查看文档", - "hotKeys": "快捷键", - "show": "显示", - "selected": "选中", - "search": "查询", - "color": "颜色", - "icon": "图标", - "copy": "复制", - "copySuccess": "已复制到剪切板", - "total": "共计", - "exportSelectVertexes": "导出选中点CSV", - "exportSelectEdges": "导出选中边CSV", - "noSelectedData": "当前没有选中数据", - "namePlaceholder":"请输入{name}名", - "comment": "描述", - "space": "图空间", - "version": "版本", - "statistics": "统计" - }, - "warning": { - "configServer": "请先配置服务器", - "connectError": "数据库连接有误,请重新配置" - }, - "NGQLOutput": { - "success": "执行成功" - }, - "configServer": { - "connect": "连接", - "host": "Host", - "username": "用户名", - "password": "密码", - "success": "配置成功", - "fail": "配置失败", - "clear": "清除连接", - "title": "配置数据库" - }, - "formRules": { - "hostRequired": "请填写数据库服务器的IP地址", - "usernameRequired": "请填写用户名", - "passwordRequired": "请填写密码", - "nodeIdError": "格式错误,一行1个VID,按回车键分隔", - "idRequired": "请输入导入的节点id", - "positiveIntegerRequired": "请输入一个非负整数", - "nameValidate": "命名必须以字母开头,且只支持输入英文字母、数字以及下划线_", - "nameRequired": "请输入名称", - "numberRequired": "请输入正整数", - "replicaLimit": "副本数量不得超过你当前 online 机器数量({number})", - "propertyRequired": "请输入属性名称", - "defaultRequired": "请输入默认值", - "ttlRequired": "请选择TTL指定的属性, 且属性的数据类型需为integer或timestamp", - "ttlDurationRequired": "请输入时间(s)", - "dataTypeRequired": "请选择数据类型", - "fixedStringLength": "Fixed String 长度需为正整数" - }, - "console": { - "cost": "开销", - "execTime": "执行时间消耗", - "exportVertex": "请选择表中代表点VID的列", - "exportEdge": "请选择结果中分别代表边的起点(src_vid)、终点(dst_vid)和权重(rank)的列", - "showSubgraphs": "查看子图", - "deleteHistory": "清除历史", - "parameterDisplay": "自定义参数 展示" - }, - "explore": { - "clear": "清除", - "clearTip": "是否清除当前视图?", - "startWithVertices": "开始探索", - "addConfirm": "确认添加", - "undo": "回退", - "deleteSelectNodes": "删除选中", - "expand": "拓展", - "unExpand": "取消拓展", - "fileImport": "文件导入", - "sampleImport": "样本导入", - "importPlaceholder": "输入VID或者用于生成VID的数据,一行一个数据,按回车键断开。格式示例如下:\nstring1\nstring2\nstring3", - "outgoing": "流出", - "incoming": "流入", - "bidirect": "双向", - "filter": "自定义筛选条件", - "operator": "运算符", - "value": "值", - "selectSpace": "请选择Space", - "selectReminder": "切换Space会清除当前显示的数据,您确定要切换吗?", - "zoom": "缩放", - "showTags": "显示点", - "showEdges": "显示边", - "confirm": "确定", - "vertexStyle": "节点颜色/图标", - "quantityLimit": "结果数量限制", - "colorGroupByTag": "按标签类型分类", - "noVertexPrompt": "当前画板没有点数据,请", - "search": "探索", - "queryById": "按VID查询", - "queryByIndex": "按索引查询", - "queryByCustom": "自定义查询", - "idToBeQueried": "指定VID", - "idPretreatment": "VID预处理", - "indexQueryPrompt_prefix": "当前Space ", - "indexQueryPrompt_suffix": "下,没有任何标签的索引,无法进行索引查询", - "indexQueryPrompt2": "请按如下示例创建标签索引", - "runCodeInConsole": "去控制台运行语句", - "indexLink": "关于索引的更多信息,请查看对应的", - "documentIntroduction": "文档介绍", - "selectIndex": "选择索引", - "paramFilter": "使用索引", - "relationship": "组合关系", - "operationConfirm": "删除操作会清空后续筛选条件。请确认是否继续执行", - "quiry": "查询", - "customQueryDescription": "可在控制台输入相应nGQL语句,查询得到结果后,点击上图中的“导入图探索”按钮,进行可视化探索", - "openInConsole": "去控制台", - "insertMethodSelect": "当前画板存在部分数据,请选择新增查询结果的插入方式", - "incrementalInsertion": "增量插入", - "insertAfterClear": "清除插入", - "emptyIndex": "索引为空", - "indexConditionDescription": "匹配字段时,必须以索引中左边第一个字段开始,如果需要匹配多个字段,不得跳过字段,但是可以省略后续字段。", - "timestampInput": "时间戳字段只支持输入数字", - "documentIntroductionUrl": "https://docs.nebula-graph.com.cn/2.5.0/3.ngql-guide/14.native-index-statements/", - "customQueryUrl": "https://cloud-cdn.nebula-graph.com.cn/studio-resource/go-to-explore_zh.png", - "pretreatmentExplaination": "Hash能预处理bool、double、int、string类型的数据生成VID,但是UUID仅支持预处理string类型的数据。如果您需要使用Hash或UUID预处理string生成VID,则使用单引号或双引号标示每个string。", - "exportToImg": "导出图形", - "exportToCSV":"导出CSV", - "export":"导出", - "toBlobError": "导出失败。当前画布尺寸过大,请缩放画布尺寸后重试。", - "expandTip": "双击任意点也可实现该点的拓展。", - "hotKeysInstructions": "图探索快捷键说明", - "graphAlgorithm": "图算法", - "allPath": "全路径", - "shortestPath": "最短路径", - "noLoopPath": "非循环路径", - "algorithmParams": "算法参数", - "srcId": "起点", - "dstId": "终点", - "relation": "关系", - "direction": "方向", - "stepLimit": "步数限制", - "steps": "步数", - "singleStep": "单步", - "rangeStep": "范围", - "addCondition": "添加条件", - "expansionConditions": "拓展条件", - "customStyle": "自定义颜色/图标", - "nodeSearch": "画板节点搜索", - "searchEmpty": "未查询到相应数据", - "selectedVertexes": "选中的点", - "selectedEdges": "选中的边", - "viewDetails": "查看详情", - "expandItem": "展开", - "collapseItem": "收起", - "searchTip": "当前支持以下比较符 [=, >, <, !=, <>, <=, >=]", - "expressionError": "表达式错误", - "expandTips": "双击节点默认按当前配置快捷展开", - "missingParams": "参数缺失", - "emptyIndexTips": "无属性索引暂不支持查询数据功能,建议选择带属性索引查询", - "docForFindPath": "https://docs.nebula-graph.com.cn/2.5.0/3.ngql-guide/16.subgraph-and-path/2.find-path/" - }, - "import": { - "vertexID": "Vertex ID", - "import":"导入", - "selectSpace": "选择 Space", - "uploadFile": "上传文件", - "uploadSuccess": "上传文件成功", - "importData": "导入数据", - "createTask": "创建导入任务", - "uploadTemp": "导入模板", - "downloadConfig": "下载配置文件", - "viewLogs": "查看日志", - "details": "详情", - "lines": "行", - "taskList": "任务列表", - "taskName": "任务名称", - "vertices": "关联点", - "edge": "关联边", - "runImport": "导入", - "next": "下一步", - "goback":"上一步", - "mountPath": "挂载路径", - "importConfigValidationSuccess": "配置验证成功", - "mountPathPlaceholder": "请输入docker启动的数据挂载路径", - "fileName": "文件名", - "withHeader": "头字段", - "fileType": "类型", - "fileSize": "大小", - "fileTitle": "文件列表", - "fileSizeErrorMsg": "文件必须小于100MB", - "preview": "预览", - "bindDatasource": "绑定数据源", - "confirm": "确认", - "importResults": "导入信息", - "newImport": "新建导入", - "endImport": "终止导入", - "againImport": "再次导入", - "prop": "属性", - "propTip": "{name}中拥有的属性", - "mapping": "对应列标", - "mappingTip": "属性字段对应csv文件的哪一列", - "typeTip": "属性字段对应的数据类型", - "setVertexId": "设为ID", - "setVertexIdTip": "当前字段是否作为Vertex Id", - "useHash": "ID Hash", - "useHashTip": "id字段对应值插入数据库中所做的处理", - "unset": "保持原值", - "uuid": "UUID", - "hash": "Hash", - "setSrc": "设为起点", - "setSrcTip": "将当前字段值作为起点", - "setDst": "设为终点", - "setDstTip": "将当前字段值作为终点", - "setRank": "设为Rank", - "setRankTip": "将当前字段值作为rank", - "edgeText": "边", - "choose": "选择", - "ignore": "忽略", - "vertexText": "点", - "importErrorInfo": "导入数据错误,请检查配置或数据文件", - "clearAllConfigInfo": "是否确定清空所有配置?", - "configFile": "配置文件:", - "logFile": "日志文件:", - "vertexesFile": "点相关文件:", - "vertexFile": "该点配置文件:", - "vertexErrorFile": "该点错误数据文件:", - "edgesFilePath": "边配置文件:", - "edgeFilePath": "该边配置文件:", - "edgeErrorFilePath": "该边错误数据文件:", - "all": "全部", - "mountPathWarning": "导入数据需在应用启动时配置WORKING_DIR环境变量,否则无法进行。", - "notExist": "不存在", - "importError": "未知错误", - "importMappingError": "数据文件配置映射导入失败", - "importFormatError": "数据文件格式不统一", - "importFileConfigError": "数据文件配置相关错误", - "importFileDownloadError": "数据文件下载失败", - "importFileError": "文件相关错误", - "importNebulaError": "与实例交互相关错误", - "datasource": "数据源", - "indexNotEmpty": "对应列标不能为空", - "reset": "重置", - "importFinished": "导入任务已结束", - "enterPassword": "请输入 nebula 账号密码", - "isEmpty": "为空", - "startImporting": "开始导入", - "stopImportingSuccess": "已停止导入", - "deleteSuccess": "已删除任务记录", - "batchSize": "批处理量", - "importCompleted": "导入完成", - "importStopped": "导入中止", - "importFailed": "导入失败", - "notImported": "{total}行未导入", - "readFailed": "{total}行读取失败", - "selectFile": "选择绑定文件", - "addTag": "添加 Tag" - }, - "schema": { - "spaceList": "图空间列表", - "backToSpaceList": "图空间列表", - "useSpaceErrTip": "图空间未找到。立刻尝试使用刚创建的图空间可能会失败,因为创建是异步实现的。为确保数据同步,后续操作能顺利进行,请等待 2 个心跳周期(20 秒)。", - "partitionNumDescription": "partition_num 表示数据分片数量。默认值为 100。建议为硬盘数量的 5 倍。", - "replicaFactorDescription": "replica_factor 表示副本数量。默认值是 1,生产集群建议为 3。由于采用多数表决原理,因此需为奇数。", - "charsetDescription": "charset 表示字符集,定义了字符以及字符的编码,默认为 utf8。", - "collateDescription": "collate 表示字符序,定义了字符的比较规则,默认为 utf8_bin。", - "vidTypeDescription": "vid type 指定图空间中点 ID(VID)的数据类型。", - "createSuccess": "创建成功", - "defineFields": "定义属性", - "uniqProperty": "属性名称不允许重名", - "cancelOperation": "是否取消配置并关闭面板", - "cancelPropmt": "关闭面板将删除所有属性,是否继续?", - "fieldDisabled": "该属性被 ttl_col 引用,不支持更改操作,如要更改,请先更新 ttl", - "ttlRequired": "请填写完整 ttl 关联的属性以及持续时间", - "fieldRequired": "请填写完整属性名称及数据类型", - "indexExist": "已拥有索引,无法同时配置 TTL", - "indexType": "索引类型", - "indexName": "索引名称", - "indexFields": "索引属性", - "dragSorting": "(可拖拽排序)", - "selectFields": "选择关联的属性", - "indexedLength": "索引长度", - "indexedLengthDescription": "设置索引字符串的长度。如果索引定长字符串,则索引长度无法修改。", - "indexedLengthRequired": "索引长度应为正整数", - "backToTagList": "返回标签列表", - "backToEdgeList": "返回边类型列表", - "backToIndexList": "返回索引列表", - "leavePage": "是否离开当前页面", - "leavePagePrompt": "离开当前页面后,未保存的记录将丢失" - }, - "menu": { - "use": "使用手册", - "release": "新发布", - "forum": "求助论坛", - "nGql": "nGQL" - }, - "link": { - "nGQLHref": "https://docs.nebula-graph.com.cn/3.0.0/3.ngql-guide/1.nGQL-overview/1.overview/", - "mannualHref": "https://docs.nebula-graph.com.cn/3.0.0/nebula-studio/about-studio/st-ug-what-is-graph-studio/", - "versionLogHref": "https://docs.nebula-graph.com.cn/3.0.0/nebula-studio/about-studio/st-ug-release-note/", - "forumLink": "https://discuss.nebula-graph.com.cn/" - }, - "_schema": { - "spaceList": "图空间列表", - "createSpace": "创建图空间", - "No": "序号", - "spaceName": "名称", - "partitionNumber": "Partition Number", - "replicaFactor": "Replica Factor", - "charset": "Charset", - "collate": "Collate", - "vidType": "Vid Type", - "atomicEdge": "Atomic Edge", - "group": "Group", - "comment": "Comment", - "operations": "操作", - "useSpaceErrTip": "图空间未找到。立刻尝试使用刚创建的图空间可能会失败,因为创建是异步实现的。为确保数据同步,后续操作能顺利进行,请等待 2 个心跳周期(20 秒)。", - "spaceNameEnter": "请输入图空间名称", - "propertyCount": "属性数量", - "configTypeList": "{space} {type}列表", - "configTypeAction": "{action}{type}", - "defineFields": "定义属性", - "timestampFormat": "时间类型支持插入方式:
1. 调用函数 now()
2. 调用函数 timestamp(),例如:timestamp('2021-07-05T06:18:43.984000')
3. 直接输入时间戳,即从 1970-01-01 00:00:00 开始的秒数", - "dateFormat": "日期类型支持插入方式:
调用函数 date(),例如:date('2021-03-17')", - "timeFormat": "时间类型支持插入方式:
调用函数 time(),例如time('17:53:59')", - "datetimeFormat": "日期时间类型支持插入方式:
调用函数 datetime(),例如:datetime('2021-03-17T17:53:59')", - "geographyFormat": "geo 类型支持插入方式:
调用函数 ST_GeogFromText(),例如:ST_GeogFromText('POINT(6 10)')", - "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})", - "setTTL": "设置TTL(存活时间)" - } -} \ No newline at end of file diff --git a/app-v2/config/nebulaQL.ts b/app-v2/config/nebulaQL.ts deleted file mode 100644 index 950fdbaf..00000000 --- a/app-v2/config/nebulaQL.ts +++ /dev/null @@ -1,231 +0,0 @@ -const nebulaWordsUppercase = [ - 'ADD', - 'ALTER', - 'AND', - 'AS', - 'ASC', - 'BALANCE', - 'BIGINT', - 'BOOL', - 'BY', - 'CHANGE', - 'COMPACT', - 'CREATE', - 'DELETE', - 'DESC', - 'DESCRIBE', - 'DISTINCT', - 'DOUBLE', - 'DOWNLOAD', - 'DROP', - 'EDGE', - 'EDGES', - 'EXISTS', - 'FETCH', - 'FIND', - 'FLUSH', - 'FROM', - 'GET', - 'GO', - 'GRANT', - 'IF', - 'IN', - 'INDEX', - 'INDEXES', - 'INGEST', - 'INSERT', - 'INT', - 'INTERSECT', - 'IS', - 'LIMIT', - 'LOOKUP', - 'MATCH', - 'MINUS', - 'NO', - 'NOT', - 'NULL', - 'OF', - 'OFFSET', - 'ON', - 'OR', - 'ORDER', - 'OVER', - 'OVERWRITE', - 'PROP', - 'REBUILD', - 'RECOVER', - 'REMOVE', - 'RETURN', - 'REVERSELY', - 'REVOKE', - 'SET', - 'SHOW', - 'STEPS', - 'STOP', - 'STRING', - 'SUBMIT', - 'TAG', - 'TAGS', - 'TIMESTAMP', - 'TO', - 'UNION', - 'UPDATE', - 'UPSERT', - 'UPTO', - 'USE', - 'VERTEX', - 'WHEN', - 'WHERE', - 'WITH', - 'XOR', - 'YIELD', - 'ACCOUNT', - 'ADMIN', - 'ALL', - 'AVG', - 'BIDIRECT', - 'BIT_AND', - 'BIT_OR', - 'BIT_XOR', - 'CHARSET', - 'COLLATE', - 'COLLATION', - 'CONFIGS', - 'COUNT', - 'COUNT_DISTINCT', - 'DATA', - 'DBA', - 'DEFAULT', - 'FORCE', - 'GOD', - 'GRAPH', - 'GROUP', - 'GUEST', - 'HDFS', - 'HOSTS', - 'JOB', - 'JOBS', - 'LEADER', - 'MAX', - 'META', - 'MIN', - 'OFFLINE', - 'PART', - 'PARTITION_NUM', - 'PARTS', - 'PASSWORD', - 'PATH', - 'REPLICA_FACTOR', - 'ROLE', - 'ROLES', - 'SHORTEST', - 'SNAPSHOT', - 'SNAPSHOTS', - 'SPACE', - 'SPACES', - 'STATUS', - 'STD', - 'STORAGE', - 'SUM', - 'TTL_COL', - 'TTL_DURATION', - 'USER', - 'USERS', - 'UUID', - 'VALUES', - 'COMMENT', - ':PARAM', - ':PARAMS', -]; - -export const ban = ['use', 'USE']; - -export const operators = [ - // Bitwise Operator - '&', - '|', - '^', - // Math - 'abs', - 'floor', - 'ceil', - 'round', - 'sqrt', - 'cbrt', - 'hypot', - 'pow', - 'exp', - 'exp2', - 'log', - 'log2', - 'sin', - 'asin', - 'cos', - 'acos', - 'tan', - 'atan', - 'rand32', - 'rand64', - // String - 'strcasecmp', - 'lower', - 'upper', - 'length', - 'trim', - 'ltrim', - 'rtrim', - 'left', - 'right', - 'lpad', - 'rpad', - 'substr', - 'hash', - // Timestamp - 'now', - // Comparison Functions And Operators - '=', - '/', - '==', - '!=', - '<', - '<=', - '-', - '%', - '+', - '*', - '-', - 'udf_is_in', - // Aggregate - 'AVG', - 'COUNT', - 'MAX', - 'MIN', - 'STD', - 'SUM', - // Logical Operator - '&&', - '!', - '||', - 'XOR', - // Order by Function - 'ORDER', - 'BY', - 'DESC', - 'ASC', - // Limit - 'LIMIT', - // Set Operations - 'UNION', - 'INTERSECT', - 'MINUS', - // uuid - 'uuid', - // assignment - '=>', -]; - -const nebulaWordsLowercase = nebulaWordsUppercase.map(w => w.toLowerCase()); - -export const keyWords = [...nebulaWordsUppercase, ...nebulaWordsLowercase]; - -export const maxLineNum = 20; diff --git a/app-v2/config/rules.ts b/app-v2/config/rules.ts deleted file mode 100644 index 745fb323..00000000 --- a/app-v2/config/rules.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { NAME_REGEX, POSITIVE_INTEGER_REGEX } from '@appv2/utils/constant'; - -export const hostRulesFn = intl => [ - { - required: true, - message: intl.get('formRules.hostRequired'), - }, -]; - -export const usernameRulesFn = intl => [ - { - required: true, - message: intl.get('formRules.usernameRequired'), - }, -]; - -export const passwordRulesFn = intl => [ - { - required: true, - message: intl.get('formRules.passwordRequired'), - }, -]; - -export const nodeIdRulesFn = intl => [ - { - required: true, - message: intl.get('formRules.idRequired'), - }, - { - pattern: /^(.+)*(\n.+)*(\n)*$/, - message: intl.get('formRules.nodeIdError'), - }, -]; - -export const nameRulesFn = intl => [ - { - required: true, - message: intl.get('formRules.nameRequired'), - }, - { - pattern: NAME_REGEX, - message: intl.get('formRules.nameValidate'), - }, -]; - -export const numberRulesFn = intl => [ - { - pattern: POSITIVE_INTEGER_REGEX, - message: intl.get('formRules.numberRequired'), - }, -]; - -export const replicaRulesFn = (intl, activeMachineNum) => [ - { - pattern: POSITIVE_INTEGER_REGEX, - message: intl.get('formRules.numberRequired'), - }, - { - validator(_rule, value, callback) { - if (value && Number(value) > activeMachineNum) { - callback( - intl.get('formRules.replicaLimit', { number: activeMachineNum }), - ); - } - callback(); - }, - }, -]; diff --git a/app-v2/config/service.ts b/app-v2/config/service.ts deleted file mode 100644 index 19ac734b..00000000 --- a/app-v2/config/service.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { _delete, get, post, put } from '../utils/http'; - -const execNGQL = post('/api-nebula/db/exec'); - -const connectDB = post('/api-nebula/db/connect'); - -const disconnectDB = post('/api-nebula/db/disconnect'); - -const importData = post('/api-nebula/task/import'); - -const handleImportAction = post('/api-nebula/task/import/action'); - -const getLog = get('/api/import/log'); -const finishImport = post('/api/import/finish'); - -const getImportWokingDir = get('/api/import/working_dir'); -const getUploadDir = get('/api/import/working_dir'); -const getTaskDir = get('/api/import/task_dir'); - -const deteleFile = params => { - const { filename } = params; - return _delete(`/api/files/${filename}`)(); -}; -const getFiles = get('/api/files'); -const getAppInfo = get('/api/app'); -const uploadFiles = (params?, config?) => - put('/api/files')(params, { - ...config, - headers: { - 'Content-Type': 'multipart/form-data', - }, - }); -export default { - execNGQL, - connectDB, - disconnectDB, - importData, - finishImport, - handleImportAction, - getLog, - getImportWokingDir, - getUploadDir, - getTaskDir, - deteleFile, - getFiles, - getAppInfo, - uploadFiles, -}; diff --git a/app-v2/context/LanguageContext.ts b/app-v2/context/LanguageContext.ts deleted file mode 100644 index 4f4c0644..00000000 --- a/app-v2/context/LanguageContext.ts +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import intl from 'react-intl-universal'; -import Cookie from 'js-cookie'; -import { INTL_LOCALES, INTL_LOCALE_SELECT } from '@appv2/config/constants'; -export const LanguageContext = React.createContext({ - currentLocale: INTL_LOCALE_SELECT.EN_US.NAME, - toggleLanguage: (currentLocale: string) => { - Cookie.set('lang', currentLocale); - intl.init({ - currentLocale, - locales: INTL_LOCALES, - }); - }, -}); diff --git a/app-v2/context/index.ts b/app-v2/context/index.ts deleted file mode 100644 index 960a3c9e..00000000 --- a/app-v2/context/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * this folder for React context api - */ - -export * from './LanguageContext'; diff --git a/app-v2/index.html b/app-v2/index.html deleted file mode 100644 index 85abb767..00000000 --- a/app-v2/index.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - Nebula Graph Studio - - - - - - -
-
-
-
-
- - - diff --git a/app-v2/index.tsx b/app-v2/index.tsx deleted file mode 100644 index 2b05951a..00000000 --- a/app-v2/index.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import { hot } from 'react-hot-loader/root'; -import { Spin } from 'antd'; -import React, { Suspense, lazy, useState } from 'react'; -import ReactDom from 'react-dom'; -import { Route, BrowserRouter as Router, Switch, useHistory } from 'react-router-dom'; -import { observer } from 'mobx-react-lite'; -import rootStore, { StoreProvider } from './stores'; -import dayjs from 'dayjs'; -import intl from 'react-intl-universal'; -import duration from 'dayjs/plugin/duration'; -import AuthorizedRoute from './AuthorizedRoute'; -import Cookie from 'js-cookie'; -import { INTL_LOCALES } from '@appv2/config/constants'; -import { LanguageContext } from '@appv2/context'; -const Login = lazy(() => import('@appv2/pages/Login')); -const MainPage = lazy(() => import('@appv2/pages/MainPage')); - -import './common.less'; -import './app.less'; -dayjs.extend(duration); - -const defaultLanguage = Cookie.get('lang') || document.documentElement.getAttribute('lang'); -intl.init({ - currentLocale: defaultLanguage || 'EN_US', - locales: INTL_LOCALES, -}); - - -const PageRoot = observer(() => { - const [currentLocale, setCurrentLocale] = useState( - defaultLanguage || 'EN-US', - ); - - const toggleLanguage = (locale: string) => { - Cookie.set('lang', locale); - setCurrentLocale(locale); - intl - .init({ - currentLocale: locale, - locales: INTL_LOCALES, - }); - }; - - return ( - - - - - - - - ); -}); - -const App = () => { - const history = useHistory(); - rootStore.global.history = history; - - return ( - - }> - - - - - ); -}; - -const HotPageRoot = hot(PageRoot); - -ReactDom.render(, document.getElementById('app')); diff --git a/app-v2/static/import.d.ts b/app-v2/static/import.d.ts deleted file mode 100644 index d0cd11ed..00000000 --- a/app-v2/static/import.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare module '*.svg'; -declare module '*.png'; -declare module '*.jpg'; -declare module '*.jpeg'; -declare module '*.gif'; -declare module '*.bmp'; -declare module '*.tiff'; diff --git a/app-v2/utils/constant.ts b/app-v2/utils/constant.ts deleted file mode 100644 index 0c65e14d..00000000 --- a/app-v2/utils/constant.ts +++ /dev/null @@ -1,213 +0,0 @@ -export const ENUM_OF_COMPARE = { - int64: [ - { - label: '==', - value: '==', - }, - { - label: '!=', - value: '!=', - }, - { - label: '>', - value: '>', - }, - { - label: '>=', - value: '>=', - }, - { - label: '<', - value: '<', - }, - { - label: '<=', - value: '<=', - }, - ], - string: [ - { - label: '==', - value: '==', - }, - { - label: 'CONTAINS', - value: 'CONTAINS', - }, - { - label: 'STARTS WITH', - value: 'STARTS WITH', - }, - { - label: 'ENDS WITH', - value: 'ENDS WITH', - }, - ], - bool: [ - { - label: '==', - value: '==', - }, - ], - double: [ - { - label: '==', - value: '==', - }, - { - label: '!=', - value: '!=', - }, - { - label: '>', - value: '>', - }, - { - label: '>=', - value: '>=', - }, - { - label: '<', - value: '<', - }, - { - label: '<=', - value: '<=', - }, - ], - timestamp: [ - { - label: '==', - value: '==', - }, - { - label: '!=', - value: '!=', - }, - { - label: '>', - value: '>', - }, - { - label: '>=', - value: '>=', - }, - { - label: '<', - value: '<', - }, - { - label: '<=', - value: '<=', - }, - ], -}; - -export const DATA_TYPE = [ - { - value: 'int', - label: 'int', - }, - { - value: 'bool', - label: 'bool', - }, - { - value: 'string', - label: 'string', - }, - { - value: 'fixed_string', - label: 'fixed_string', - }, - { - value: 'double', - label: 'double', - }, - { - value: 'int32', - label: 'int32', - }, - { - value: 'int16', - label: 'int16', - }, - { - value: 'int8', - label: 'int8', - }, - { - value: 'float', - label: 'float', - }, - { - value: 'date', - label: 'date', - }, - { - value: 'time', - label: 'time', - }, - { - value: 'datetime', - label: 'datetime', - }, - { - value: 'timestamp', - label: 'timestamp', - }, - { - value: 'geography', - label: 'geography', - }, - { - value: 'geography(point)', - label: 'geography(point)', - }, - { - value: 'geography(linestring)', - label: 'geography(linestring)', - }, - { - value: 'geography(polygon)', - label: 'geography(polygon)', - }, - { - value: 'duration', - label: 'duration', - }, -]; - -export const RELATION_OPERATORS = [ - { - label: 'NOT', - value: 'NOT', - }, - { - label: 'AND', - value: 'AND', - }, - { - label: 'OR', - value: 'OR', - }, - { - label: 'XOR', - value: 'XOR', - }, -]; - -export const EXPLAIN_DATA_TYPE = [ - 'date', - 'time', - 'datetime', - 'timestamp', - 'geography', - 'geography(point)', - 'geography(linestring)', - 'geography(polygon)', - 'duration', -]; - -export const NAME_REGEX = /^[a-zA-Z][a-zA-Z0-9_]*$/; -export const POSITIVE_INTEGER_REGEX = /^[1-9]\d*$/g; diff --git a/app-v2/utils/fetch.ts b/app-v2/utils/fetch.ts deleted file mode 100644 index b6b2b54b..00000000 --- a/app-v2/utils/fetch.ts +++ /dev/null @@ -1,83 +0,0 @@ -import service from '#app/config/service'; -import { handleVidStringName } from '#app/utils/function'; -import { getExploreGQLWithIndex } from '#app/utils/gql'; - -interface IMatchVertex { - vid?: string; - tags?: string[]; - properties?: Record; -} - -export async function fetchEdgeProps(payload: { - idRoutes: string[]; - type: string; - edgeFields?: any; -}) { - const { idRoutes, edgeFields, type } = payload; - const edgeType = '`' + type + '`'; - let gql = `fetch prop on ${edgeType} ${idRoutes.join(', ')}`; - if (edgeFields) { - gql += ` yield ${edgeType}._src, ${edgeType}._dst `; - edgeFields[type].forEach(edgeField => { - if (edgeField !== 'type') { - gql += `,${edgeType}.${edgeField}`; - } - }); - } else { - gql += ' YIELD edge as `edges_`'; - } - - const { data } = (await service.execNGQL({ - gql, - })) as any; - return data; -} - -export async function fetchVertexPropsWithIndex(payload: { - tag: string; - filters: any[]; - quantityLimit: number | null; -}) { - const gql = getExploreGQLWithIndex(payload); - const { code, data, message } = (await service.execNGQL({ - gql, - })) as any; - return { code, data, message }; -} - -export async function fetchVertexProps(payload: { - ids: string[]; - spaceVidType: string; -}) { - const { ids, spaceVidType } = payload; - const _ids = ids.map(id => handleVidStringName(id, spaceVidType)).join(', '); - const gql = `MATCH (n) WHERE id(n) IN [${_ids}] RETURN n`; - const { data, code, message } = (await service.execNGQL({ - gql, - })) as any; - if (code === 0) { - const vertexList = data.tables.map(i => i._verticesParsedList).flat(); - const vertexes = vertexList.map(vertex => { - const _vertex: IMatchVertex = {}; - _vertex.vid = vertex.vid || ''; - _vertex.tags = vertex.tags || []; - _vertex.properties = vertex.properties || {}; - return _vertex; - }); - return { data: vertexes, code, message }; - } - return { data, code, message }; -} - -export async function fetchBidirectVertexes(payload: { - ids: string[]; - spaceVidType: string; -}) { - const { ids, spaceVidType } = payload; - const _ids = ids.map(id => handleVidStringName(id, spaceVidType)).join(', '); - const gql = `GO FROM ${_ids} OVER * BIDIRECT yield edge as \`_edge\``; - const { code, data, message } = (await service.execNGQL({ - gql, - })) as any; - return { code, data, message }; -} diff --git a/app-v2/utils/file.ts b/app-v2/utils/file.ts deleted file mode 100644 index c40a1ab6..00000000 --- a/app-v2/utils/file.ts +++ /dev/null @@ -1,20 +0,0 @@ -export function readFileContent(file) { - const reader = new FileReader(); - return new Promise((resolve, reject) => { - reader.onload = (event: any) => resolve(event.target.result); - reader.onerror = error => reject(error); - reader.readAsText(file); - }); -} - -export function getFileSize(size: number) { - if (size < 1000) { - return `${size} B`; - } else if (size < 1000000) { - return `${(size / 1000).toFixed(2)} KB`; - } else if (size < 1000000000) { - return `${(size / 1000000).toFixed(2)} MB`; - } else { - return `${(size / 1000000000).toFixed(2)} GB`; - } -} diff --git a/app-v2/utils/function.ts b/app-v2/utils/function.ts deleted file mode 100644 index a54aa687..00000000 --- a/app-v2/utils/function.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { BigNumber } from 'bignumber.js'; -import _ from 'lodash'; - -import { keyWords } from '@appv2/config/nebulaQL'; - -export const handleKeyword = (name: string) => { - return keyWords.includes(name.toLowerCase()) ? `\`${name}\`` : name; -}; - -export const handleVidStringName = (name: string, spaceVidType?: string) => { - if (spaceVidType && spaceVidType === 'INT64') { - return convertBigNumberToString(name); - } - if (name.indexOf(`"`) > -1 && name.indexOf(`'`) === -1) { - return `'${name}'`; - } else { - return `"${name}"`; - } -}; - -export const convertBigNumberToString = (value: any) => { - // int precision length in nebula is longer than in javascript - return BigNumber.isBigNumber(value) ? value.toString() : value; -}; - -export const sortByFieldAndFilter = (payload: { - field: string; - searchVal: string; - list: any[]; -}) => { - const { searchVal, list, field } = payload; - if (searchVal) { - return _.orderBy(list, [field], ['asc']).filter((item: any) => - item.name.includes(searchVal), - ); - } else { - return _.orderBy(list, [field], ['asc']); - } -}; diff --git a/app-v2/utils/gql.ts b/app-v2/utils/gql.ts deleted file mode 100644 index 12d4f112..00000000 --- a/app-v2/utils/gql.ts +++ /dev/null @@ -1,268 +0,0 @@ -import { handleKeyword, handleVidStringName } from '@appv2/utils/function'; -import { IAlterForm, IProperty, ISchemaType, IndexType } from '@appv2/interfaces/schema'; - -export const getExploreMatchGQL = (params: { - selectVertexes: any[]; - edgeTypes: string[]; - edgeDirection?: string; - filters?: any[]; - quantityLimit?: number | null; - spaceVidType: string; - stepsType?: string; - step?: string; - minStep?: string; - maxStep?: string; -}) => { - const { - selectVertexes, - edgeTypes, - edgeDirection, - filters, - quantityLimit, - spaceVidType, - stepsType, - step, - minStep, - maxStep, - } = params; - let _step = ''; - if (stepsType === 'single') { - _step = `*${step || 1}`; - } else if (stepsType === 'range' && minStep && maxStep) { - _step = `*${minStep}..${maxStep}`; - } - const _filters = filters - ? filters - .map(filter => `${filter.relation || ''} l.${filter.expression}`) - .join(`\n`) - : ''; - const wheres = _filters ? `AND ALL(l IN e WHERE ${_filters})` : ''; - const gql = `MATCH p=(v)${ - edgeDirection === 'incoming' ? '<-' : '-' - }[e${edgeTypes.map(edge => `:${handleKeyword(edge)}`).join('|')}${_step}]${ - edgeDirection === 'outgoing' ? '->' : '-' - }(v2) -WHERE id(v) IN [${selectVertexes - .map(i => handleVidStringName(i.name, spaceVidType)) - .join(', ')}] - ${wheres} RETURN p LIMIT ${quantityLimit ? quantityLimit : 100}`; - return gql; -}; - -export const getExploreGQLWithIndex = (params: { - tag: string; - filters: any[]; - quantityLimit: number | null; -}) => { - const { tag, filters, quantityLimit } = params; - const tagName = '`' + tag + '`'; - const wheres = filters - .filter( - filter => - filter.field && - filter.operator && - !['', undefined, null].includes(filter.value), - ) - .map(filter => { - const value = - filter.type === 'string' || filter.type.startsWith('fixed_string') - ? handleVidStringName(filter.value) - : filter.value; - return `${filter.relation ? filter.relation : ''} ${tagName}.${ - filter.field - } ${filter.operator} ${value}`; - }) - .join(`\n`); - const gql = - `LOOKUP ON - ${handleKeyword(tag)} ${wheres ? `\nWHERE ${wheres}` : ''} - ` + - ` yield vertex as \`vertex_\` | LIMIT ${ - quantityLimit ? quantityLimit : 100 - }`; - - return gql; -}; - -export const getSpaceCreateGQL = (params: { - name: string; - comment?: string | undefined; - options: { - partition_num: string | undefined; - replica_factor: string | undefined; - vid_type: string; - }; -}) => { - const { name, options, comment } = params; - const optionsStr = Object.keys(options) - .filter(i => options[i] !== undefined && options[i] !== '') - .map(i => { - return `${i} = ${options[i]}`; - }) - .join(', '); - const gql = `CREATE SPACE ${handleKeyword(name)} ${ - optionsStr ? `(${optionsStr})` : '' - } ${comment ? `COMMENT = "${comment}"` : ''}`; - return gql; -}; - -export const getTagOrEdgeCreateGQL = (params: { - type: ISchemaType; - name: string; - comment?: string; - properties?: IProperty[]; - ttl_col?: string; - ttl_duration?: number; -}) => { - const { type, name, properties, ttl_col, ttl_duration, comment } = params; - const propertiesStr = properties - ? properties - .map(item => { - let valueStr = ''; - if (item.value) { - switch (item.type) { - case 'string': - case 'fixed_string': - valueStr = `DEFAULT "${item.value}"`; - break; - case 'timestamp': - const timestampReg = /^(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})$/; - valueStr = timestampReg.test(item.value) - ? `DEFAULT "${item.value}"` - : `DEFAULT ${item.value}`; - break; - default: - valueStr = `DEFAULT ${item.value}`; - } - } - const _type = - item.type !== 'fixed_string' - ? item.type - : item.type + `(${item.fixedLength ? item.fixedLength : ''})`; - const _null = item.allowNull ? 'NULL' : 'NOT NULL'; - const _comment = item.comment ? `COMMENT "${item.comment}"` : ''; - const conbine = [ - handleKeyword(item.name), - _type, - _null, - valueStr, - _comment, - ]; - return conbine.join(' '); - }) - .join(', ') - : ''; - const ttlStr = ttl_col - ? `TTL_DURATION = ${ttl_duration || - ''}, TTL_COL = "${ttl_col || ''}"` - : ''; - const gql = `CREATE ${type} ${handleKeyword(name)} ${ - propertiesStr.length > 0 ? `(${propertiesStr})` : '()' - } ${ttlStr} ${ - comment ? `${ttlStr.length > 0 ? ', ' : ''}COMMENT = "${comment}"` : '' - }`; - return gql; -}; - -export const getAlterGQL = (params: IAlterForm) => { - let content; - const { type, name, action, config } = params; - if (action === 'TTL' && config.ttl) { - const { ttl } = config; - content = `TTL_DURATION = ${ttl.duration || 0}, TTL_COL = "${ttl.col}"`; - } else if (action === 'COMMENT' && config.comment) { - content = `COMMENT="${config.comment}"`; - } else if (action !== 'TTL' && action !== 'COMMENT' && config.fields) { - const date = config.fields - .map(item => { - const { name, type, value, fixedLength, allowNull, comment } = item; - const propertyName = handleKeyword(name); - if (action === 'DROP') { - return propertyName; - } - let str = `${propertyName} ${ - type !== 'fixed_string' - ? type - : type + `(${fixedLength ? item.fixedLength : ''})` - } ${allowNull ? 'NULL' : 'NOT NULL'}`; - if (value) { - switch (type) { - case 'string': - case 'fixed_string': - str += ` DEFAULT "${value}"`; - break; - case 'timestamp': - const timestampReg = /^(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})$/; - str += timestampReg.test(value) - ? ` DEFAULT "${value}"` - : ` DEFAULT ${value}`; - break; - default: - str += ` DEFAULT ${value}`; - } - } - if (comment) { - str += ` COMMENT "${comment}"`; - } - return str; - }) - .join(', '); - content = `${action} (${date})`; - } - const gql = `ALTER ${type} ${handleKeyword(name)} ${content}`; - return gql; -}; - -export const getIndexCreateGQL = (params: { - type: IndexType; - name: string; - associate: string; - comment?: string; - fields: string[]; -}) => { - const { type, name, associate, fields, comment } = params; - const combine = associate - ? `on ${handleKeyword(associate)}(${fields.join(', ')})` - : ''; - const gql = `CREATE ${type} INDEX ${handleKeyword(name)} ${combine} ${ - comment ? `COMMENT = "${comment}"` : '' - }`; - return gql; -}; - -export const getPathGQL = (params: { - type: string; - srcId: string[]; - dstId: string[]; - relation?: string[]; - direction?: string; - stepLimit?: number | null; - quantityLimit?: number | null; - spaceVidType: string; -}) => { - const { - type, - srcId, - dstId, - relation, - direction, - stepLimit, - quantityLimit, - spaceVidType, - } = params; - const _srcIds = srcId - .map(item => handleVidStringName(item, spaceVidType)) - .join(', '); - const _dstIds = dstId - .map(item => handleVidStringName(item, spaceVidType)) - .join(', '); - const _relation = relation && relation.length > 0 ? relation.join(', ') : '*'; - const gql = - `FIND ${type} PATH FROM ${_srcIds} TO ${_dstIds} over ${_relation}` + - `${direction ? ` ${direction}` : ''}` + - `${stepLimit ? ' UPTO ' + stepLimit + ' STEPS' : ''}` + - ' yield path as `paths_`' + - `${quantityLimit ? ' | LIMIT ' + quantityLimit : ''}`; - - return gql; -}; diff --git a/app-v2/utils/http.ts b/app-v2/utils/http.ts deleted file mode 100644 index eb2eb60c..00000000 --- a/app-v2/utils/http.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { message } from 'antd'; -import axios from 'axios'; -import JSONBigint from 'json-bigint'; -import intl from 'react-intl-universal'; - -import { trackEvent } from './stat'; -import { getRootStore } from '@appv2/stores'; - - -const service = axios.create({ - transformResponse: [ - data => { - try { - const _data = JSONBigint.parse(data); - return _data; - } catch (err) { - try { - return JSON.parse(data); - } catch (e) { - return data; - } - } - }, - ], -}); - -service.interceptors.request.use(config => { - config.headers['Content-Type'] = 'application/json'; - - return config; -}); - -service.interceptors.response.use( - (response: any) => { - const { code, message: errMsg } = response.data; - // if connection refused, login again - if ( - code === -1 && - errMsg && - (errMsg.includes('Connection refused') || - errMsg.includes('broken pipe') || - errMsg.includes('session expired') || - errMsg.includes('an existing connection was forcibly closed')) - ) { - message.warning(intl.get('warning.connectError')); - getRootStore().global.logout(); - } else if (code === -1 && errMsg) { - message.warning(errMsg); - } - return response.data; - }, - (error: any) => { - if (error.response && error.response.status) { - message.error( - `${intl.get('common.requestError')}: ${error.response.status} ${ - error.response.statusText - }`, - ); - return error.response; - } else { - message.error(`${intl.get('common.requestError')}: ${error}`); - return error; - } - }, -); - -const sendRequest = async(type: string, api: string, params?, config?) => { - const { trackEventConfig, ...otherConfig } = config; - let res; - switch (type) { - case 'get': - res = (await service.get(api, { params, ...otherConfig })) as any; - break; - case 'post': - res = (await service.post(api, params, otherConfig)) as any; - break; - case 'put': - res = (await service.put(api, params, otherConfig)) as any; - break; - case 'delete': - res = (await service.delete(api, params)) as any; - break; - default: - break; - } - - if (res && trackEventConfig) { - trackService(res, trackEventConfig); - } - return res; -}; - -const trackService = (res, config) => { - const { category, action } = config; - trackEvent(category, action, res.code === 0 ? 'ajax_success' : 'ajax_failed'); -}; - -const get = (api: string) => (params?: object, config = {}) => - sendRequest('get', api, params, config); - -const post = (api: string) => (params?: object, config = {} as any) => - sendRequest('post', api, params, config); - -const put = (api: string) => (params?: object, config = {}) => - sendRequest('put', api, params, config); - -const _delete = (api: string) => (params?: object, config = {}) => - sendRequest('delete', api, params, config); - -export { get, post, put, _delete }; diff --git a/app-v2/utils/import.ts b/app-v2/utils/import.ts deleted file mode 100644 index 30e1ffb4..00000000 --- a/app-v2/utils/import.ts +++ /dev/null @@ -1,286 +0,0 @@ -import { message } from 'antd'; -import _ from 'lodash'; -import intl from 'react-intl-universal'; - -import { handleVidStringName } from './function'; - -export function configToJson(payload) { - const { - space, - username, - password, - host, - verticesConfig, - edgesConfig, - taskDir, - spaceVidType, - batchSize - } = payload; - const vertexToJSON = vertexDataToJSON( - verticesConfig, - taskDir, - spaceVidType, - batchSize - ); - const edgeToJSON = edgeDataToJSON( - edgesConfig, - taskDir, - spaceVidType, - batchSize - ); - const files: any[] = [...vertexToJSON, ...edgeToJSON]; - const configJson = { - version: 'v2', - description: 'web console import', - clientSettings: { - retry: 3, - concurrency: 10, - channelBufferSize: 128, - space, - connection: { - user: username, - password, - address: host, - }, - }, - logPath: `${taskDir}/import.log`, - files, - }; - return configJson; -} - -export function edgeDataToJSON( - config: any, - taskDir: string, - spaceVidType: string, - batchSize?: string, -) { - const files = config.map(edge => { - const edgePorps: any[] = []; - _.sortBy(edge.props, t => t.mapping).forEach(prop => { - switch (prop.name) { - case 'rank': - if (prop.mapping !== null) { - edge.rank = { - index: prop.mapping, - }; - } - break; - case 'srcId': - edge.srcVID = { - index: indexJudge(prop.mapping, prop.name), - type: spaceVidType === 'INT64' ? 'int' : 'string', - }; - break; - case 'dstId': - edge.dstVID = { - index: indexJudge(prop.mapping, prop.name), - type: spaceVidType === 'INT64' ? 'int' : 'string', - }; - break; - default: - if (prop.mapping === null && prop.isDefault) { - break; - } - const _prop = { - name: prop.name, - type: prop.type, - index: indexJudge(prop.mapping, prop.name), - }; - edgePorps.push(_prop); - } - }); - const fileName = edge.file.name.replace('.csv', ''); - const edgeConfig = { - path: edge.file.path, - failDataPath: `${taskDir}/err/${fileName}Fail.csv`, - batchSize: Number(batchSize) || 60, - type: 'csv', - csv: { - withHeader: false, - withLabel: false, - }, - schema: { - type: 'edge', - edge: { - name: edge.type, - srcVID: edge.srcVID, - dstVID: edge.dstVID, - rank: edge.rank, - withRanking: edge.rank?.index !== undefined, - props: edgePorps, - }, - }, - }; - return edgeConfig; - }); - return files; -} - -export function vertexDataToJSON( - config: any, - taskDir: string, - spaceVidType: string, - batchSize?: string -) { - const files = config.map(vertex => { - const tags = vertex.tags.map(tag => { - const props = tag.props - .sort((p1, p2) => p1.mapping - p2.mapping) - .map(prop => { - if (prop.mapping === null && prop.isDefault) { - return null; - } - return { - name: prop.name, - type: prop.type, - index: indexJudge(prop.mapping, prop.name), - }; - }); - const _tag = { - name: tag.name, - props: props.filter(prop => prop), - }; - return _tag; - }); - const fileName = vertex.file.name.replace('.csv', ''); - const vertexConfig: any = { - path: vertex.file.path, - failDataPath: `${taskDir}/err/${fileName}Fail.csv`, - batchSize: Number(batchSize) || 60, - type: 'csv', - csv: { - withHeader: false, - withLabel: false, - }, - schema: { - type: 'vertex', - vertex: { - vid: { - index: indexJudge(vertex.idMapping, 'vertexId'), - type: spaceVidType === 'INT64' ? 'int' : 'string', - }, - tags, - }, - }, - }; - return vertexConfig; - }); - return files; -} - -export function indexJudge(index: number | null, name: string) { - if (index === null) { - message.error(`${name} ${intl.get('import.indexNotEmpty')}`); - throw new Error(); - } - return index; -} - -export function getStringByteLength(str: string) { - let bytesCount = 0; - const len = str.length; - for (let i = 0, n = len; i < n; i++) { - const c = str.charCodeAt(i); - if ((c >= 0x0001 && c <= 0x007e) || (c >= 0xff60 && c <= 0xff9f)) { - bytesCount += 1; - } else { - bytesCount += 2; - } - } - return bytesCount; -} - -export function createTaskID(instanceId: string) { - return `${instanceId}.${new Date().getTime()}`; -} - -export function getGQLByConfig(payload) { - const { verticesConfig, edgesConfig, spaceVidType } = payload; - const NGQL: string[] = []; - verticesConfig.forEach(vertexConfig => { - if (vertexConfig.idMapping === null) { - message.error(`vertexId ${intl.get('import.indexNotEmpty')}`); - throw new Error(); - } - const csvTable = vertexConfig.file.content; - vertexConfig.tags.forEach(tag => { - csvTable.forEach(columns => { - const tagField: string[] = []; - const values: any[] = []; - if (!tag.name) { - message.error(`Tag ${intl.get('import.notEmpty')}`); - throw new Error(); - } - tag.props.forEach(prop => { - if (prop.mapping === null && !prop.isDefault) { - message.error(`${prop.name} ${intl.get('import.indexNotEmpty')}`); - throw new Error(); - } - if (prop.mapping !== null) { - // HACK: Processing keyword - tagField.push(`\`${prop.name}\``); - const value = - prop.type === 'string' - ? `"${columns[prop.mapping]}"` - : columns[prop.mapping]; - values.push(value); - } - }); - NGQL.push( - `${'INSERT VERTEX ' + '`'}${tag.name}\`` + - `(${tagField}) VALUES ${handleVidStringName( - columns[vertexConfig.idMapping], - spaceVidType, - )}:(${values})`, - ); - }); - }); - }); - edgesConfig.forEach(edgeConfig => { - const csvTable = edgeConfig.file.content; - csvTable.forEach(columns => { - const edgeField: string[] = []; - const values: any[] = []; - if (!edgeConfig.type) { - message.error(`edgeType ${intl.get('import.notEmpty')}`); - throw new Error(); - } - edgeConfig.props.forEach(prop => { - if (prop.mapping === null && prop.name !== 'rank' && !prop.isDefault) { - message.error(`${prop.name} ${intl.get('import.indexNotEmpty')}`); - throw new Error(); - } - if ( - prop.name !== 'srcId' && - prop.name !== 'dstId' && - prop.name !== 'rank' && - prop.mapping !== null - ) { - // HACK: Processing keyword - edgeField.push(`\`${prop.name}\``); - const value = - prop.type === 'string' - ? `"${columns[prop.mapping]}"` - : columns[prop.mapping]; - values.push(value); - } - }); - const rank = - edgeConfig.props[2].mapping === null - ? '' - : `@${columns[edgeConfig.props[2].mapping]}`; - NGQL.push( - `${'INSERT EDGE ' + '`'}${edgeConfig.type}\`` + - `(${edgeField.join(',')}) VALUES ${handleVidStringName( - columns[edgeConfig.props[0].mapping], - spaceVidType, - )} -> ${handleVidStringName( - columns[edgeConfig.props[1].mapping], - spaceVidType, - )} ${rank}:(${values})`, - ); - }); - }); - return NGQL; -} diff --git a/app-v2/utils/index.ts b/app-v2/utils/index.ts deleted file mode 100644 index 6162b763..00000000 --- a/app-v2/utils/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * this folder for utils - */ -export * from './url'; diff --git a/app-v2/utils/interface.ts b/app-v2/utils/interface.ts deleted file mode 100644 index 1f1607e9..00000000 --- a/app-v2/utils/interface.ts +++ /dev/null @@ -1,17 +0,0 @@ -import * as d3 from 'd3'; -export interface INode extends d3.SimulationNodeDatum { - name: string; - group: number; - uuid: string; - color: string; - icon: string; -} - -export interface IPath extends d3.SimulationLinkDatum { - id: string; - source: INode; - target: INode; - size: number; - type: string; - uuid: string; -} diff --git a/app-v2/utils/parseData.ts b/app-v2/utils/parseData.ts deleted file mode 100644 index 6f2a43db..00000000 --- a/app-v2/utils/parseData.ts +++ /dev/null @@ -1,196 +0,0 @@ -import _ from 'lodash'; - -import { handleVidStringName } from '#app/utils/function'; - -export function setLinkNumbers(group, type) { - const len = group.length; - if (len === 0) { - return; - } - const linksA: any = []; - const linksB: any = []; - for (let i = 0; i < len; i++) { - const link = group[i]; - if (link.source.name) { - if (link.source.name < link.target.name) { - linksA.push(link); - } else { - linksB.push(link); - } - } else { - if (link.source < link.target) { - linksA.push(link); - } else { - linksB.push(link); - } - } - } - let maxLinkNumber = 0; - if (type === 'self') { - maxLinkNumber = len; - } else { - maxLinkNumber = len % 2 === 0 ? len / 2 : (len + 1) / 2; - } - const linksALen = linksA.length; - const linksBLen = linksB.length; - if (linksALen === linksBLen) { - let startLinkNumber = 1; - for (let i = 0; i < linksALen; i++) { - linksA[i].linknum = startLinkNumber++; - } - startLinkNumber = 1; - for (let i = 0; i < linksBLen; i++) { - linksB[i].linknum = startLinkNumber++; - } - } else { - let biggerLinks: any[] = []; - let smallerLinks: any[] = []; - if (linksA.length > linksB.length) { - biggerLinks = linksA; - smallerLinks = linksB; - } else { - biggerLinks = linksB; - smallerLinks = linksA; - } - let startLinkNumber = maxLinkNumber; - const smallerLinksLen = smallerLinks.length; - for (let i = 0; i < smallerLinksLen; i++) { - smallerLinks[i].linknum = startLinkNumber--; - } - const tmpNumber = startLinkNumber; - startLinkNumber = 1; - let p = 0; - while (startLinkNumber <= maxLinkNumber) { - biggerLinks[p++].linknum = startLinkNumber++; - } - startLinkNumber = 0 - tmpNumber; - for (let i = p; i < biggerLinks.length; i++) { - biggerLinks[i].linknum = startLinkNumber++; - } - } -} - -export function setLinkName(link) { - if (link.source.name) { - return link.source.name < link.target.name - ? link.source.name + ':' + link.target.name - : link.target.name + ':' + link.source.name; - } else { - return link.source < link.target - ? link.source + ':' + link.target - : link.target + ':' + link.source; - } -} - -export function setLink(edges) { - const linkGroup = {}; - // statistical linkMap linkGroup - edges.forEach((link: any) => { - const key = setLinkName(link); - if (!linkGroup.hasOwnProperty(key)) { - linkGroup[key] = []; - } - linkGroup[key].push(link); - }); - // assign linknum to each link - edges.forEach((link: any) => { - const key = setLinkName(link); - link.size = linkGroup[key].length; - const group = linkGroup[key]; - const keyPair = key.split(':'); - let type = 'noself'; - if (keyPair[0] === keyPair[1]) { - type = 'self'; - } - if (group[group.length - 1] === link) { - setLinkNumbers(group, type); - } - }); -} - -export function parsePathToGraph(data, spaceVidType) { - const vertexes: any = []; - const edges: any = []; - const relationships = data - .map(i => i._pathsParsedList) - .flat() - .map(i => i.relationships) - .flat(); - relationships.forEach(relationship => { - const { - srcID: srcId, - dstID: dstId, - edgeName: edgeType, - rank, - } = relationship; - vertexes.push(srcId); - vertexes.push(dstId); - edges.push({ - srcId, - dstId, - edgeType, - rank, - id: `${edgeType} ${handleVidStringName( - srcId, - spaceVidType, - )}->${handleVidStringName(dstId, spaceVidType)}@${rank}}`, - }); - }); - return { vertexes, edges }; -} - -export function parseSubGraph(data, spaceVidType) { - const vertexes: any = []; - const edges: any = []; - data.forEach(row => { - const { _verticesParsedList, _edgesParsedList, _pathsParsedList } = row; - if (_verticesParsedList) { - _verticesParsedList.forEach(vertex => { - vertexes.push(vertex.vid); - }); - } - if (_edgesParsedList) { - _edgesParsedList.forEach(edge => { - const { dstID: dstId, srcID: srcId, rank, edgeName: edgeType } = edge; - edges.push({ - srcId, - dstId, - edgeType, - rank, - id: `${edgeType} ${handleVidStringName( - srcId, - spaceVidType, - )}->${handleVidStringName(dstId, spaceVidType)}@${rank}}`, - }); - vertexes.push(srcId); - vertexes.push(dstId); - }); - } - if (_pathsParsedList) { - _pathsParsedList.forEach(path => { - const relationships = path.relationships; - relationships.forEach(relationship => { - const { - srcID: srcId, - dstID: dstId, - edgeName: edgeType, - rank, - } = relationship; - vertexes.push(srcId); - vertexes.push(dstId); - edges.push({ - srcId, - dstId, - edgeType, - rank, - id: `${edgeType} ${handleVidStringName( - srcId, - spaceVidType, - )}->${handleVidStringName(dstId, spaceVidType)}@${rank}}`, - }); - }); - }); - } - }); - return { vertexes, edges }; -} diff --git a/app-v2/utils/stat.ts b/app-v2/utils/stat.ts deleted file mode 100644 index 38215b88..00000000 --- a/app-v2/utils/stat.ts +++ /dev/null @@ -1,79 +0,0 @@ -const win = window as any; -export const trackPageView = (url: string) => { - if (win._hmt) { - try { - win._hmt.push(['_trackPageview', url]); - } catch (e) { - console.log(e); - } - } - - if (win.gtag) { - try { - win.gtag('event', 'screen_view', { - screen_name: url, - app_name: 'nebula-graph-stutio', - }); - } catch (e) { - console.log(e); - } - } -}; - -interface IGtag { - event_category: string; - event_label?: string; - value?: number; -} - -export const trackEvent = ( - category: string, - action: string, - label?: string, - value?: number, -) => { - // google analytics - if (win.gtag) { - try { - const params: IGtag = { - event_category: category, - }; - if (label) { - params.event_label = label; - } - if (value) { - params.value = value; - } - win.gtag('event', action, params); - } catch (e) { - console.log(e); - } - } -}; - -export const handleTrackEvent = event => { - let target; - if (event.target && event.target.dataset.trackCategory) { - target = event.target; - } else { - const _parentNode = event.target.parentNode; - if (_parentNode && _parentNode.dataset.trackCategory) { - target = _parentNode; - } else if ( - _parentNode.tagName.toLowerCase() === 'svg' && - _parentNode.parentNode.tagName.toLowerCase() === 'i' && - _parentNode.parentNode.dataset.trackCategory - ) { - target = _parentNode.parentNode; - } - } - if (target) { - const { - trackCategory, - trackAction, - trackLabel, - trackValue, - } = target.dataset; - trackEvent(trackCategory, trackAction, trackLabel, trackValue); - } -}; diff --git a/app-v2/utils/url.ts b/app-v2/utils/url.ts deleted file mode 100644 index b4d3f175..00000000 --- a/app-v2/utils/url.ts +++ /dev/null @@ -1,9 +0,0 @@ -export function updateQueryStringParameter(uri, key, value) { - const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i'); - const separator = uri.indexOf('?') !== -1 ? '&' : '?'; - if (uri.match(re)) { - return uri.replace(re, '$1' + key + '=' + value + '$2'); - } else { - return uri + separator + key + '=' + value; - } -} diff --git a/app/App.less b/app/App.less index 71fe90c6..7511fd52 100644 --- a/app/App.less +++ b/app/App.less @@ -1,185 +1,166 @@ -@import '~#app/common.less'; +@import './common.less'; -html body { - height: 100%; - padding: 0; - margin: 0; +@font-face { + font-family: 'Roboto-Black'; + src: url(~@app/static/fonts/Roboto-Black.ttf); } -p { - margin: 0; - padding: 0; +@font-face { + font-family: 'Roboto-Bold'; + src: url(~@app/static/fonts/Roboto-Bold.ttf); } -.menu-icon { - width: 16px; - height: 16px; - vertical-align: -0.15em; - overflow: hidden; - fill: #fff; - margin-right: 10px; +@font-face { + font-family: 'Roboto-Light'; + src: url(~@app/static/fonts/Roboto-Light.ttf); } -.ant-dropdown-menu-item i { - margin-right: 4px; +@font-face { + font-family: 'Roboto-Medium'; + src: url(~@app/static/fonts/Roboto-Medium.ttf); } -.ant-modal-close-x { - width: 40px; - height: 40px; - line-height: 40px; +@font-face { + font-family: 'Roboto-Regular'; + src: url(~@app/static/fonts/Roboto-Regular.ttf); } -.btns { - text-align: center; - margin-bottom: 20px; +#app { + font-family: Roboto-Regular, sans-serif; +} - button > a > i { - margin-right: 8px; - } +.center-layout { + width: @containerWidth; + margin: 0 auto; } -#app { - height: 100%; - min-width: 1440px; +.studio-tab-header { + display: flex; + justify-content: center; + padding-bottom: 16px; + border-bottom: 1px solid @gray; +} - > .ant-spin-nested-loading { - height: 100%; +.ant-radio-group.nebula-tab-group { + background: @lightGray; + border-radius: 20px; + padding: 4px; + min-width: 400px; + display: flex; + justify-content: center; + + .ant-radio-button-wrapper { + border-radius: 20px; + flex: 1; + text-align: center; + border: none; + white-space: nowrap; + color: #465b7a; - > .ant-spin-container { - height: 100%; + &:not(.ant-radio-button-wrapper-checked) { + background: none; } - } - > .ant-layout { - height: 100%; + &::before { + width: 0; + } } } -.nebula-graph-studio { - background: #d2d5da; +.ant-btn.warning-btn { + color: @red; + border-color: @red; - .github-star { - height: @navHeight; - display: flex; - align-items: center; - margin-right: 8px; - - > span { - height: 48px; - } + svg { + width: 20px; + height: 20px; } - .setting, - .version { - width: 100px; - text-align: center; - color: #fff; + &:hover { + color: @red; + border-color: @red; } +} - .lang-select { - > span { - display: inline-block; - padding-right: 16px; - text-align: right; - width: 100px; - color: #fff; - } +.ant-btn.primary-btn { + color: @blue; + border-color: @blue; - > .ant-select { - width: 80px; - } + svg { + width: 20px; + height: 20px; } - .help { - width: 80px; - text-align: center; - color: #fff; + &:hover { + color: @blue; + border-color: @blue; + } +} - i { - margin-right: 10px; - } +.ant-btn.cancel-btn { + color: @darkGray; + border-color: @darkGray; + + svg { + width: 20px; + height: 20px; + } + + &:hover { + color: @darkGray; + border-color: @darkGray; } +} - .ant-layout-header { +.ant-btn.studio-add-btn { + border-radius: 3px; + display: inline-flex; + align-items: center; + padding: 0 29px; + + a { display: flex; - z-index: 9; - padding-left: 18px; - height: @navHeight; + align-items: center; + } + + .studio-add-btn-icon { + display: inline-flex; + margin-right: 10px; + height: 22px; - .studio-logo img { - width: 126px; - height: 41px; + > svg { + width: 22px; + height: 22px; } - > ul { - flex: 1; - height: 100%; - line-height: 64px; - font-size: 20px; - background: #00152a; - border: none; - padding-left: 15px; - - a, - span, - i { - color: #fff; - font-size: 16px; - } - - a:hover, - i:hover { - color: #efefef; - } - - .ant-menu-item { - top: 0; - border-bottom: none; - - .nebula-studio-icon { - margin-right: 10px; - } - - &:hover { - color: #00152a; - border-bottom: 000; - } - - &.ant-menu-item-selected { - background: #fff; - - a, - span, - i { - color: #00152a; - } - - .icon { - fill: #00152a; - } - } - } + & ~ span { + margin-left: 0; } } +} - .ant-layout-content { - height: 100%; - overflow: auto; - - .padding-page { - padding: 12px 4% 24px 4%; +.studio-form-footer { + position: fixed; + left: 0; + bottom: 0; + z-index: 10; + width: 100%; + height: 98px; + display: flex; + align-items: center; + justify-content: center; + background: #fff; + box-shadow: 0 -4px 4px rgba(0, 0, 0, 0.1); + + button { + width: 236px; + + &:not(:last-child) { + margin-right: 50px; } } } -.header-title { - font-family: PingFangSC-Medium, serif; - font-size: 20px; - line-height: 18px; - color: #333; - letter-spacing: 1.85px; - border-left: 4px solid #1d9bf6; - padding-left: 12px; +.ant-form-item-label label { + font-family: Roboto-Bold, sans-serif; } - diff --git a/app/App.tsx b/app/App.tsx deleted file mode 100644 index 93d38fa1..00000000 --- a/app/App.tsx +++ /dev/null @@ -1,380 +0,0 @@ -import { Dropdown, Layout, Menu, Select, Spin } from 'antd'; -import cookies from 'js-cookie'; -import React from 'react'; -import { hot } from 'react-hot-loader/root'; -import intl from 'react-intl-universal'; -import { connect } from 'react-redux'; -import { - Link, - Redirect, - Route, - RouteComponentProps, - Switch, - withRouter, -} from 'react-router-dom'; - -import { BranchesOutlined, CodeOutlined, CompassOutlined, DownOutlined, ImportOutlined, LogoutOutlined, QuestionCircleOutlined, StarOutlined, TagsOutlined } from '@ant-design/icons'; -import ConfigServer from './modules/ConfigServer'; -import PrivateRoute from './PrivateRoute'; -import IconFont from '#app/components/Icon'; -import { INTL_LOCALES, INTL_LOCALE_SELECT } from '#app/config'; -import service from '#app/config/service'; -import { LanguageContext } from '#app/context'; -import Console from '#app/modules/Console'; -import Explore from '#app/modules/Explore'; -import Import from '#app/modules/Import'; -import Schema from '#app/modules/Schema'; -import CreateSpace from '#app/modules/Schema/CreateSpace'; -import SpaceConfig from '#app/modules/Schema/SpaceConfig'; -import '#app/static/fonts/iconfont.css'; -import logo from '#app/static/images/studio-logo.png'; -import { IDispatch, IRootState } from '#app/store'; -import { updateQueryStringParameter } from '#app/utils'; - -import './App.less'; -import { handleTrackEvent, trackEvent, trackPageView } from './utils/stat'; - -const { Header, Content } = Layout; -const { Option } = Select; - -interface IState { - loading: boolean; - activeMenu: string; -} - -const mapDispatch = (dispatch: IDispatch) => ({ - asyncClearConfigServer: dispatch.nebula.asyncClearConfigServer, - asyncSwitchSpace: dispatch.nebula.asyncSwitchSpace, -}); - -const mapState = (state: IRootState) => ({ - appVersion: state.app.version, -}); - -interface IProps - extends RouteComponentProps, - ReturnType, - ReturnType {} - -class App extends React.Component { - currentLocale; - constructor(props: IProps) { - super(props); - - const regx = /lang=(\w+)/g; - const match = regx.exec(props.history.location.search); - - if (match) { - cookies.set('locale', match[1].toUpperCase()); - } else { - cookies.set('locale', 'ZH_CN'); - } - - this.currentLocale = cookies.get('locale'); - this.state = { - loading: true, - activeMenu: '', - }; - } - - toggleLanguage = (locale: string) => { - cookies.set('locale', locale); - trackEvent('navigation', 'change_language', locale); - window.location.href = updateQueryStringParameter( - window.location.href, - 'lang', - locale, - ); - }; - - loadIntlLocale = () => { - intl - .init({ - currentLocale: this.currentLocale, - locales: INTL_LOCALES, - }) - .then(() => { - this.setState({ - loading: false, - }); - }); - }; - - handleMenuClick = ({ key }) => { - if (key === 'newRelease') { - return; - } - this.setState({ - activeMenu: key, - }); - }; - - UNSAFE_componentWillMount() { - // Initialize the import task - service.handleImportAction({ taskAction: 'actionStopAll' }); - } - - componentDidMount() { - this.loadIntlLocale(); - this.renderMenu(); - const space = sessionStorage.getItem('currentSpace'); - if (space) { - this.props.asyncSwitchSpace(space); - } - document.addEventListener('click', handleTrackEvent); - } - - componentDidUpdate(prevProps: IProps) { - if (prevProps.location.pathname !== this.props.location.pathname) { - this.renderMenu(); - } - } - - componentWillUnmount() { - document.removeEventListener('click', handleTrackEvent); - } - renderMenu = () => { - const path = this.props.location.pathname.split('/')[1] || ''; - this.setState({ - activeMenu: path === 'space' ? 'schema' : path, - }); - }; - - handleClear = () => { - this.props.asyncClearConfigServer(); - }; - - render() { - const { appVersion } = this.props; - const { loading, activeMenu } = this.state; - const locale = cookies.get('locale'); - const nGQLHref = - locale === 'ZH_CN' - ? 'https://docs.nebula-graph.com.cn/2.5.0/3.ngql-guide/1.nGQL-overview/1.overview/' - : 'https://docs.nebula-graph.io/2.5.0/3.ngql-guide/1.nGQL-overview/1.overview/'; - const mannualHref = - locale === 'ZH_CN' - ? 'https://docs.nebula-graph.com.cn/2.5.0/nebula-studio/about-studio/st-ug-what-is-graph-studio/' - : 'https://docs.nebula-graph.io/2.5.0/nebula-studio/about-studio/st-ug-what-is-graph-studio/'; - const versionLogHref = - locale === 'ZH_CN' - ? 'https://docs.nebula-graph.com.cn/2.5.0/nebula-studio/about-studio/st-ug-release-note/' - : 'https://docs.nebula-graph.io/2.5.0/nebula-studio/about-studio/st-ug-release-note/'; - return ( - <> - - {loading ? ( - - ) : ( - -
-
- -
- - - - - {intl.get('common.schema')} - - - - - - {intl.get('common.import')} - - - - - - {intl.get('common.explore')} - - - - - - {intl.get('common.console')} - - - -
- {intl.get('common.languageSelect')}: - -
- - - - - {intl.get('configServer.clear')} - - - - } - > - - {intl.get('common.setting')} - - - - trackPageView('/user-mannual')}> - - - {intl.get('common.use')} - - - trackPageView('/nebula-doc')}> - - - nGQL - - - - - - {intl.get('common.forum')} - - - - } - > - - {intl.get('common.help')} - - - - {appVersion && ( - - - - - {intl.get('common.release')} - - - - } - > - - v{appVersion} - - - - )} -
- - - - - - - - - - - - -
- )} -
- - ); - } -} - -export default withRouter(connect(mapState, mapDispatch)(hot(App))); diff --git a/app-v2/AuthorizedRoute.tsx b/app/AuthorizedRoute.tsx similarity index 93% rename from app-v2/AuthorizedRoute.tsx rename to app/AuthorizedRoute.tsx index 54661d73..39eba8d4 100644 --- a/app-v2/AuthorizedRoute.tsx +++ b/app/AuthorizedRoute.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Redirect, Route } from 'react-router-dom'; import { observer } from 'mobx-react-lite'; -import { useStore } from '@appv2/stores'; +import { useStore } from '@app/stores'; interface IProps { component?: any; render?: any diff --git a/app/PrivateRoute.tsx b/app/PrivateRoute.tsx deleted file mode 100644 index 04917da0..00000000 --- a/app/PrivateRoute.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import { Redirect, Route } from 'react-router-dom'; -import { RouteProps } from 'react-router'; -import { IRootState } from './store'; - -const mapState = (state: IRootState) => ({ - host: state.nebula.host, - username: state.nebula.username, -}); - -const mapDispatch = () => ({}); - -interface IProps extends RouteProps, ReturnType, - ReturnType{ - component?: any; - render?: any -} - -const PrivateRoute = (props: IProps) => { - const { component: Component, render, ...rest } = props; - if (rest.host && rest.username) { - return Component ? ( - } /> - ) : ( - - ); - } else { - return ; - } -}; - -export default connect(mapState, mapDispatch)(PrivateRoute); diff --git a/app/common.less b/app/common.less index d01831c2..2fd5a506 100644 --- a/app/common.less +++ b/app/common.less @@ -1,2 +1,8 @@ -@navHeight: 64px; -@controlHeight: 65px; +@gray: #D5DDEB; +@lightWhite: #F8F8F8; +@containerWidth: 1180px; +@darkGray: #8697B0; +@red: #EB5757; +@blue: #2F80ED; +@lightGray: #E9EDEF; +@lightBlue: #F3F6F9; diff --git a/app-v2/components/Avatar/index.tsx b/app/components/Avatar/index.tsx similarity index 100% rename from app-v2/components/Avatar/index.tsx rename to app/components/Avatar/index.tsx diff --git a/app-v2/components/Breadcrumb/index.less b/app/components/Breadcrumb/index.less similarity index 100% rename from app-v2/components/Breadcrumb/index.less rename to app/components/Breadcrumb/index.less diff --git a/app-v2/components/Breadcrumb/index.tsx b/app/components/Breadcrumb/index.tsx similarity index 96% rename from app-v2/components/Breadcrumb/index.tsx rename to app/components/Breadcrumb/index.tsx index a7eca207..e82f19ab 100644 --- a/app-v2/components/Breadcrumb/index.tsx +++ b/app/components/Breadcrumb/index.tsx @@ -1,7 +1,7 @@ import { Breadcrumb, PageHeader } from 'antd'; import React from 'react'; import { Link } from 'react-router-dom'; -import Icon from '@appv2/components/Icon'; +import Icon from '@app/components/Icon'; import './index.less'; diff --git a/app/components/Button/index.less b/app/components/Button/index.less deleted file mode 100644 index dfa40507..00000000 --- a/app/components/Button/index.less +++ /dev/null @@ -1,27 +0,0 @@ -.panel-btn-item, -.menu-color { - display: inline-flex; - cursor: pointer; -} - -.panel-menu-icon { - svg { - width: 30px; - height: 30px; - } - - margin-right: 10px; -} - -.panel-disabled { - cursor: not-allowed; - color: #d9d9d9; - - svg { - fill: #d9d9d9; - } -} - -.panel-actived { - color: #0091ff; -} diff --git a/app/components/Button/index.tsx b/app/components/Button/index.tsx deleted file mode 100644 index 8ddb6aa9..00000000 --- a/app/components/Button/index.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import { Tooltip } from 'antd'; -import classnames from 'classnames'; -import React from 'react'; - -import IconFont from '#app/components/Icon'; - -import './index.less'; -interface IBtnProps { - disabled?: boolean; - action?: () => void; - iconfont?: string; - title?: string; - className?: string; - active?: boolean; - component?: any; - trackCategory?: string; - trackAction?: string; - trackLabel?: string; -} - -interface IMenuButton extends IBtnProps { - tips?: string; -} -const CustomizeButton = (props: IBtnProps) => { - const { - iconfont, - action, - disabled, - title, - active, - component, - className, - trackCategory, - trackAction, - trackLabel, - } = props; - return ( -
- {iconfont && ( - - )} - {component} - {title && {title}} -
- ); -}; - -// antd Tooltip can't wrap custom component -const CustomizeTooltipBtn = (props: IMenuButton) => { - const { - iconfont, - action, - disabled, - active, - tips, - component, - trackAction, - trackCategory, - trackLabel, - } = props; - return ( - - {iconfont ? ( - - ) : ( -
- {component} -
- )} -
- ); -}; - -class MenuButton extends React.PureComponent { - render() { - const { tips, ...rest } = this.props; - if (tips) { - return ; - } else { - return ; - } - } -} -export default MenuButton; diff --git a/app/components/CSVPreviewLink.less b/app/components/CSVPreviewLink.less deleted file mode 100644 index 9db52e4f..00000000 --- a/app/components/CSVPreviewLink.less +++ /dev/null @@ -1,25 +0,0 @@ -.csv-preview { - padding: 16px 8px; - overflow: auto; - - table { - td, - th { - text-align: center; - } - } - - > .operation { - padding: 16px; - text-align: center; - } - - .csv-select-index { - margin-right: 10px; - } - - .anticon { - font-size: 16px; - } -} - diff --git a/app/components/CSVPreviewLink.tsx b/app/components/CSVPreviewLink.tsx deleted file mode 100644 index 2819fe48..00000000 --- a/app/components/CSVPreviewLink.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import { Button, Table, Tooltip } from 'antd'; -import React from 'react'; -import intl from 'react-intl-universal'; - -import { Modal } from '.'; -import './CSVPreviewLink.less'; -import { InfoCircleOutlined } from '@ant-design/icons'; - -interface IProps { - file: any; - children: string; - onMapping?: (index) => void; - prop?: string; -} - -class CSVPreviewLink extends React.PureComponent { - modalHandler; - handleLinkClick = () => { - if (this.modalHandler) { - this.modalHandler.show(); - } - }; - - handleMapping = index => { - if (this.props.onMapping) { - this.props.onMapping(index); - this.modalHandler.hide(); - } - }; - render() { - const { onMapping, prop } = this.props; - const { content } = this.props.file; - const columns = content.length - ? content[0].map((_, index) => { - const textIndex = index; - return { - title: onMapping ? ( - <> - - - - - - ) : ( - `column ${textIndex}` - ), - dataIndex: index, - }; - }) - : []; - - return ( - <> - - { - this.modalHandler = handler; - }} - footer={false} - width={1000} - > -
- index!.toString()} - /> -
- {onMapping && ( - - )} -
- - - - ); - } -} - -export default CSVPreviewLink; diff --git a/app-v2/components/CSVPreviewLink/index.less b/app/components/CSVPreviewLink/index.less similarity index 94% rename from app-v2/components/CSVPreviewLink/index.less rename to app/components/CSVPreviewLink/index.less index f71d9a30..5d9e0fe4 100644 --- a/app-v2/components/CSVPreviewLink/index.less +++ b/app/components/CSVPreviewLink/index.less @@ -1,4 +1,4 @@ -@import '~@appv2/common.less'; +@import '~@app/common.less'; .popover-preview { max-width: 80%; } diff --git a/app-v2/components/CSVPreviewLink/index.tsx b/app/components/CSVPreviewLink/index.tsx similarity index 100% rename from app-v2/components/CSVPreviewLink/index.tsx rename to app/components/CSVPreviewLink/index.tsx diff --git a/app/components/CodeMirror.tsx b/app/components/CodeMirror.tsx deleted file mode 100644 index d974b16f..00000000 --- a/app/components/CodeMirror.tsx +++ /dev/null @@ -1,193 +0,0 @@ -import CodeMirror from 'codemirror'; -import 'codemirror/addon/comment/comment'; -import 'codemirror/addon/display/autorefresh'; -import 'codemirror/addon/edit/matchbrackets'; -import 'codemirror/addon/hint/show-hint'; -import 'codemirror/addon/hint/show-hint.css'; -import 'codemirror/keymap/sublime'; -import 'codemirror/lib/codemirror.css'; -import 'codemirror/mode/meta'; -import 'codemirror/theme/monokai.css'; -import React from 'react'; - -import { ban, keyWords, maxLineNum, operators } from '@appv2/config/nebulaQL'; - -import './Codemirror.less'; - -interface IProps { - options?: object; - value: string; - ref?: any; - width?: string; - height?: string; - onShiftEnter?: () => void; - onChange?: (value: string) => void; - onBlur?: (value: string) => void; - onChangeLine?: () => void; -} - -export default class ReactCodeMirror extends React.PureComponent { - codemirror; - editor; - textarea; - constructor(props) { - super(props); - } - public componentDidMount() { - CodeMirror.defineMode('nebula', () => { - return { - token: stream => { - if (stream.eatSpace()) { - return null; - } - stream.eatWhile(/[\$:\w\u4e00-\u9fa5]/); - const cur = stream.current(); - if (keyWords.some(item => item === cur)) { - return 'keyword'; - } else if (operators.some(item => item === cur)) { - return 'def'; - } else if (ban.some(item => item === cur)) { - return 'error'; - } - stream.next(); - }, - // blockCommentStart: '/*', - // blockCommentEnd: '*/', - // lineComment: '//' ? '#' : '--', - // closeBrackets: '()[]{}\'\'""``', - }; - }); - - CodeMirror.registerHelper('hint', 'nebula', cm => { - const cur = cm.getCursor(); - const token = cm.getTokenAt(cur); - const str = token.string; - const start = token.start; - const end = cur.ch; - - if (str === '') { - return; - } - - const list = [...keyWords, ...operators, ...ban].filter(item => item.startsWith(str)); - - if (list.length) { - return { - list, - from: CodeMirror.Pos(cur.line, start), - to: CodeMirror.Pos(cur.line, end), - }; - } - }); - this.renderCodeMirror(); - } - renderCodeMirror() { - // parameters of the combined - const options = { - tabSize: 2, - fontSize: '14px', - autoCloseBrackets: true, - matchBrackets: true, - showCursorWhenSelecting: true, - lineWrapping: true, - // show number of rows - lineNumbers: true, - fullScreen: true, - mode: 'nebula', - ...this.props.options, - }; - this.editor = CodeMirror.fromTextArea(this.textarea, options); - // Getting CodeMirror is used to get some of these constants - this.codemirror = CodeMirror; - // event - this.editor.on('change', this.codemirrorValueChange); - this.editor.on('keydown', this.keydown); - this.editor.on('blur', this.blur); - const { value, width, height } = this.props; - this.editor.setValue(value || ''); - if (width || height) { - // set size - this.editor.setSize(width, height); - } - } - - blur = instance => { - this.props.onBlur?.(instance.doc.getValue()); - }; - - keydown = (_, change) => { - if (change.shiftKey === true && change.keyCode === 13) { - this.props.onShiftEnter?.(); - change.preventDefault(); - } - }; - - codemirrorValueChange = (doc, change) => { - if (change.origin !== 'setValue') { - if (this.props.onChange) { - this.props.onChange(doc.getValue()); - } - } - if (change.origin === '+input') { - CodeMirror.commands.autocomplete(this.editor, null, { - completeSingle: false, - }); - } - if ( - this.props.onChangeLine && - (change.origin === '+delete' || change.origin === '+input') - ) { - this.props.onChangeLine(); - } - }; - - async UNSAFE_componentWillReceiveProps(nextProps) { - const { options, value } = nextProps; - await this.setOptions(options); - if (value !== this.editor.getValue()) { - this.editor.setValue(value || ''); - let line; - if (this.editor.lineCount() > maxLineNum) { - line = maxLineNum; - } else if (this.editor.lineCount() < 5) { - line = 5; - } else { - line = this.editor.lineCount(); - } - this.editor.setSize(undefined, line * 24 + 10 + 'px'); - } - } - - async setOptions(options) { - if (typeof options === 'object') { - const mode = CodeMirror.findModeByName(options.mode); - if (mode && mode.mode) { - await import(`codemirror/mode/${mode.mode}/${mode.mode}.js`); - } - if (mode) { - options.mode = mode.mime; - } - Object.keys(options).forEach(name => { - if (options[name] && JSON.stringify(options[name])) { - this.editor.setOption(name, options[name]); - } - }); - } - } - - componentWillUnmount() { - if (this.editor) { - this.editor.toTextArea(); - } - } - - render() { - return ( -