sutcalag 3 years ago
parent
commit
9a0e45e6be
100 changed files with 226 additions and 2318 deletions
  1. 2 2
      .github/ISSUE_TEMPLATE/Bug_report.md
  2. 1 1
      .github/ISSUE_TEMPLATE/Feature_request.md
  3. 1 1
      .github/ISSUE_TEMPLATE/config.yml
  4. 4 4
      .github/workflows/dev.yml
  5. 4 7
      .github/workflows/release.yml
  6. 0 7
      .gitignore
  7. 0 47
      CODE_OF_CONDUCT.md
  8. 11 11
      README.md
  9. 3 3
      client/README.md
  10. 3 3
      client/package.json
  11. 33 33
      client/public/electron.js
  12. 23 30
      client/public/index.html
  13. BIN
      client/public/zilliz.icns
  14. BIN
      client/public/zilliz.png
  15. 0 5
      client/src/assets/icons/milvus.svg
  16. 4 0
      client/src/assets/icons/zilliz.svg
  17. 8 8
      client/src/components/__test__/grid/Grid.spec.tsx
  18. 1 1
      client/src/components/cards/EmptyCard.tsx
  19. 1 1
      client/src/components/code/CodeView.tsx
  20. 1 1
      client/src/components/customDialog/CustomDialogTitle.tsx
  21. 1 1
      client/src/components/customDialog/DeleteDialogTemplate.tsx
  22. 18 18
      client/src/components/customInput/CustomInput.tsx
  23. 1 1
      client/src/components/customProgress/CustomLinearProgress.tsx
  24. 5 5
      client/src/components/grid/Grid.tsx
  25. 1 1
      client/src/components/grid/Types.ts
  26. 3 3
      client/src/components/icons/Icons.tsx
  27. 1 1
      client/src/components/icons/Types.ts
  28. 4 4
      client/src/components/insert/Import.tsx
  29. 9 10
      client/src/components/insert/Preview.tsx
  30. 1 1
      client/src/components/layout/Layout.tsx
  31. 6 6
      client/src/components/menu/NavMenu.tsx
  32. 0 2
      client/src/consts/Localstorage.ts
  33. 2 2
      client/src/context/Auth.tsx
  34. 2 2
      client/src/i18n/cn/common.ts
  35. 2 2
      client/src/i18n/en/common.ts
  36. 8 8
      client/src/pages/collections/Collections.tsx
  37. 6 6
      client/src/pages/connect/Connect.tsx
  38. 3 4
      client/src/pages/overview/collectionCard/CollectionCard.tsx
  39. 1 1
      client/src/pages/overview/statisticsCard/StatisticsCard.tsx
  40. 2 2
      client/src/pages/partitions/Partitions.tsx
  41. 2 2
      client/src/pages/query/Query.tsx
  42. 4 4
      client/src/pages/schema/Schema.tsx
  43. 2 2
      client/src/pages/schema/SizingInfo.tsx
  44. 5 5
      client/src/plugins/search/Styles.ts
  45. 16 16
      client/src/plugins/search/VectorSearch.tsx
  46. 10 10
      client/src/styles/theme.ts
  47. 1 1
      client/src/utils/Insert.ts
  48. 7 7
      express/package.json
  49. 3 3
      package.json
  50. 0 25
      server/.eslintrc.js
  51. 0 34
      server/.gitignore
  52. 0 4
      server/.prettierrc
  53. 0 42
      server/README.md
  54. 0 33
      server/generate-csv.ts
  55. 0 7
      server/nest-cli.json
  56. 0 95
      server/package.json
  57. 0 21
      server/src/app.controller.spec.ts
  58. 0 12
      server/src/app.controller.ts
  59. 0 56
      server/src/app.module.ts
  60. 0 8
      server/src/app.service.ts
  61. 0 5
      server/src/cache/config.ts
  62. 0 19
      server/src/collections/collections.controller.spec.ts
  63. 0 138
      server/src/collections/collections.controller.ts
  64. 0 18
      server/src/collections/collections.module.ts
  65. 0 19
      server/src/collections/collections.service.spec.ts
  66. 0 223
      server/src/collections/collections.service.ts
  67. 0 130
      server/src/collections/dto.ts
  68. 0 18
      server/src/crons/crons.controller.spec.ts
  69. 0 13
      server/src/crons/crons.controller.ts
  70. 0 12
      server/src/crons/crons.module.ts
  71. 0 18
      server/src/crons/crons.service.spec.ts
  72. 0 37
      server/src/crons/crons.service.ts
  73. 0 24
      server/src/crons/dto.ts
  74. 0 40
      server/src/events/events.gateway.ts
  75. 0 8
      server/src/events/events.module.ts
  76. 0 71
      server/src/interceptors/index.ts
  77. 0 57
      server/src/main.ts
  78. 0 34
      server/src/milvus/dto.ts
  79. 0 20
      server/src/milvus/milvus.controller.spec.ts
  80. 0 40
      server/src/milvus/milvus.controller.ts
  81. 0 10
      server/src/milvus/milvus.module.ts
  82. 0 13
      server/src/milvus/milvus.service.mock.ts
  83. 0 18
      server/src/milvus/milvus.service.spec.ts
  84. 0 86
      server/src/milvus/milvus.service.ts
  85. 0 71
      server/src/partitions/dto.ts
  86. 0 21
      server/src/partitions/partitions.controller.spec.ts
  87. 0 52
      server/src/partitions/partitions.controller.ts
  88. 0 11
      server/src/partitions/partitions.module.ts
  89. 0 19
      server/src/partitions/partitions.service.spec.ts
  90. 0 78
      server/src/partitions/partitions.service.ts
  91. 0 60
      server/src/pipe/validation.pipe.ts
  92. 0 115
      server/src/schema/dto.ts
  93. 0 21
      server/src/schema/schema.controller.spec.ts
  94. 0 55
      server/src/schema/schema.controller.ts
  95. 0 11
      server/src/schema/schema.module.ts
  96. 0 19
      server/src/schema/schema.service.spec.ts
  97. 0 52
      server/src/schema/schema.service.ts
  98. 0 16
      server/src/utils/Const.ts
  99. 0 10
      server/src/utils/Error.ts
  100. 0 4
      server/src/utils/Helper.ts

+ 2 - 2
.github/ISSUE_TEMPLATE/Bug_report.md

@@ -14,7 +14,7 @@ labels: defect
 2.
 3.
 
-**Milvus-insight version:**
+**Attu version:**
 
 
-**Milvus version:**
+**Attu version:**

+ 1 - 1
.github/ISSUE_TEMPLATE/Feature_request.md

@@ -1,6 +1,6 @@
 ---
 name: Feature request
-about: Milvus-insight can't do all the things, but maybe it can do your things.
+about: Attu can't do all the things, but maybe it can do your things.
 labels: feat
 
 ---

+ 1 - 1
.github/ISSUE_TEMPLATE/config.yml

@@ -1,5 +1,5 @@
 blank_issues_enabled: true
 contact_links:
   - name: Question
-    url: https://github.com/milvus-io/milvus-insight/discussions
+    url: https://github.com/zilliztech/attu/discussions
     about: Please ask and answer questions here.

+ 4 - 4
.github/workflows/dev.yml

@@ -1,4 +1,4 @@
-name: Milvus insight dev release
+name: Attu dev release
 
 on:
   pull_request_target:
@@ -37,10 +37,10 @@ jobs:
           password: ${{ secrets.DOCKER_PWD }}
 
       - name: Docker Build
-        run: docker build -t milvusdb/milvus-insight:dev --build-arg VERSION=dev .
+        run: docker build -t zilliz/attu:dev --build-arg VERSION=dev .
 
       - name: Docker Push Dev
-        run: docker push milvusdb/milvus-insight:dev
+        run: docker push zilliz/attu:dev
 
   k8s:
     runs-on: ubuntu-latest
@@ -76,7 +76,7 @@ jobs:
         run: |
           echo ${{ secrets.kubeconfig }} > config64
           base64 -d config64 > kubeconfig
-          kubectl delete pods -n ued -l app=milvus-insight --kubeconfig=kubeconfig
+          kubectl delete pods -n ued -l app=attu --kubeconfig=kubeconfig
           sleep 60
 
   check:

+ 4 - 7
.github/workflows/release.yml

@@ -1,4 +1,4 @@
-name: Milvus insight prod release
+name: Attu prod release
 
 on:
   release:
@@ -22,13 +22,10 @@ jobs:
           password: ${{ secrets.DOCKER_PWD }}
 
       - name: Docker Build
-        run: docker build -t milvusdb/milvus-insight:${GITHUB_REF#refs/tags/} --build-arg VERSION=${GITHUB_REF#refs/tags/} .
+        run: docker build -t zilliz/attu:${GITHUB_REF#refs/tags/} --build-arg VERSION=${GITHUB_REF#refs/tags/} .
 
       - name: Docker tag
-        run: docker tag milvusdb/milvus-insight:${GITHUB_REF#refs/tags/} milvusdb/milvus-insight:latest
-
-      # - name: Docker Push version
-      #   run: docker push milvusdb/cloud-ui:${GITHUB_REF#refs/tags/}
+        run: docker tag zilliz/attu:${GITHUB_REF#refs/tags/} zilliz/attu:latest
 
       - name: Docker Push lastest
-        run: docker push milvusdb/milvus-insight
+        run: docker push zilliz/attu

+ 0 - 7
.gitignore

@@ -27,13 +27,6 @@ node_modules
 
 .DS_Store
 
-server/node_modules
-server/dist
-server/build
-server/coverage
-server/documentation
-server/vectors.csv
-
 express/node_modules
 express/dist
 express/build

+ 0 - 47
CODE_OF_CONDUCT.md

@@ -1,47 +0,0 @@
-# Milvus Code of Conduct
-
-In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment include:
-
--   Using welcoming and inclusive language.
--   Being respectful of differing viewpoints and experiences.
--   Gracefully accepting constructive criticism.
--   Focusing on what is best for the community.
--   Showing empathy towards other community members.
-
-Examples of unacceptable behavior by participants include:
-
--   The use of sexualized language or imagery and unwelcome sexual attention or advances.
--   Trolling, insulting/derogatory comments, and personal or political attacks.
--   Public or private harassment.
--   Publishing others' private information, such as a physical or electronic address, without explicit permission.
--   Conduct which could reasonably be considered inappropriate for the forum in which it occurs.
-
-All Milvus forums and spaces are meant for professional interactions, and any behavior which could reasonably be considered inappropriate in a professional setting is unacceptable.
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
-
-## Scope
-
-This Code of Conduct applies to all content on milvus.io, Milvus’s GitHub organization, or any other official Milvus web presence allowing for community interactions, as well as at all official Milvus events, whether offline or online.
-
-The Code of Conduct also applies within all project spaces and in public spaces whenever an individual is representing Milvus or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed or de facto representative at an online or offline event. Representation of Milvus may be further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at conduct@lfai.foundation. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
-
-For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq

+ 11 - 11
README.md

@@ -1,16 +1,16 @@
-# attu
+# Attu
 
 [![typescript](https://badges.aleen42.com/src/typescript.svg)](https://badges.aleen42.com/src/typescript.svg)
-[![downloads](https://img.shields.io/docker/pulls/milvusdb/milvus-insight)](https://img.shields.io/docker/pulls/milvusdb/milvus-insight)
-[![codecov](https://codecov.io/gh/zilliztech/milvus-insight/branch/main/graph/badge.svg?token=jvIEVF9IwW)](https://codecov.io/gh/zilliztech/milvus-insight)
+[![downloads](https://img.shields.io/docker/pulls/zilliz/attu)](https://img.shields.io/docker/pulls/zilliz/attu)
+[![codecov](https://codecov.io/gh/zilliztech/attu/branch/main/graph/badge.svg?token=jvIEVF9IwW)](https://codecov.io/gh/zilliztech/attu)
 
-attu provides an intuitive and efficient GUI for Milvus, allowing you to interact with your databases and manage your data with just few clicks.
+Attu provides an intuitive and efficient GUI for Milvus, allowing you to interact with your databases and manage your data with just few clicks.
 
 <img src="./.github/images/screenshot.png" alt="attu" />
 
 ## Features and Roadmap
 
-attu is under rapid development and we are adding new features weekly, here are the current plan, we will release a version once a feature is available.
+Attu is under rapid development and we are adding new features weekly, here are the current plan, we will release a version once a feature is available.
 
 - Manage collections/partitions
 - Manage index
@@ -18,9 +18,9 @@ attu is under rapid development and we are adding new features weekly, here are
 - Load/release collections for search
 - Insert entities
 - Vector search with advanced filter
-- Milvus system view(TBD)
+- System view
 - Data view (TBD)
-- View milvus node configuration(TBD)
+- View root node configuration(TBD)
 - Vector Visualization(TBD)
 - More...
 
@@ -33,10 +33,10 @@ Ensure you have Milvus installed on [your server](https://milvus.io/docs/install
 ### ⭐️ Start a attu instance
 
 ```code
-docker run -p 8000:3000 -e HOST_URL=http://{ milvus insight ip }:8000 -e MILVUS_URL={milvus server ip}:19530 milvusdb/milvus-insight:latest
+docker run -p 8000:3000 -e HOST_URL=http://{ attu ip }:8000 -e MILVUS_URL={milvus server ip}:19530 zilliz/attu:latest
 ```
 
-Once you start the docker, open the browser, type `http://{ milvus insight ip }:8000`, you can view the attu.
+Once you start the docker, open the browser, type `http://{ attu ip }:8000`, you can view the attu.
 
 #### Params
 
@@ -52,12 +52,12 @@ Tip: **127.0.0.1 or localhost will not work when runs on docker**
 **_note_** We plan to release attu once a feature is done. Also, if you want to try the nightly build, please pull the docker image with the `dev` tag.
 
 ```code
-docker run -p 8000:3000 -e HOST_URL=http://{ your machine IP }:8000 -e MILVUS_URL={ your machine IP }:19530 milvusdb/milvus-insight:dev
+docker run -p 8000:3000 -e HOST_URL=http://{ your machine IP }:8000 -e MILVUS_URL={ your machine IP }:19530 zilliz/attu:dev
 ```
 
 ## ✨ Building and Running attu, and/or Contributing Code
 
-You might want to build Milvus-insight locally to contribute some code, test out the latest features, or try
+You might want to build Attu locally to contribute some code, test out the latest features, or try
 out an open PR:
 
 ### Build server

+ 3 - 3
client/README.md

@@ -1,4 +1,4 @@
-# Milvus insight client
+# Attu client
 
 ## How to run
 
@@ -73,7 +73,7 @@ As `react-app-rewire-alias` in `config-overrides.js`, we can use alias import. `
 
 We put all icons in components/icons file. Normally we use material icon.
 
-If we use custom svg, like: import { ReactComponent as MilvusEmIcon } from xxx/xxx.svg'.
+If we use custom svg, like: import { ReactComponent as CustomIcon } from xxx/xxx.svg'.
 
 It's react component because of svgr/webpack in webpack config.
 
@@ -83,4 +83,4 @@ We use react-app-rewired to change webpack config.
 
 If we want to change the webpack config, we can edit config-overrides.js file.
 
-Our build path is `./build`. And we use milvus insight server to host our client site.
+Our build path is `./build`. And we use Attu server to host our client site.

+ 3 - 3
client/package.json

@@ -1,9 +1,9 @@
 {
-  "name": "milvus-insight-client",
+  "name": "attu-client",
   "version": "0.1.0",
-  "description": "Milvus insight UI Client",
+  "description": "Attu UI Client",
   "license": "Apache-2.0",
-  "bugs": "https://github.com/milvus-io/milvus-insight/issues",
+  "bugs": "https://github.com/zilliztech/attu/issues",
   "private": true,
   "dependencies": {
     "@date-io/dayjs": "1.x",

+ 33 - 33
client/public/electron.js

@@ -11,21 +11,21 @@ const template = [
   // { role: 'appMenu' }
   ...(isMac
     ? [
-        {
-          label: app.name,
-          submenu: [
-            { role: "about" },
-            { type: "separator" },
-            { role: "services" },
-            { type: "separator" },
-            { role: "hide" },
-            { role: "hideothers" },
-            { role: "unhide" },
-            { type: "separator" },
-            { role: "quit" }
-          ]
-        }
-      ]
+      {
+        label: app.name,
+        submenu: [
+          { role: "about" },
+          { type: "separator" },
+          { role: "services" },
+          { type: "separator" },
+          { role: "hide" },
+          { role: "hideothers" },
+          { role: "unhide" },
+          { type: "separator" },
+          { role: "quit" }
+        ]
+      }
+    ]
     : []),
   // { role: 'fileMenu' }
   {
@@ -44,15 +44,15 @@ const template = [
       { role: "paste" },
       ...(isMac
         ? [
-            { role: "pasteAndMatchStyle" },
-            { role: "delete" },
-            { role: "selectAll" },
-            { type: "separator" },
-            {
-              label: "Speech",
-              submenu: [{ role: "startspeaking" }, { role: "stopspeaking" }]
-            }
-          ]
+          { role: "pasteAndMatchStyle" },
+          { role: "delete" },
+          { role: "selectAll" },
+          { type: "separator" },
+          {
+            label: "Speech",
+            submenu: [{ role: "startspeaking" }, { role: "stopspeaking" }]
+          }
+        ]
         : [{ role: "delete" }, { type: "separator" }, { role: "selectAll" }])
     ]
   },
@@ -79,11 +79,11 @@ const template = [
       { role: "zoom" },
       ...(isMac
         ? [
-            { type: "separator" },
-            { role: "front" },
-            { type: "separator" },
-            { role: "window" }
-          ]
+          { type: "separator" },
+          { role: "front" },
+          { type: "separator" },
+          { role: "window" }
+        ]
         : [{ role: "close" }])
     ]
   },
@@ -130,7 +130,7 @@ function createWindow() {
     width: 1200,
     height: 800,
     webPreferences: { devTools: false },
-    icon: "./milvus-icon.png"
+    icon: "./zilliz.png"
   });
   // mainWindow.maximize();
   // mainWindow.show();
@@ -149,7 +149,7 @@ function createWindow() {
   //   mainWindow.webContents.openDevTools();
 
   // Emitted when the window is closed.
-  mainWindow.on("closed", function() {
+  mainWindow.on("closed", function () {
     // Dereference the window object, usually you would store windows
     // in an array if your app supports multi windows, this is the time
     // when you should delete the corresponding element.
@@ -163,7 +163,7 @@ function createWindow() {
 app.on("ready", createWindow);
 
 // Quit when all windows are closed.
-app.on("window-all-closed", function() {
+app.on("window-all-closed", function () {
   // On OS X it is common for applications and their menu bar
   // to stay active until the user quits explicitly with Cmd + Q
   if (process.platform !== "darwin") {
@@ -171,7 +171,7 @@ app.on("window-all-closed", function() {
   }
 });
 
-app.on("activate", function() {
+app.on("activate", function () {
   // On OS X it's common to re-create a window in the app when the
   // dock icon is clicked and there are no other windows open.
   if (mainWindow === null) {

+ 23 - 30
client/public/index.html

@@ -1,31 +1,23 @@
 <!DOCTYPE html>
 <html lang="en">
-  <head>
-    <meta charset="utf-8" />
-    <link rel="icon" href="%PUBLIC_URL%/favicon.png" />
-    <meta name="viewport" content="width=device-width, initial-scale=1" />
-    <meta name="theme-color" content="#000000" />
-    <meta
-      name="description"
-      content="Web site created using create-react-app"
-    />
-    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
-    <!--
+
+<head>
+  <meta charset="utf-8" />
+  <link rel="icon" href="%PUBLIC_URL%/favicon.png" />
+  <meta name="viewport" content="width=device-width, initial-scale=1" />
+  <meta name="theme-color" content="#000000" />
+  <meta name="description" content="Web site created using create-react-app" />
+  <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
+  <!--
       manifest.json provides metadata used when your web app is installed on a
       user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
     -->
-    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
-    <link
-      href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap"
-      rel="stylesheet"
-    />
-    <link
-      href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@300;400&display=swap"
-      rel="stylesheet"
-    />
-    <script src="%PUBLIC_URL%/env-config.js"></script>
+  <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
+  <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap" rel="stylesheet" />
+  <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@300;400&display=swap" rel="stylesheet" />
+  <script src="%PUBLIC_URL%/env-config.js"></script>
 
-    <!--
+  <!--
       Notice the use of %PUBLIC_URL% in the tags above.
       It will be replaced with the URL of the `public` folder during the build.
       Only files inside the `public` folder can be referenced from the HTML.
@@ -34,13 +26,13 @@
       work correctly both with client-side routing and a non-root public URL.
       Learn how to configure a non-root public URL by running `npm run build`.
     -->
-    <title>Milvus Insight</title>
-  </head>
+  <title>Attu</title>
+</head>
 
-  <body>
-    <noscript>You need to enable JavaScript to run this app.</noscript>
-    <div id="root"></div>
-    <!--
+<body>
+  <noscript>You need to enable JavaScript to run this app.</noscript>
+  <div id="root"></div>
+  <!--
       This HTML file is a template.
       If you open it directly in the browser, you will see an empty page.
 
@@ -50,5 +42,6 @@
       To begin the development, run `npm start` or `yarn start`.
       To create a production bundle, use `npm run build` or `yarn build`.
     -->
-  </body>
-</html>
+</body>
+
+</html>

BIN
client/public/zilliz.icns


BIN
client/public/zilliz.png


+ 0 - 5
client/src/assets/icons/milvus.svg

@@ -1,5 +0,0 @@
-<svg width="44" height="31" viewBox="0 0 44 31" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M30.4251 5.17564C24.7152 -0.554964 15.4562 -0.554964 9.74634 5.17564L0.41376 14.5419C-0.13792 15.0962 -0.13792 15.9886 0.41376 16.5429L9.74634 25.9091C15.4562 31.6397 24.7152 31.6397 30.4251 25.9185C36.1442 20.1973 36.1442 10.9062 30.4251 5.17564ZM28.2184 23.166C24.0256 27.3747 17.2216 27.3747 13.0288 23.166L6.16042 16.2798C5.75586 15.8759 5.75586 15.2183 6.16042 14.8049L13.0196 7.9282C17.2124 3.7195 24.0165 3.7195 28.2092 7.9282C32.4112 12.1369 32.4112 18.9573 28.2184 23.166Z" fill="#4FC4F9"/>
-<path d="M42.6532 14.5515L38.5431 10.3522C38.2949 10.0986 37.8811 10.3334 37.9639 10.681C38.6719 13.8845 38.6719 17.2289 37.9639 20.4324C37.8903 20.78 38.3041 21.0055 38.5431 20.7612L42.6532 16.5619C43.1956 15.9983 43.1956 15.1058 42.6532 14.5515Z" fill="#4FC4F9"/>
-<path d="M20.6691 22.9126C24.6453 22.9126 27.8686 19.6193 27.8686 15.5568C27.8686 11.4942 24.6453 8.20093 20.6691 8.20093C16.693 8.20093 13.4697 11.4942 13.4697 15.5568C13.4697 19.6193 16.693 22.9126 20.6691 22.9126Z" fill="#4FC4F9"/>
-</svg>

+ 4 - 0
client/src/assets/icons/zilliz.svg

@@ -0,0 +1,4 @@
+<svg width="1000" height="1000" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M17.3685 6.05855L19.5183 2.14221H5.11893C4.49104 2.14221 3.98145 2.65568 3.98145 3.28834V6.64995H16.3732C16.7872 6.64995 17.1683 6.42416 17.3685 6.05855Z" fill="#008CFF"/>
+<path d="M13.7456 12.9033L11.2443 8.5824L4.60819 20.2856C4.17481 21.05 4.72194 22.0002 5.59552 22.0002H18.986L16.405 17.4924H11.1112L13.7456 12.9033Z" fill="#008CFF"/>
+</svg>

+ 8 - 8
client/src/components/__test__/grid/Grid.spec.tsx

@@ -1,6 +1,6 @@
 import { render, unmountComponentAtNode } from 'react-dom';
 import { act } from 'react-dom/test-utils';
-import MilvusGrid from '../../grid/Grid';
+import AttuGrid from '../../grid/Grid';
 import { ToolBarConfig } from '../../grid/Types';
 
 let container: any = null;
@@ -17,7 +17,7 @@ jest.mock('react-i18next', () => {
 
 jest.mock('../../grid/Table', () => {
   return () => {
-    return <div id="table">{}</div>;
+    return <div id="table">{ }</div>;
   };
 });
 
@@ -31,7 +31,7 @@ jest.mock('react-router-dom', () => {
   return {
     useHistory: () => {
       return {
-        listen: () => () => {},
+        listen: () => () => { },
         location: {
           name: '',
         },
@@ -55,7 +55,7 @@ describe('Test Grid index', () => {
   it('Has Table Data', () => {
     act(() => {
       render(
-        <MilvusGrid
+        <AttuGrid
           primaryKey="id"
           rows={[{}]}
           colDefinitions={[]}
@@ -73,7 +73,7 @@ describe('Test Grid index', () => {
     const title = ['collections', 'vectors'];
     act(() => {
       render(
-        <MilvusGrid
+        <AttuGrid
           primaryKey="id"
           rows={[]}
           colDefinitions={[]}
@@ -96,13 +96,13 @@ describe('Test Grid index', () => {
       {
         label: 'collection',
         icon: 'search',
-        onClick: () => {},
-        onSearch: () => {},
+        onClick: () => { },
+        onSearch: () => { },
       },
     ];
     act(() => {
       render(
-        <MilvusGrid
+        <AttuGrid
           primaryKey="id"
           rows={[]}
           colDefinitions={[]}

+ 1 - 1
client/src/components/cards/EmptyCard.tsx

@@ -13,7 +13,7 @@ const useStyles = makeStyles((theme: Theme) => ({
     marginTop: theme.spacing(4),
     fontSize: '36px',
     lineHeight: '42px',
-    color: theme.palette.milvusGrey.dark,
+    color: theme.palette.attuGrey.dark,
     fontWeight: 'bold',
     letterSpacing: '-0.02em',
   },

+ 1 - 1
client/src/components/code/CodeView.tsx

@@ -12,7 +12,7 @@ const getStyles = makeStyles((theme: Theme) => ({
     width: '100%',
 
     padding: theme.spacing(4),
-    backgroundColor: theme.palette.milvusDark.main,
+    backgroundColor: theme.palette.attuDark.main,
     borderRadius: 8,
 
     color: '#fff',

+ 1 - 1
client/src/components/customDialog/CustomDialogTitle.tsx

@@ -19,7 +19,7 @@ const getStyles = makeStyles((theme: Theme) => ({
   },
   icon: {
     fontSize: '24px',
-    color: theme.palette.milvusDark.main,
+    color: theme.palette.attuDark.main,
 
     cursor: 'pointer',
   },

+ 1 - 1
client/src/components/customDialog/DeleteDialogTemplate.tsx

@@ -34,7 +34,7 @@ const useStyles = makeStyles((theme: Theme) => ({
     padding: '10px 12px',
   },
   cancelBtn: {
-    color: theme.palette.milvusGrey.dark,
+    color: theme.palette.attuGrey.dark,
   },
 }));
 

+ 18 - 18
client/src/components/customInput/CustomInput.tsx

@@ -32,10 +32,10 @@ const handleOnBlur = (param: IBlurParam) => {
   const input = event.target.value;
   const isValid = validations
     ? checkValid({
-        key,
-        value: input,
-        rules: validations,
-      })
+      key,
+      value: input,
+      rules: validations,
+    })
     : true;
 
   if (isValid) {
@@ -52,10 +52,10 @@ const handleOnChange = (param: IChangeParam) => {
   const input = event.target.value;
   const isValid = validations
     ? checkValid({
-        key,
-        value: input,
-        rules: validations,
-      })
+      key,
+      value: input,
+      rules: validations,
+    })
     : true;
 
   if (isValid) {
@@ -65,7 +65,7 @@ const handleOnChange = (param: IChangeParam) => {
 
 const getAdornmentStyles = makeStyles(theme => ({
   icon: {
-    color: theme.palette.milvusGrey.dark,
+    color: theme.palette.attuGrey.dark,
   },
 }));
 
@@ -90,7 +90,7 @@ const getAdornmentInput = (
   const classes = getAdornmentStyles();
 
   const param = {
-    cb: onInputBlur || (() => {}),
+    cb: onInputBlur || (() => { }),
     validations: validations || [],
     checkValid,
   };
@@ -112,13 +112,13 @@ const getAdornmentInput = (
             key,
             param: {
               ...param,
-              cb: onInputChange || (() => {}),
+              cb: onInputChange || (() => { }),
             },
           });
         }}
         endAdornment={
           <InputAdornment position="end">
-            <IconButton onClick={onIconClick || (() => {})} edge="end">
+            <IconButton onClick={onIconClick || (() => { })} edge="end">
               {isPasswordType
                 ? showPassword
                   ? Icons.visible({ classes: { root: classes.icon } })
@@ -162,10 +162,10 @@ const getIconInput = (
         {inputType === 'icon'
           ? getTextfield(inputConfig as ITextfieldConfig, checkValid, validInfo)
           : getAdornmentInput(
-              inputConfig as IAdornmentConfig,
-              checkValid,
-              validInfo
-            )}
+            inputConfig as IAdornmentConfig,
+            checkValid,
+            validInfo
+          )}
       </Grid>
     </Grid>
   );
@@ -196,7 +196,7 @@ const getTextfield = (
   }
 
   const param = {
-    cb: onBlur || (() => {}),
+    cb: onBlur || (() => { }),
     validations: validations || [],
     checkValid,
   };
@@ -233,7 +233,7 @@ const getTextfield = (
         handleOnChange({
           event,
           key,
-          param: { ...param, cb: onChange || (() => {}) },
+          param: { ...param, cb: onChange || (() => { }) },
         });
       }}
     />

+ 1 - 1
client/src/components/customProgress/CustomLinearProgress.tsx

@@ -17,7 +17,7 @@ const getProgressStyles = makeStyles((theme: Theme) => ({
   percent: {
     minWidth: '35px',
     marginLeft: theme.spacing(1),
-    color: theme.palette.milvusDark.main,
+    color: theme.palette.attuDark.main,
   },
 }));
 

+ 5 - 5
client/src/components/grid/Grid.tsx

@@ -7,7 +7,7 @@ import TablePagination from '@material-ui/core/TablePagination';
 import Typography from '@material-ui/core/Typography';
 import CustomToolbar from './ToolBar';
 import Table from './Table';
-import { MilvusGridType } from './Types';
+import { AttuGridType } from './Types';
 import { useTranslation } from 'react-i18next';
 import TablePaginationActions from './TablePaginationActions';
 
@@ -91,7 +91,7 @@ const userStyle = makeStyles(theme => ({
  * @param order order by which table field
  * @returns
  */
-const MilvusGrid: FC<MilvusGridType> = props => {
+const AttuGrid: FC<AttuGridType> = props => {
   const classes = userStyle();
 
   // i18n
@@ -123,8 +123,8 @@ const MilvusGrid: FC<MilvusGridType> = props => {
     headEditable = false,
     editHeads = [],
     selected = [],
-    setSelected = () => {},
-    setRowsPerPage = () => {},
+    setSelected = () => { },
+    setRowsPerPage = () => { },
     tableCellMaxWidth,
     handleSort,
     order,
@@ -244,4 +244,4 @@ const MilvusGrid: FC<MilvusGridType> = props => {
   );
 };
 
-export default MilvusGrid;
+export default AttuGrid;

+ 1 - 1
client/src/components/grid/Types.ts

@@ -114,7 +114,7 @@ export type ColDefinitionsType = {
   actionBarConfigs?: ActionBarConfig[];
 };
 
-export type MilvusGridType = ToolBarType & {
+export type AttuGridType = ToolBarType & {
   rowCount: number;
   rowsPerPage?: number;
   // used to dynamic set page size by table container and row height

+ 3 - 3
client/src/components/icons/Icons.tsx

@@ -25,7 +25,7 @@ import AlternateEmailIcon from '@material-ui/icons/AlternateEmail';
 import DatePicker from '@material-ui/icons/Event';
 import GetAppIcon from '@material-ui/icons/GetApp';
 import { SvgIcon } from '@material-ui/core';
-import { ReactComponent as MilvusIcon } from '../../assets/icons/milvus.svg';
+import { ReactComponent as ZillizIcon } from '../../assets/icons/zilliz.svg';
 import { ReactComponent as OverviewIcon } from '../../assets/icons/overview.svg';
 import { ReactComponent as CollectionIcon } from '../../assets/icons/collecion.svg';
 import { ReactComponent as ConsoleIcon } from '../../assets/icons/console.svg';
@@ -65,8 +65,8 @@ const icons: { [x in IconsType]: (props?: any) => React.ReactElement } = {
   datePicker: (props = {}) => <DatePicker {...props} />,
   download: (props = {}) => <GetAppIcon {...props} />,
 
-  milvus: (props = {}) => (
-    <SvgIcon viewBox="0 0 44 31" component={MilvusIcon} {...props} />
+  zilliz: (props = {}) => (
+    <SvgIcon viewBox="0 0 44 31" component={ZillizIcon} {...props} />
   ),
   navOverview: (props = {}) => (
     <SvgIcon viewBox="0 0 20 20" component={OverviewIcon} {...props} />

+ 1 - 1
client/src/components/icons/Types.ts

@@ -11,7 +11,7 @@ export type IconsType =
   | 'app'
   | 'more'
   | 'success'
-  | 'milvus'
+  | 'zilliz'
   | 'navOverview'
   | 'navCollection'
   | 'navConsole'

+ 4 - 4
client/src/components/insert/Import.tsx

@@ -9,7 +9,7 @@ import { parseByte } from '../../utils/Format';
 
 const getStyles = makeStyles((theme: Theme) => ({
   tip: {
-    color: theme.palette.milvusGrey.dark,
+    color: theme.palette.attuGrey.dark,
     fontWeight: 500,
     marginBottom: theme.spacing(1),
   },
@@ -24,13 +24,13 @@ const getStyles = makeStyles((theme: Theme) => ({
       '& .selectLabel': {
         fontSize: '14px',
         lineHeight: '20px',
-        color: theme.palette.milvusDark.main,
+        color: theme.palette.attuDark.main,
       },
 
       '& .divider': {
         width: '20px',
         margin: theme.spacing(0, 4),
-        backgroundColor: theme.palette.milvusGrey.dark,
+        backgroundColor: theme.palette.attuGrey.dark,
       },
     },
 
@@ -46,7 +46,7 @@ const getStyles = makeStyles((theme: Theme) => ({
     backgroundColor: '#f9f9f9',
 
     '& .text': {
-      color: theme.palette.milvusGrey.dark,
+      color: theme.palette.attuGrey.dark,
     },
 
     '& .file': {

+ 9 - 10
client/src/components/insert/Preview.tsx

@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
 import { InsertPreviewProps } from './Types';
 import { Option } from '../customSelector/Types';
 import CustomSelector from '../customSelector/CustomSelector';
-import MilvusGrid from '../grid/Grid';
+import AttuGrid from '../grid/Grid';
 import { transferCsvArrayToTableData } from '../../utils/Insert';
 import { ColDefinitionsType } from '../grid/Types';
 import SimpleMenu from '../menu/SimpleMenu';
@@ -15,7 +15,7 @@ const getStyles = makeStyles((theme: Theme) => ({
     width: '75vw',
   },
   selectorTip: {
-    color: theme.palette.milvusGrey.dark,
+    color: theme.palette.attuGrey.dark,
     fontWeight: 500,
     marginBottom: theme.spacing(1),
   },
@@ -42,7 +42,7 @@ const getStyles = makeStyles((theme: Theme) => ({
     marginBottom: theme.spacing(1),
 
     '& .text': {
-      color: theme.palette.milvusGrey.dark,
+      color: theme.palette.attuGrey.dark,
       fontWeight: 500,
     },
   },
@@ -51,7 +51,7 @@ const getStyles = makeStyles((theme: Theme) => ({
     justifyContent: 'space-between',
     minWidth: '160px',
 
-    color: theme.palette.milvusGrey.dark,
+    color: theme.palette.attuGrey.dark,
     backgroundColor: '#fff',
 
     '&:hover': {
@@ -60,13 +60,13 @@ const getStyles = makeStyles((theme: Theme) => ({
   },
 
   menuIcon: {
-    color: theme.palette.milvusGrey.dark,
+    color: theme.palette.attuGrey.dark,
   },
   menuItem: {
     fontWeight: 500,
     fontSize: '12px',
     lineHeight: '16px',
-    color: theme.palette.milvusGrey.dark,
+    color: theme.palette.attuGrey.dark,
   },
   menuActive: {
     color: theme.palette.primary.main,
@@ -116,9 +116,8 @@ const InsertPreview: FC<InsertPreviewProps> = ({
             menuItems={schemaOptions.map(schema => ({
               label: schema.label,
               callback: () => handleTableHeadChange(index, schema.label),
-              wrapperClass: `${classes.menuItem} ${
-                head === schema.label ? classes.menuActive : ''
-              }`,
+              wrapperClass: `${classes.menuItem} ${head === schema.label ? classes.menuActive : ''
+                }`,
             }))}
             buttonProps={{
               className: classes.menuLabel,
@@ -189,7 +188,7 @@ const InsertPreview: FC<InsertPreviewProps> = ({
       </div>
       {tableData.length > 0 && (
         <div className={classes.gridWrapper}>
-          <MilvusGrid
+          <AttuGrid
             toolbarConfigs={[]}
             colDefinitions={colDefinitions}
             rows={tableData}

+ 1 - 1
client/src/components/layout/Layout.tsx

@@ -24,7 +24,7 @@ const useStyles = makeStyles((theme: Theme) =>
 
       '& .normalSearchIcon': {
         '& path': {
-          fill: theme.palette.milvusGrey.dark,
+          fill: theme.palette.attuGrey.dark,
         },
       },
 

+ 6 - 6
client/src/components/menu/NavMenu.tsx

@@ -45,7 +45,7 @@ const useStyles = makeStyles((theme: Theme) =>
       boxSizing: 'content-box',
       height: theme.spacing(3),
       width: 'initial',
-      color: theme.palette.milvusGrey.dark,
+      color: theme.palette.attuGrey.dark,
     },
     itemIcon: {
       minWidth: '20px',
@@ -55,7 +55,7 @@ const useStyles = makeStyles((theme: Theme) =>
         fill: 'transparent',
 
         '& path': {
-          stroke: theme.palette.milvusGrey.dark,
+          stroke: theme.palette.attuGrey.dark,
         },
       },
     },
@@ -120,7 +120,7 @@ const useStyles = makeStyles((theme: Theme) =>
       padding: 0,
 
       '& svg path': {
-        fill: theme.palette.milvusGrey.dark,
+        fill: theme.palette.attuGrey.dark,
       },
 
       '&:hover': {
@@ -148,7 +148,7 @@ const NavMenu: FC<NavMenuType> = props => {
   const [active, setActive] = useState<string>(defaultActive);
 
   const { t: commonTrans } = useTranslation();
-  const milvusTrans = commonTrans('milvus');
+  const attuTrans = commonTrans('attu');
 
   useEffect(() => {
     if (defaultActive) {
@@ -197,7 +197,7 @@ const NavMenu: FC<NavMenuType> = props => {
     );
   };
 
-  const Logo = icons.milvus;
+  const Logo = icons.zilliz;
 
   return (
     <List
@@ -218,7 +218,7 @@ const NavMenu: FC<NavMenuType> = props => {
           />
           <Fade in={expanded} timeout={timeout}>
             <Typography variant="h3" className="title">
-              {milvusTrans.admin}
+              {attuTrans.admin}
             </Typography>
           </Fade>
         </div>

+ 0 - 2
client/src/consts/Localstorage.ts

@@ -1,4 +1,2 @@
-export const TOKEN = 'milvusToken';
 export const SESSION = 'CLOUD_SESSION';
-export const USER_INFO = 'userInfo';
 export const MILVUS_ADDRESS = 'milvus_address';

+ 2 - 2
client/src/context/Auth.tsx

@@ -6,7 +6,7 @@ import { AuthContextType } from './Types';
 export const authContext = createContext<AuthContextType>({
   isAuth: false,
   address: '',
-  setAddress: () => {},
+  setAddress: () => { },
 });
 
 const { Provider } = authContext;
@@ -39,7 +39,7 @@ export const AuthProvider = (props: { children: React.ReactNode }) => {
   }, [setAddress]);
 
   useEffect(() => {
-    document.title = address ? `${address} - Milvus Insight` : 'Milvus Insight';
+    document.title = address ? `${address} - Attu` : 'Attu';
   }, [address]);
 
   return (

+ 2 - 2
client/src/i18n/cn/common.ts

@@ -1,6 +1,6 @@
 const commonTrans = {
-  milvus: {
-    admin: 'Milvus Insight',
+  attu: {
+    admin: 'Attu',
     address: 'Milvus Address',
   },
   status: {

+ 2 - 2
client/src/i18n/en/common.ts

@@ -1,6 +1,6 @@
 const commonTrans = {
-  milvus: {
-    admin: 'Milvus Insight',
+  attu: {
+    admin: 'Attu',
     address: 'Milvus Address',
   },
   status: {

+ 8 - 8
client/src/pages/collections/Collections.tsx

@@ -2,7 +2,7 @@ import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
 import { Link } from 'react-router-dom';
 import { useNavigationHook } from '../../hooks/Navigation';
 import { ALL_ROUTER_TYPES } from '../../router/Types';
-import MilvusGrid from '../../components/grid/Grid';
+import AttuGrid from '../../components/grid/Grid';
 import CustomToolBar from '../../components/grid/ToolBar';
 import {
   CollectionCreateParam,
@@ -190,12 +190,12 @@ const Collections = () => {
     data.fields = data.fields.map(v =>
       vectorType.includes(v.data_type)
         ? {
-            ...v,
-            type_params: {
-              // if data type is vector, dimension must exist.
-              dim: v.dimension!,
-            },
-          }
+          ...v,
+          type_params: {
+            // if data type is vector, dimension must exist.
+            dim: v.dimension!,
+          },
+        }
         : v
     );
     await CollectionHttp.createCollection(data);
@@ -435,7 +435,7 @@ const Collections = () => {
   return (
     <section className="page-wrapper">
       {collections.length > 0 || loading ? (
-        <MilvusGrid
+        <AttuGrid
           toolbarConfigs={toolbarConfigs}
           colDefinitions={colDefinitions}
           rows={collectionList}

+ 6 - 6
client/src/pages/connect/Connect.tsx

@@ -54,7 +54,7 @@ const Connect = () => {
   const classes = useStyles();
   const { t: commonTrans } = useTranslation();
   const { t: warningTrans } = useTranslation('warning');
-  const milvusTrans = commonTrans('milvus');
+  const attuTrans = commonTrans('attu');
   const { t: btnTrans } = useTranslation('btn');
   const { t: successTrans } = useTranslation('success');
 
@@ -67,7 +67,7 @@ const Connect = () => {
   }, [form]);
   const { validation, checkIsValid, disabled } = useFormValidation(checkedForm);
 
-  const Logo = icons.milvus;
+  const Logo = icons.zilliz;
 
   const handleInputChange = (value: string) => {
     setForm({ address: value });
@@ -83,17 +83,17 @@ const Connect = () => {
   };
 
   const addressInputConfig: ITextfieldConfig = {
-    label: milvusTrans.address,
+    label: attuTrans.address,
     key: 'address',
     onChange: handleInputChange,
     variant: 'filled',
     className: classes.input,
-    placeholder: milvusTrans.address,
+    placeholder: attuTrans.address,
     fullWidth: true,
     validations: [
       {
         rule: 'require',
-        errorText: warningTrans('required', { name: milvusTrans.address }),
+        errorText: warningTrans('required', { name: attuTrans.address }),
       },
     ],
     defaultValue: form.address,
@@ -105,7 +105,7 @@ const Connect = () => {
         <div className={classes.titleWrapper}>
           <Logo classes={{ root: classes.logo }} />
           <Typography variant="h2" className="title">
-            {milvusTrans.admin}
+            {attuTrans.admin}
           </Typography>
         </div>
         <CustomInput

+ 3 - 4
client/src/pages/overview/collectionCard/CollectionCard.tsx

@@ -20,7 +20,7 @@ const useStyles = makeStyles((theme: Theme) => ({
 
       margin: theme.spacing(2, 0),
 
-      color: theme.palette.milvusDark.main,
+      color: theme.palette.attuDark.main,
       fontSize: '20px',
       lineHeight: '24px',
       fontWeight: 'bold',
@@ -104,9 +104,8 @@ const CollectionCard: FC<CollectionCardProps> = ({
 
   return (
     <div
-      className={`card-wrapper ${classes.wrapper} ${wrapperClass} ${
-        data._status === LOADING_STATE.LOADING && classes.loading
-      }`}
+      className={`card-wrapper ${classes.wrapper} ${wrapperClass} ${data._status === LOADING_STATE.LOADING && classes.loading
+        }`}
     >
       <div>
         <Status status={status} percentage={_loadedPercentage} />

+ 1 - 1
client/src/pages/overview/statisticsCard/StatisticsCard.tsx

@@ -17,7 +17,7 @@ const useStyles = makeStyles((theme: Theme) => ({
   label: {
     fontSize: '12px',
     lineHeight: '16px',
-    color: theme.palette.milvusDark.main,
+    color: theme.palette.attuDark.main,
   },
   value: {
     fontSize: '24px',

+ 2 - 2
client/src/pages/partitions/Partitions.tsx

@@ -5,7 +5,7 @@ import {
   // PartitionParam,
   PartitionView,
 } from './Types';
-import MilvusGrid from '../../components/grid/Grid';
+import AttuGrid from '../../components/grid/Grid';
 import { ColDefinitionsType, ToolBarConfig } from '../../components/grid/Types';
 import { useTranslation } from 'react-i18next';
 import { usePaginationHook } from '../../hooks/Pagination';
@@ -386,7 +386,7 @@ const Partitions: FC<{
 
   return (
     <section className={classes.wrapper}>
-      <MilvusGrid
+      <AttuGrid
         toolbarConfigs={toolbarConfigs}
         colDefinitions={colDefinitions}
         rows={partitionList}

+ 2 - 2
client/src/pages/query/Query.tsx

@@ -6,7 +6,7 @@ import { rootContext } from '../../context/Root';
 import EmptyCard from '../../components/cards/EmptyCard';
 import icons from '../../components/icons/Icons';
 import CustomButton from '../../components/customButton/CustomButton';
-import MilvusGrid from '../../components/grid/Grid';
+import AttuGrid from '../../components/grid/Grid';
 import { ToolBarConfig } from '../../components/grid/Types';
 import { getQueryStyles } from './Styles';
 import Filter from '../../components/advancedSearch';
@@ -260,7 +260,7 @@ const Query: FC<{
         </div>
       </div>
       {tableLoading || queryResult?.length ? (
-        <MilvusGrid
+        <AttuGrid
           toolbarConfigs={[]}
           colDefinitions={fields.map(i => ({
             id: i.name,

+ 4 - 4
client/src/pages/schema/Schema.tsx

@@ -1,6 +1,6 @@
 import { makeStyles, Theme, Typography } from '@material-ui/core';
 import { FC, useCallback, useEffect, useState } from 'react';
-import MilvusGrid from '../../components/grid/Grid';
+import AttuGrid from '../../components/grid/Grid';
 import { ColDefinitionsType } from '../../components/grid/Types';
 import { useTranslation } from 'react-i18next';
 import { usePaginationHook } from '../../hooks/Pagination';
@@ -39,13 +39,13 @@ const useStyles = makeStyles((theme: Theme) => ({
       marginRight: theme.spacing(2),
 
       '& .key': {
-        color: theme.palette.milvusGrey.dark,
+        color: theme.palette.attuGrey.dark,
         display: 'inline-block',
         marginRight: theme.spacing(0.5),
       },
 
       '& .value': {
-        color: theme.palette.milvusDark.main,
+        color: theme.palette.attuDark.main,
       },
     },
   },
@@ -213,7 +213,7 @@ const Schema: FC<{
 
   return (
     <section className={classes.wrapper}>
-      <MilvusGrid
+      <AttuGrid
         toolbarConfigs={[]}
         colDefinitions={colDefinitions}
         rows={schemaList}

+ 2 - 2
client/src/pages/schema/SizingInfo.tsx

@@ -15,7 +15,7 @@ const useStyles = makeStyles((theme: Theme) => ({
     display: 'flex',
 
     '& .title': {
-      color: theme.palette.milvusGrey.dark,
+      color: theme.palette.attuGrey.dark,
     },
   },
   icon: {
@@ -32,7 +32,7 @@ const useStyles = makeStyles((theme: Theme) => ({
 
     '& .key': {
       marginRight: theme.spacing(2),
-      color: theme.palette.milvusGrey.dark,
+      color: theme.palette.attuGrey.dark,
     },
   },
 }));

+ 5 - 5
client/src/plugins/search/Styles.ts

@@ -16,7 +16,7 @@ export const getVectorSearchStyles = makeStyles((theme: Theme) => ({
       boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.05)',
 
       '& .textarea': {
-        border: `1px solid ${theme.palette.milvusGrey.main}`,
+        border: `1px solid ${theme.palette.attuGrey.main}`,
         borderRadius: theme.spacing(0.5),
         padding: theme.spacing(1),
         paddingBottom: '18px',
@@ -71,7 +71,7 @@ export const getVectorSearchStyles = makeStyles((theme: Theme) => ({
     },
 
     '& .text': {
-      color: theme.palette.milvusGrey.dark,
+      color: theme.palette.attuGrey.dark,
       fontWeight: 500,
     },
   },
@@ -95,7 +95,7 @@ export const getVectorSearchStyles = makeStyles((theme: Theme) => ({
       alignItems: 'center',
 
       '& .text': {
-        color: theme.palette.milvusGrey.main,
+        color: theme.palette.attuGrey.main,
       },
     },
     '& .right': {
@@ -114,13 +114,13 @@ export const getVectorSearchStyles = makeStyles((theme: Theme) => ({
     margin: theme.spacing(0, 1),
 
     backgroundColor: '#fff',
-    color: theme.palette.milvusGrey.dark,
+    color: theme.palette.attuGrey.dark,
   },
   menuItem: {
     fontWeight: 500,
     fontSize: '12px',
     lineHeight: '16px',
-    color: theme.palette.milvusGrey.dark,
+    color: theme.palette.attuGrey.dark,
   },
   error: {
     marginTop: theme.spacing(1),

+ 16 - 16
client/src/plugins/search/VectorSearch.tsx

@@ -7,7 +7,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
 import SearchParams from './SearchParams';
 import { DEFAULT_METRIC_VALUE_MAP } from '../../consts/Milvus';
 import { FieldOption, SearchResultView, VectorSearchParam } from './Types';
-import MilvusGrid from '../../components/grid/Grid';
+import AttuGrid from '../../components/grid/Grid';
 import EmptyCard from '../../components/cards/EmptyCard';
 import icons from '../../components/icons/Icons';
 import { usePaginationHook } from '../../hooks/Pagination';
@@ -123,18 +123,18 @@ const VectorSearch = () => {
      */
     return searchResult && searchResult.length > 0
       ? Object.keys(searchResult[0])
-          .filter(item => {
-            // if primary key field name is id, don't filter it
-            const invalidItems =
-              primaryKeyField === 'id' ? ['score'] : ['id', 'score'];
-            return !invalidItems.includes(item);
-          })
-          .map(key => ({
-            id: key,
-            align: 'left',
-            disablePadding: false,
-            label: key,
-          }))
+        .filter(item => {
+          // if primary key field name is id, don't filter it
+          const invalidItems =
+            primaryKeyField === 'id' ? ['score'] : ['id', 'score'];
+          return !invalidItems.includes(item);
+        })
+        .map(key => ({
+          id: key,
+          align: 'left',
+          disablePadding: false,
+          label: key,
+        }))
       : [];
   }, [searchResult, primaryKeyField]);
 
@@ -421,8 +421,8 @@ const VectorSearch = () => {
             metricType={metricType!}
             embeddingType={
               embeddingType as
-                | DataTypeEnum.BinaryVector
-                | DataTypeEnum.FloatVector
+              | DataTypeEnum.BinaryVector
+              | DataTypeEnum.FloatVector
             }
             indexType={indexType}
             indexParams={indexParams!}
@@ -493,7 +493,7 @@ const VectorSearch = () => {
 
       {/* search result table section */}
       {(searchResult && searchResult.length > 0) || tableLoading ? (
-        <MilvusGrid
+        <AttuGrid
           toolbarConfigs={[]}
           colDefinitions={colDefinitions}
           rows={result}

+ 10 - 10
client/src/styles/theme.ts

@@ -9,18 +9,18 @@ type overridesNameToClassKey = {
 };
 
 declare module '@material-ui/core/styles/overrides' {
-  export interface ComponentNameToClassKey extends overridesNameToClassKey {}
+  export interface ComponentNameToClassKey extends overridesNameToClassKey { }
 }
 declare module '@material-ui/core/styles/createPalette' {
   interface Palette {
-    milvusBlue: Palette['primary'];
-    milvusGrey: Palette['primary'];
-    milvusDark: Palette['primary'];
+    attuBlue: Palette['primary'];
+    attuGrey: Palette['primary'];
+    attuDark: Palette['primary'];
   }
   interface PaletteOptions {
-    milvusBlue: PaletteOptions['primary'];
-    milvusGrey: PaletteOptions['primary'];
-    milvusDark: PaletteOptions['primary'];
+    attuBlue: PaletteOptions['primary'];
+    attuGrey: PaletteOptions['primary'];
+    attuDark: PaletteOptions['primary'];
   }
 }
 
@@ -55,17 +55,17 @@ const commonThemes = {
       light: '#ff8f68',
       dark: '#cd3804',
     },
-    milvusBlue: {
+    attuBlue: {
       main: '#f8f8fc',
       dark: '#dcdce3',
     },
-    milvusGrey: {
+    attuGrey: {
       main: '#aeaebb',
       light: '#dcdce3',
       dark: '#82838e',
       contrastText: '#f8f8fc',
     },
-    milvusDark: {
+    attuDark: {
       main: '#010e29',
     },
   },

+ 1 - 1
client/src/utils/Insert.ts

@@ -1,7 +1,7 @@
 import { generateId } from './Common';
 
 /**
- * function to convert uploaded csv to MilvusGrid component accepted data type
+ * function to convert uploaded csv to AttuGrid component accepted data type
  * @param data uploaded csv data, e.g. [['name1', 12], ['name2', 14]]
  * @returns key value pair object array, use index as key, e.g. [{0: 'name1', 1: 12}, {0: 'name2', 1: 14}]
  */

+ 7 - 7
express/package.json

@@ -1,15 +1,15 @@
 {
-  "name": "milvus-insight",
+  "name": "attu",
   "version": "0.1.8",
   "license": "MIT",
   "author": {
     "name": "ued",
     "email": "ued@zilliz.com"
   },
-  "description": "Milvus Insight help to manage Milvus easily",
+  "description": "Attu help to manage Milvus easily",
   "repository": {
     "type": "git",
-    "url": "https://github.com/zilliztech/milvus-insight"
+    "url": "https://github.com/zilliztech/attu"
   },
   "dependencies": {
     "@zilliz/milvus2-sdk-node": "^1.0.19",
@@ -78,7 +78,7 @@
     "build": "yarn clean && tsc",
     "prestart": "rm -rf dist && yarn build",
     "start": "nodemon dist/app.js",
-    "start:plugin": "yarn build && cross-env PLUGIN_DEV=1 node dist/milvus-insight/express/src/app.js",
+    "start:plugin": "yarn build && cross-env PLUGIN_DEV=1 node dist/attu/express/src/app.js",
     "start:prod": "node dist/app.js",
     "test": "cross-env NODE_ENV=test jest --passWithNoTests",
     "test:watch": "jest --watch",
@@ -119,17 +119,17 @@
       "preload.js"
     ],
     "linux": {
-      "icon": "./build/milvus-icon.icns",
+      "icon": "./build/zilliz.icns",
       "target": [
         "deb"
       ]
     },
     "mac": {
-      "icon": "./build/milvus-icon.icns",
+      "icon": "./build/zilliz.icns",
       "target": "dmg"
     },
     "win": {
-      "icon": "./build/milvus-icon.png",
+      "icon": "./build/zilliz.png",
       "target": [
         {
           "target": "nsis"

+ 3 - 3
package.json

@@ -1,9 +1,9 @@
 {
-  "name": "milvus-insight",
+  "name": "attu",
   "version": "0.1.0",
-  "description": "Milvus insight",
+  "description": "Attu",
   "license": "Apache-2.0",
-  "bugs": "https://github.com/milvus-io/milvus-insight/issues",
+  "bugs": "https://github.com/zilliztech/attu/issues",
   "release": {
     "branches": [
       "main",

+ 0 - 25
server/.eslintrc.js

@@ -1,25 +0,0 @@
-module.exports = {
-  parser: '@typescript-eslint/parser',
-  parserOptions: {
-    project: 'tsconfig.json',
-    tsconfigRootDir: __dirname,
-    sourceType: 'module',
-  },
-  plugins: ['@typescript-eslint/eslint-plugin'],
-  extends: [
-    'plugin:@typescript-eslint/recommended',
-    'plugin:prettier/recommended',
-  ],
-  root: true,
-  env: {
-    node: true,
-    jest: true,
-  },
-  ignorePatterns: ['.eslintrc.js'],
-  rules: {
-    '@typescript-eslint/interface-name-prefix': 'off',
-    '@typescript-eslint/explicit-function-return-type': 'off',
-    '@typescript-eslint/explicit-module-boundary-types': 'off',
-    '@typescript-eslint/no-explicit-any': 'off',
-  },
-};

+ 0 - 34
server/.gitignore

@@ -1,34 +0,0 @@
-# compiled output
-/dist
-/node_modules
-
-# Logs
-logs
-*.log
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-lerna-debug.log*
-
-# OS
-.DS_Store
-
-# Tests
-/coverage
-/.nyc_output
-
-# IDEs and editors
-/.idea
-.project
-.classpath
-.c9/
-*.launch
-.settings/
-*.sublime-workspace
-
-# IDE - VSCode
-.vscode/*
-!.vscode/settings.json
-!.vscode/tasks.json
-!.vscode/launch.json
-!.vscode/extensions.json

+ 0 - 4
server/.prettierrc

@@ -1,4 +0,0 @@
-{
-  "singleQuote": true,
-  "trailingComma": "all"
-}

+ 0 - 42
server/README.md

@@ -1,42 +0,0 @@
-# Milvus insight server
-
-Milvus insight server use [nest](https://docs.nestjs.com/)
-
-Milvus insight server depend on [milvus2-node-sdk](https://www.npmjs.com/package/@zilliz/milvus2-sdk-node) to operate milvus data.
-
-## How to run
-
-1. yarn install
-2. yarn start:dev
-
-## Folder Structure
-
-    .
-    ├── auth                    # Jwt authentication not useful for now
-    ├── collections             # Manage milvus collections api
-    ├── interceptors            # Nest interceptors related
-    ├── middlewares             # Nest middlewares related
-    ├── milvus                  # Milvus itself infomation api. Every other api modules need import this module.
-    ├── partitions              # Manage milvus partitions api
-    ├── pipe                    # Nest pipe related
-    ├── schema                  # Manage milvus schema api
-    ├── users                   # Working with auth module, not useful for now.
-    ├── utils                   # Common helping functions.
-    ├── app.xxx.ts              # Need import all other modules to app module.
-    └── main.ts                 # Usually we dont need change this.
-
-### How to create new module
-
-1. nest g module your-module-name
-2. nest g service your-module-name
-3. nest g controller your-module-name
-
-### Api validation
-
-We use [class-validator](https://github.com/typestack/class-validator) to help us.
-So normally we have dto.ts for every controller file.
-
-### Swagger Doc
-
-We need use ApiProperty to tag every field in dto.ts file and use ApiTags in every controller file.
-After you start server, you can http://localhost:3000/api to see swagger doc.

+ 0 - 33
server/generate-csv.ts

@@ -1,33 +0,0 @@
-import { createObjectCsvWriter as createCsvWriter } from 'csv-writer';
-
-// use to test vector insert
-const csvWriter = createCsvWriter({
-  path: './vectors.csv',
-  header: [
-    { id: 'vector', title: 'vector' },
-    { id: 'bool', title: 'bool' },
-  ],
-});
-
-const records = [];
-
-const generateVector = (dimension) => {
-  let index = 0;
-  const vectors = [];
-  while (index < dimension) {
-    vectors.push(1 + Math.random());
-    index++;
-  }
-  return JSON.stringify(vectors);
-};
-
-while (records.length < 50000) {
-  const value = generateVector(4);
-  records.push({ vector: value, bool: records.length % 2 === 0 });
-}
-
-csvWriter
-  .writeRecords(records) // returns a promise
-  .then(() => {
-    console.log('...Done');
-  });

+ 0 - 7
server/nest-cli.json

@@ -1,7 +0,0 @@
-{
-  "collection": "@nestjs/schematics",
-  "sourceRoot": "src",
-  "compilerOptions": {
-    "plugins": ["@nestjs/swagger"]
-  }
-}

+ 0 - 95
server/package.json

@@ -1,95 +0,0 @@
-{
-  "name": "milvus-insight-server",
-  "version": "0.1.0",
-  "description": "Milvus insight API server",
-  "license": "Apache-2.0",
-  "bugs": "https://github.com/milvus-io/milvus-insight/issues",
-  "private": true,
-  "scripts": {
-    "prebuild": "rimraf dist",
-    "build": "nest build",
-    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
-    "start": "nest start",
-    "start:dev": "nest start --watch",
-    "start:debug": "nest start --debug --watch",
-    "start:prod": "node dist/src/main",
-    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
-    "test": "jest",
-    "test:watch": "jest --watch",
-    "test:cov": "jest --coverage",
-    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
-    "test:e2e": "jest --config ./test/jest-e2e.json"
-  },
-  "dependencies": {
-    "@nestjs/common": "^8.0.4",
-    "@nestjs/core": "^8.0.4",
-    "@nestjs/jwt": "^8.0.0",
-    "@nestjs/passport": "^8.0.0",
-    "@nestjs/platform-express": "^8.0.4",
-    "@nestjs/platform-socket.io": "^8.0.4",
-    "@nestjs/schedule": "^1.0.1",
-    "@nestjs/serve-static": "^2.2.2",
-    "@nestjs/swagger": "^5.0.8",
-    "@nestjs/websockets": "^8.0.4",
-    "@types/passport-jwt": "^3.0.5",
-    "@types/passport-local": "^1.0.33",
-    "@zilliz/milvus2-sdk-node": "^1.0.18",
-    "axios": "^0.21.3",
-    "body-parser": "^1.19.0",
-    "cache-manager": "^3.4.4",
-    "class-transformer": "^0.4.0",
-    "class-validator": "^0.13.1",
-    "helmet": "^4.6.0",
-    "hyperlinker": "^1.0.0",
-    "passport": "^0.4.1",
-    "passport-jwt": "^4.0.0",
-    "passport-local": "^1.0.0",
-    "reflect-metadata": "^0.1.13",
-    "rimraf": "^3.0.2",
-    "rxjs": "^7.2.0",
-    "set-value": "^4.1.0",
-    "socket.io": "^4.1.3",
-    "swagger-ui-express": "^4.1.6"
-  },
-  "devDependencies": {
-    "@nestjs/cli": "^8.0.2",
-    "@nestjs/schematics": "^8.0.2",
-    "@nestjs/testing": "^8.0.4",
-    "@types/cache-manager": "^3.4.2",
-    "@types/express": "^4.17.11",
-    "@types/jest": "^26.0.22",
-    "@types/node": "^14.14.36",
-    "@types/supertest": "^2.0.10",
-    "@typescript-eslint/eslint-plugin": "^4.19.0",
-    "@typescript-eslint/parser": "^4.19.0",
-    "csv-writer": "^1.6.0",
-    "eslint": "^7.22.0",
-    "eslint-config-prettier": "^8.1.0",
-    "eslint-plugin-prettier": "^3.3.1",
-    "jest": "^26.6.3",
-    "prettier": "^2.2.1",
-    "supertest": "^6.1.3",
-    "ts-jest": "^26.5.4",
-    "ts-loader": "^8.0.18",
-    "ts-node": "^9.1.1",
-    "tsconfig-paths": "^3.9.0",
-    "typescript": "^4.2.3"
-  },
-  "jest": {
-    "moduleFileExtensions": [
-      "js",
-      "json",
-      "ts"
-    ],
-    "rootDir": "src",
-    "testRegex": ".*\\.spec\\.ts$",
-    "transform": {
-      "^.+\\.(t|j)s$": "ts-jest"
-    },
-    "collectCoverageFrom": [
-      "**/*.(t|j)s"
-    ],
-    "coverageDirectory": "../coverage",
-    "testEnvironment": "node"
-  }
-}

+ 0 - 21
server/src/app.controller.spec.ts

@@ -1,21 +0,0 @@
-import { Test, TestingModule } from '@nestjs/testing';
-import { AppController } from './app.controller';
-
-describe('AppController', () => {
-  let appController: AppController;
-
-  beforeEach(async () => {
-    const app: TestingModule = await Test.createTestingModule({
-      controllers: [AppController],
-      providers: [],
-    }).compile();
-
-    appController = app.get<AppController>(AppController);
-  });
-
-  describe('root', () => {
-    it('should defined', () => {
-      expect(appController).toBeDefined();
-    });
-  });
-});

+ 0 - 12
server/src/app.controller.ts

@@ -1,12 +0,0 @@
-import { Controller, Get } from '@nestjs/common';
-
-@Controller()
-export class AppController {
-  constructor() {}
-
-  // used for check healthy after build finished
-  @Get('healthy')
-  async checkServer() {
-    return { status: 200 };
-  }
-}

+ 0 - 56
server/src/app.module.ts

@@ -1,56 +0,0 @@
-import { Module } from '@nestjs/common';
-import { APP_INTERCEPTOR } from '@nestjs/core';
-import { ServeStaticModule } from '@nestjs/serve-static';
-import { AppController } from './app.controller';
-import { AppService } from './app.service';
-import { ErrorInterceptor, TransformResInterceptor } from './interceptors';
-import { MilvusModule } from './milvus/milvus.module';
-import { CollectionsModule } from './collections/collections.module';
-import { join } from 'path';
-import { PartitionsModule } from './partitions/partitions.module';
-import { SchemaModule } from './schema/schema.module';
-import { EventsModule } from './events/events.module';
-import { LoggingInterceptor } from './interceptors/index';
-import { CronsModule } from './crons/crons.module';
-import { ScheduleModule } from '@nestjs/schedule';
-
-@Module({
-  imports: [
-    // Milvus insight will be available in one docker, so we will build client files in server's client directory
-    ServeStaticModule.forRoot({
-      rootPath: join(__dirname, '../../', 'build'),
-      // renderPath: '/', // only root render static html
-    }),
-    // used for connection and checking server stats
-    // TODO: rename to Connect
-    MilvusModule,
-    // used for manage collection
-    CollectionsModule,
-    // used for manage partitions
-    PartitionsModule,
-    // used for manage index
-    SchemaModule,
-    // used for events communication
-    EventsModule,
-    CronsModule,
-    ScheduleModule.forRoot(),
-  ],
-  controllers: [AppController],
-  providers: [
-    AppService,
-    // global interceptors
-    {
-      provide: APP_INTERCEPTOR,
-      useClass: ErrorInterceptor,
-    },
-    {
-      provide: APP_INTERCEPTOR,
-      useClass: TransformResInterceptor,
-    },
-    {
-      provide: APP_INTERCEPTOR,
-      useClass: LoggingInterceptor,
-    },
-  ],
-})
-export class AppModule {}

+ 0 - 8
server/src/app.service.ts

@@ -1,8 +0,0 @@
-import { Injectable } from '@nestjs/common';
-
-@Injectable()
-export class AppService {
-  getHello(): string {
-    return 'Hello Milvus!';
-  }
-}

+ 0 - 5
server/src/cache/config.ts

@@ -1,5 +0,0 @@
-export const ttl = 10; //seconds
-export const cacheKeys = {
-  LOADEDCOLLECTIONS: 'LOADEDCOLLECTIONS',
-  ALLCOLLECTIONS: 'ALLCOLLECTIONS',
-};

+ 0 - 19
server/src/collections/collections.controller.spec.ts

@@ -1,19 +0,0 @@
-import { Test, TestingModule } from '@nestjs/testing';
-import { CollectionsController } from './collections.controller';
-import { CacheModule } from '@nestjs/common';
-import { CollectionsModule } from './collections.module';
-
-describe('CollectionsController', () => {
-  let controller: CollectionsController;
-
-  beforeEach(async () => {
-    const module: TestingModule = await Test.createTestingModule({
-      imports: [CacheModule.register({}), CollectionsModule],
-    }).compile();
-    controller = module.get<CollectionsController>(CollectionsController);
-  });
-
-  it('should be defined', () => {
-    expect(controller).toBeDefined();
-  });
-});

+ 0 - 138
server/src/collections/collections.controller.ts

@@ -1,138 +0,0 @@
-import {
-  Body,
-  Controller,
-  Delete,
-  Get,
-  Param,
-  Post,
-  Put,
-  Query,
-  UsePipes,
-  ValidationPipe,
-  // CACHE_MANAGER,
-  // Inject,
-  // UseInterceptors,
-  // CacheInterceptor,
-} from '@nestjs/common';
-// import { Cache } from 'cache-manager';
-import { ApiTags } from '@nestjs/swagger';
-import { CollectionsService } from './collections.service';
-import {
-  CreateCollection,
-  InsertData,
-  ShowCollections,
-  VectorSearch,
-} from './dto';
-// import { cacheKeys } from '../cache/config';
-
-//Including 2 kind of cache contorl, check getCollections and getStatistics for detail
-@ApiTags('collections')
-@Controller('collections')
-export class CollectionsController {
-  constructor(
-    private collectionsService: CollectionsService, // @Inject(CACHE_MANAGER) private cacheManager: Cache,
-  ) {}
-
-  // manually control cache if logic is complicated
-  @Get()
-  async getCollections(@Query() data?: ShowCollections) {
-    // if (Number(data.type) === 1) {
-    //   let loadedCollections = await this.cacheManager.get(
-    //     cacheKeys.LOADEDCOLLECTIONS,
-    //   );
-    //   if (loadedCollections) {
-    //     return loadedCollections;
-    //   }
-    //   loadedCollections = await this.collectionsService.getLoadedColletions();
-    //   await this.cacheManager.set(
-    //     cacheKeys.LOADEDCOLLECTIONS,
-    //     loadedCollections,
-    //   );
-    //   return loadedCollections;
-    // }
-    // let allCollections = await this.cacheManager.get(cacheKeys.ALLCOLLECTIONS);
-    // if (allCollections) {
-    //   return allCollections;
-    // }
-    // allCollections = await this.collectionsService.getAllCollections();
-    // await this.cacheManager.set(cacheKeys.ALLCOLLECTIONS, allCollections);
-    // return allCollections;
-    return Number(data.type === 1)
-      ? await this.collectionsService.getLoadedColletions()
-      : await this.collectionsService.getAllCollections();
-  }
-
-  // use interceptor to control cache automatically
-  @Get('statistics')
-  // @UseInterceptors(CacheInterceptor)
-  async getStatistics() {
-    return await this.collectionsService.getStatistics();
-  }
-
-  @Post()
-  @UsePipes(new ValidationPipe())
-  async createCollection(@Body() data: CreateCollection) {
-    // await this.cacheManager.del(cacheKeys.ALLCOLLECTIONS);
-    return await this.collectionsService.createCollection(data);
-  }
-
-  @Delete(':name')
-  async deleteCollection(@Param('name') name: string) {
-    // await this.cacheManager.del(cacheKeys.ALLCOLLECTIONS);
-    return await this.collectionsService.dropCollection({
-      collection_name: name,
-    });
-  }
-
-  @Get(':name')
-  async describeCollection(@Param('name') name: string) {
-    return await this.collectionsService.describeCollection({
-      collection_name: name,
-    });
-  }
-
-  @Get(':name/statistics')
-  async getCollectionStatistics(@Param('name') name: string) {
-    return await this.collectionsService.getCollectionStatistics({
-      collection_name: name,
-    });
-  }
-
-  @Get('indexes/status')
-  async getCollectionsIndexState() {
-    return await this.collectionsService.getCollectionsIndexStatus();
-  }
-
-  @Put(':name/load')
-  async loadCollection(@Param('name') name: string) {
-    // await this.cacheManager.del(cacheKeys.LOADEDCOLLECTIONS);
-    return await this.collectionsService.loadCollection({
-      collection_name: name,
-    });
-  }
-
-  @Put(':name/release')
-  async releaseCollection(@Param('name') name: string) {
-    // await this.cacheManager.del(cacheKeys.LOADEDCOLLECTIONS);
-    return await this.collectionsService.releaseCollection({
-      collection_name: name,
-    });
-  }
-
-  @Post(':name/insert')
-  async insertData(@Param('name') name: string, @Body() data: InsertData) {
-    // await this.cacheManager.del(cacheKeys.ALLCOLLECTIONS);
-    return await this.collectionsService.insert({
-      collection_name: name,
-      ...data,
-    });
-  }
-
-  @Post(':name/search')
-  async vectorSearch(@Param('name') name: string, @Body() data: VectorSearch) {
-    return await this.collectionsService.vectorSearch({
-      collection_name: name,
-      ...data,
-    });
-  }
-}

+ 0 - 18
server/src/collections/collections.module.ts

@@ -1,18 +0,0 @@
-import { Module, CacheModule } from '@nestjs/common';
-import { CollectionsService } from './collections.service';
-import { CollectionsController } from './collections.controller';
-import { MilvusModule } from '../milvus/milvus.module';
-import { ttl } from '../cache/config';
-
-@Module({
-  imports: [
-    MilvusModule,
-    CacheModule.register({
-      ttl, // seconds
-    }),
-  ],
-  providers: [CollectionsService],
-  controllers: [CollectionsController],
-  exports: [CollectionsService],
-})
-export class CollectionsModule {}

+ 0 - 19
server/src/collections/collections.service.spec.ts

@@ -1,19 +0,0 @@
-import { Test, TestingModule } from '@nestjs/testing';
-import { CollectionsService } from './collections.service';
-import { MilvusServiceProvider } from '../milvus/milvus.service.mock';
-
-describe('CollectionsService', () => {
-  let service: CollectionsService;
-
-  beforeEach(async () => {
-    const module: TestingModule = await Test.createTestingModule({
-      providers: [CollectionsService, MilvusServiceProvider],
-    }).compile();
-
-    service = module.get<CollectionsService>(CollectionsService);
-  });
-
-  it('should be defined', () => {
-    expect(service).toBeDefined();
-  });
-});

+ 0 - 223
server/src/collections/collections.service.ts

@@ -1,223 +0,0 @@
-import { Injectable } from '@nestjs/common';
-import { MilvusService } from '../milvus/milvus.service';
-import {
-  CreateCollectionReq,
-  DescribeCollectionReq,
-  DropCollectionReq,
-  GetCollectionStatisticsReq,
-  GetIndexStateReq,
-  InsertReq,
-  LoadCollectionReq,
-  ReleaseLoadCollectionReq,
-  SearchReq,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types';
-import { throwErrorFromSDK } from '../utils/Error';
-import { findKeyValue } from '../utils/Helper';
-import { ROW_COUNT } from '../utils/Const';
-import {
-  ShowCollectionsReq,
-  ShowCollectionsType,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types/Collection';
-@Injectable()
-export class CollectionsService {
-  constructor(private milvusService: MilvusService) {}
-
-  get collectionManager() {
-    return this.milvusService.collectionManager;
-  }
-
-  get dataManager() {
-    return this.milvusService.dataManager;
-  }
-
-  get indexManager() {
-    return this.milvusService.indexManager;
-  }
-
-  async getCollections(data?: ShowCollectionsReq) {
-    const res = await this.collectionManager.showCollections(data);
-    throwErrorFromSDK(res.status);
-    return res;
-  }
-
-  async createCollection(data: CreateCollectionReq) {
-    const res = await this.collectionManager.createCollection(data);
-    throwErrorFromSDK(res);
-    return res;
-  }
-
-  async describeCollection(data: DescribeCollectionReq) {
-    const res = await this.collectionManager.describeCollection(data);
-    throwErrorFromSDK(res.status);
-    return res;
-  }
-
-  async dropCollection(data: DropCollectionReq) {
-    const res = await this.collectionManager.dropCollection(data);
-    throwErrorFromSDK(res);
-    return res;
-  }
-
-  async loadCollection(data: LoadCollectionReq) {
-    const res = await this.collectionManager.loadCollection(data);
-    throwErrorFromSDK(res);
-    return res;
-  }
-
-  async releaseCollection(data: ReleaseLoadCollectionReq) {
-    const res = await this.collectionManager.releaseCollection(data);
-    throwErrorFromSDK(res);
-    return res;
-  }
-
-  async getCollectionStatistics(data: GetCollectionStatisticsReq) {
-    const res = await this.collectionManager.getCollectionStatistics(data);
-    throwErrorFromSDK(res.status);
-    return res;
-  }
-
-  async insert(data: InsertReq) {
-    const res = await this.dataManager.insert(data);
-    throwErrorFromSDK(res.status);
-    return res;
-  }
-
-  async vectorSearch(data: SearchReq) {
-    const res = await this.dataManager.search(data);
-    throwErrorFromSDK(res.status);
-    return res;
-  }
-
-  /**
-   * We do not throw error for this.
-   * Because if collection dont have index, it will throw error.
-   * We need wait for milvus error code.
-   * @param data
-   * @returns
-   */
-  async getIndexStatus(data: GetIndexStateReq) {
-    const res = await this.indexManager.getIndexState(data);
-    return res;
-  }
-
-  /**
-   * Get all collections meta data
-   * @returns {id:string, collection_name:string, schema:Field[], autoID:boolean, rowCount: string}
-   */
-  async getAllCollections() {
-    const data = [];
-    const res = await this.getCollections();
-    const loadedCollections = await this.getCollections({
-      type: ShowCollectionsType.Loaded,
-    });
-    if (res.data.length > 0) {
-      for (const item of res.data) {
-        const { name } = item;
-
-        const collectionInfo = await this.describeCollection({
-          collection_name: name,
-        });
-
-        const collectionStatistics = await this.getCollectionStatistics({
-          collection_name: name,
-        });
-
-        const indexRes = await this.getIndexStatus({
-          collection_name: item.name,
-        });
-
-        const autoID = collectionInfo.schema.fields.find(
-          (v) => v.is_primary_key === true,
-        )?.autoID;
-
-        const loadCollection = loadedCollections.data.find(
-          (v) => v.name === name,
-        );
-
-        const loadedPercentage = !loadCollection
-          ? '-1'
-          : loadCollection.loadedPercentage;
-
-        data.push({
-          collection_name: name,
-          schema: collectionInfo.schema,
-          description: collectionInfo.schema.description,
-          autoID,
-          rowCount: findKeyValue(collectionStatistics.stats, ROW_COUNT),
-          id: collectionInfo.collectionID,
-          loadedPercentage,
-          createdTime: collectionInfo.created_utc_timestamp,
-          index_status: indexRes.state,
-        });
-      }
-    }
-    // add default sort - Descending order
-    data.sort((a, b) => b.createdTime - a.createdTime);
-    return data;
-  }
-
-  async getLoadedColletions() {
-    const data = [];
-    const res = await this.getCollections({
-      type: ShowCollectionsType.Loaded,
-    });
-    if (res.data.length > 0) {
-      for (const item of res.data) {
-        const { id, name } = item;
-        const collectionStatistics = await this.getCollectionStatistics({
-          collection_name: name,
-        });
-        data.push({
-          id: id,
-          collection_name: name,
-          rowCount: findKeyValue(collectionStatistics.stats, ROW_COUNT),
-        });
-      }
-    }
-    return data;
-  }
-
-  /**
-   * Get collections statistics data
-   * @returns {collectionCount:number, totalData:number}
-   */
-  async getStatistics() {
-    const data = {
-      collectionCount: 0,
-      totalData: 0,
-    };
-    const res = await this.getCollections();
-    data.collectionCount = res.data.length;
-    if (res.data.length > 0) {
-      for (const item of res.data) {
-        const collectionStatistics = await this.getCollectionStatistics({
-          collection_name: item.name,
-        });
-        const rowCount = findKeyValue(collectionStatistics.stats, ROW_COUNT);
-        data.totalData += isNaN(Number(rowCount)) ? 0 : Number(rowCount);
-      }
-    }
-    return data;
-  }
-
-  /**
-   * Get all collection index status
-   * @returns {collection_name:string, index_status: IndexState}[]
-   */
-  async getCollectionsIndexStatus() {
-    const data = [];
-    const res = await this.getCollections();
-    if (res.data.length > 0) {
-      for (const item of res.data) {
-        const indexRes = await this.getIndexStatus({
-          collection_name: item.name,
-        });
-        data.push({
-          collection_name: item.name,
-          index_status: indexRes.state,
-        });
-      }
-    }
-    return data;
-  }
-}

+ 0 - 130
server/src/collections/dto.ts

@@ -1,130 +0,0 @@
-import {
-  IsNotEmpty,
-  IsString,
-  IsBoolean,
-  IsOptional,
-  IsArray,
-  ArrayNotEmpty,
-  IsEnum,
-  ArrayMinSize,
-  IsObject,
-} from 'class-validator';
-import {
-  FieldType,
-  ShowCollectionsType,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types/Collection';
-import { DataType } from '@zilliz/milvus2-sdk-node/dist/milvus/types/Common';
-import { ApiProperty } from '@nestjs/swagger';
-import { SearchParam } from '@zilliz/milvus2-sdk-node/dist/milvus/types';
-
-enum VectorTypes {
-  Binary = DataType.BinaryVector,
-  Float = DataType.FloatVector,
-}
-
-export class CreateCollection {
-  @ApiProperty({
-    description: 'Milvus collection name',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'collection_name is empty',
-  })
-  readonly collection_name: string;
-
-  @ApiProperty({
-    description: 'Generate ID automatically by milvus',
-    type: Boolean,
-  })
-  @IsBoolean()
-  @IsOptional()
-  readonly autoID: boolean;
-
-  @ApiProperty({
-    description: 'Field data type',
-  })
-  @IsArray()
-  @ArrayNotEmpty()
-  @IsNotEmpty({
-    message: 'fields is empty',
-  })
-  readonly fields: FieldType[];
-}
-
-export class ShowCollections {
-  @ApiProperty({
-    description: 'Type allow all->0 inmemory->1',
-    enum: ShowCollectionsType,
-  })
-  @IsOptional()
-  @IsEnum(ShowCollectionsType, { message: 'Type allow all->0 inmemory->1' })
-  readonly type: ShowCollectionsType;
-}
-
-export class InsertData {
-  @ApiProperty({
-    description: 'Partition in this collection',
-  })
-  @IsOptional()
-  readonly partition_names: string[];
-
-  @ApiProperty({
-    description: 'The fields data in this collection',
-    default: [{ vector: [1, 2, 3], a: 1, b: 2 }],
-  })
-  readonly fields_data: any[];
-}
-
-export class VectorSearch {
-  @ApiProperty({
-    description: 'Milvus collection name',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'collection_name is empty',
-  })
-  collection_name: string;
-
-  @ApiProperty({
-    description: 'Partition in this collection',
-  })
-  @IsOptional()
-  partition_names?: string[];
-
-  @ApiProperty({
-    description: 'Non vector fields filter.',
-  })
-  @IsString()
-  expr?: string;
-
-  @ApiProperty({
-    description: 'Vector search params',
-    default: [{ key: 'metric_type', value: 'L2' }],
-  })
-  @IsObject()
-  search_params: SearchParam;
-
-  @ApiProperty({
-    description: 'Searched vector value',
-    default: [[1, 2, 3, 4]],
-  })
-  @IsArray()
-  @ArrayMinSize(1)
-  vectors: number[][];
-
-  @ApiProperty({
-    description:
-      'Define what non vector fields you want return in search results',
-    default: ['a', 'b'],
-  })
-  @IsArray()
-  @IsOptional()
-  output_fields?: string[];
-
-  @ApiProperty({
-    description: 'Only support 101(binary) or 100(float)',
-    enum: VectorTypes,
-  })
-  @IsEnum(VectorTypes, { message: 'Type allow all->0 inmemory->1' })
-  vector_type: DataType.BinaryVector | DataType.FloatVector;
-}

+ 0 - 18
server/src/crons/crons.controller.spec.ts

@@ -1,18 +0,0 @@
-import { Test, TestingModule } from '@nestjs/testing';
-import { CronsController } from './crons.controller';
-
-describe('CronsController', () => {
-  let controller: CronsController;
-
-  beforeEach(async () => {
-    const module: TestingModule = await Test.createTestingModule({
-      controllers: [CronsController],
-    }).compile();
-
-    controller = module.get<CronsController>(CronsController);
-  });
-
-  it('should be defined', () => {
-    expect(controller).toBeDefined();
-  });
-});

+ 0 - 13
server/src/crons/crons.controller.ts

@@ -1,13 +0,0 @@
-import { Body, Controller, Put } from '@nestjs/common';
-import { CronsService } from './crons.service';
-import { ToggleCron } from './dto';
-
-@Controller('crons')
-export class CronsController {
-  constructor(private cronsService: CronsService) {}
-
-  @Put()
-  async toggleCron(@Body() data: ToggleCron) {
-    return await this.cronsService.toggleCronJobByName(data);
-  }
-}

+ 0 - 12
server/src/crons/crons.module.ts

@@ -1,12 +0,0 @@
-import { Module } from '@nestjs/common';
-import { CollectionsModule } from 'src/collections/collections.module';
-import { EventsModule } from 'src/events/events.module';
-import { CronsService } from './crons.service';
-import { CronsController } from './crons.controller';
-
-@Module({
-  imports: [EventsModule, CollectionsModule],
-  providers: [CronsService],
-  controllers: [CronsController],
-})
-export class CronsModule {}

+ 0 - 18
server/src/crons/crons.service.spec.ts

@@ -1,18 +0,0 @@
-import { Test, TestingModule } from '@nestjs/testing';
-import { CronsService } from './crons.service';
-
-describe('CronsService', () => {
-  let service: CronsService;
-
-  beforeEach(async () => {
-    const module: TestingModule = await Test.createTestingModule({
-      providers: [CronsService],
-    }).compile();
-
-    service = module.get<CronsService>(CronsService);
-  });
-
-  it('should be defined', () => {
-    expect(service).toBeDefined();
-  });
-});

+ 0 - 37
server/src/crons/crons.service.ts

@@ -1,37 +0,0 @@
-import { Injectable } from '@nestjs/common';
-import { EventsGateway } from '../events/events.gateway';
-import { Cron, CronExpression, SchedulerRegistry } from '@nestjs/schedule';
-import { CollectionsService } from '../collections/collections.service';
-import { WS_EVENTS, WS_EVENTS_TYPE } from 'src/utils/Const';
-@Injectable()
-export class CronsService {
-  constructor(
-    private eventService: EventsGateway,
-    private collectionService: CollectionsService,
-    private schedulerRegistry: SchedulerRegistry,
-  ) {}
-
-  async toggleCronJobByName(data: { name: string; type: WS_EVENTS_TYPE }) {
-    const { name, type } = data;
-    const cronJob = this.schedulerRegistry.getCronJob(name);
-    return Number(type) === WS_EVENTS_TYPE.STOP
-      ? cronJob.stop()
-      : cronJob.start();
-  }
-
-  @Cron(CronExpression.EVERY_SECOND, { name: WS_EVENTS.COLLECTION })
-  async getCollections() {
-    try {
-      const res = await this.collectionService.getAllCollections();
-      this.eventService.server.emit(WS_EVENTS.COLLECTION, res);
-      return res;
-    } catch (error) {
-      // When user not connect milvus, stop cron
-      this.toggleCronJobByName({
-        name: WS_EVENTS.COLLECTION,
-        type: WS_EVENTS_TYPE.STOP,
-      });
-      throw new Error(error);
-    }
-  }
-}

+ 0 - 24
server/src/crons/dto.ts

@@ -1,24 +0,0 @@
-import { ApiProperty } from '@nestjs/swagger';
-import { IsEnum, IsNotEmpty, IsString } from 'class-validator';
-import { WS_EVENTS_TYPE } from '../utils/Const';
-
-export class ToggleCron {
-  @ApiProperty({
-    description: 'Cron job  name',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'Cron job name is empty',
-  })
-  readonly name: string;
-
-  @ApiProperty({
-    description: 'Type allow start->0 stop->1',
-    enum: WS_EVENTS_TYPE,
-  })
-  @IsEnum(WS_EVENTS_TYPE, { message: 'start -> 0, stop -> 1' })
-  @IsNotEmpty({
-    message: 'Toggle type is empty',
-  })
-  readonly type: WS_EVENTS_TYPE;
-}

+ 0 - 40
server/src/events/events.gateway.ts

@@ -1,40 +0,0 @@
-import {
-  MessageBody,
-  SubscribeMessage,
-  WebSocketGateway,
-  WebSocketServer,
-  WsResponse,
-} from '@nestjs/websockets';
-import { from, Observable } from 'rxjs';
-import { map } from 'rxjs/operators';
-import { Server } from 'socket.io';
-import { WS_EVENTS } from 'src/utils/Const';
-
-@WebSocketGateway({
-  cors: {
-    origin: '*',
-    methods: ['GET', 'POST'],
-  },
-})
-export class EventsGateway {
-  @WebSocketServer()
-  server: Server;
-
-  @SubscribeMessage(WS_EVENTS.COLLECTION)
-  data(@MessageBody() data: unknown): WsResponse<unknown> {
-    return { event: WS_EVENTS.COLLECTION + '', data };
-  }
-
-  @SubscribeMessage('events')
-  event(@MessageBody() data: any): Observable<WsResponse<number>> {
-    const event = 'events';
-    const response = [1, 2, 3];
-
-    return from(response).pipe(map((data) => ({ event, data })));
-  }
-
-  @SubscribeMessage('identity')
-  async identity(@MessageBody() data: any): Promise<string> {
-    return `identity data: ${data}`;
-  }
-}

+ 0 - 8
server/src/events/events.module.ts

@@ -1,8 +0,0 @@
-import { Module } from '@nestjs/common';
-import { EventsGateway } from './events.gateway';
-
-@Module({
-  providers: [EventsGateway],
-  exports: [EventsGateway],
-})
-export class EventsModule {}

+ 0 - 71
server/src/interceptors/index.ts

@@ -1,71 +0,0 @@
-import {
-  Logger,
-  Injectable,
-  NestInterceptor,
-  ExecutionContext,
-  CallHandler,
-  HttpStatus,
-  BadRequestException,
-} from '@nestjs/common';
-import { map, catchError, tap } from 'rxjs/operators';
-import { Observable, throwError } from 'rxjs';
-
-export interface Response<T> {
-  statusCode: number;
-  data: T;
-}
-
-/**
- *  transform response to client
- */
-@Injectable()
-export class TransformResInterceptor<T>
-  implements NestInterceptor<T, Response<T>>
-{
-  intercept(
-    context: ExecutionContext,
-    next: CallHandler,
-  ): Observable<Response<T>> {
-    return next
-      .handle()
-      .pipe(map((data) => ({ statusCode: HttpStatus.OK, data })));
-  }
-}
-
-/**
- * Handle error in here.
- * Normally depend on status which from milvus service.
- */
-@Injectable()
-export class ErrorInterceptor implements NestInterceptor {
-  intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
-    return next.handle().pipe(
-      catchError((err) => {
-        Logger.error('---error interceptor---', err);
-        if (err.response) {
-          return throwError(err);
-        }
-        return throwError(new BadRequestException(err.toString()));
-      }),
-    );
-  }
-}
-
-/**
- * add spent time looger when accessing milvus.
- */
-@Injectable()
-export class LoggingInterceptor implements NestInterceptor {
-  intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
-    const [req = {}, res = {}] = context.getArgs();
-    const { ip = '', method = '', originalUrl = '', headers = {} } = req;
-    const { statusCode = '' } = res;
-    const ua = headers['user-agent'] || '';
-    const now = Date.now();
-    return next
-      .handle()
-      .pipe(
-        tap(() => Logger.log(`${method} ${originalUrl} takes ${Date.now() - now}ms ip:${ip} ua:${ua} status:${statusCode}`)),
-      );
-  }
-}

+ 0 - 57
server/src/main.ts

@@ -1,57 +0,0 @@
-import * as helmet from 'helmet';
-import { NestFactory } from '@nestjs/core';
-import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
-import { AppModule } from './app.module';
-import { json } from 'body-parser';
-import * as hyperlinker from 'hyperlinker';
-
-/*
-  Milvus insight API server bootstrap function
-*/
-async function bootstrap() {
-  // by default the server will be listening on port 3000
-  const port = 3000;
-  // create the nest application with Cross-origin resource sharing
-  const app = await NestFactory.create(AppModule, { cors: true });
-  // security patches
-  app.use(
-    helmet({
-      // If true will cause blank page after client build.
-      contentSecurityPolicy: false,
-    }),
-  );
-  // set upload file size limit
-  app.use(json({ limit: '150mb' }));
-  // add an API prefix
-  app.setGlobalPrefix('/api/v1');
-
-  // prepare swagger config
-  const config = new DocumentBuilder()
-    .setTitle('Milvus insight')
-    .setVersion('1.0')
-    .build();
-  // create swagger document
-  const document = SwaggerModule.createDocument(app, config);
-  // set up API
-  SwaggerModule.setup('api', app, document);
-
-  // start listening
-  await app.listen(port);
-
-  // output server info
-  // eslint-disable-next-line @typescript-eslint/no-var-requires
-  require('dns').lookup(require('os').hostname(), (err, add, fam) => {
-    // get link
-    // add = `127.0.0.1`;
-    const link = `http://${add}:${port}/api`;
-    const blue = `\x1b[34m%s\x1b[0m`;
-    const light = '\x1b[1m%s\x1b[0m';
-    console.log(blue, '\n    Milvus insight server started.');
-    console.log(
-      light,
-      `    View the API docs on ${hyperlinker(link, link)} \n`,
-    );
-  });
-}
-// Start the server
-bootstrap();

+ 0 - 34
server/src/milvus/dto.ts

@@ -1,34 +0,0 @@
-import { ApiProperty } from '@nestjs/swagger';
-import { ArrayMinSize, IsArray, IsNotEmpty, IsString } from 'class-validator';
-
-export class ConnectMilvus {
-  @ApiProperty({
-    description: 'Milvus url',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'address is empty',
-  })
-  readonly address: string;
-}
-
-export class CheckMilvus {
-  @ApiProperty({
-    description: 'Milvus url',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'address is empty',
-  })
-  readonly address: string;
-}
-
-export class Flush {
-  @ApiProperty({
-    description:
-      'The collection names you want flush, flush will flush data into disk.',
-  })
-  @IsArray()
-  @ArrayMinSize(1, { message: 'At least need one collection name.' })
-  readonly collection_names: string[];
-}

+ 0 - 20
server/src/milvus/milvus.controller.spec.ts

@@ -1,20 +0,0 @@
-import { Test, TestingModule } from '@nestjs/testing';
-import { MilvusController } from './milvus.controller';
-import { MilvusService } from './milvus.service';
-
-describe('MilvusController', () => {
-  let controller: MilvusController;
-
-  beforeEach(async () => {
-    const module: TestingModule = await Test.createTestingModule({
-      controllers: [MilvusController],
-      providers: [MilvusService]
-    }).compile();
-
-    controller = module.get<MilvusController>(MilvusController);
-  });
-
-  it('should be defined', () => {
-    expect(controller).toBeDefined();
-  });
-});

+ 0 - 40
server/src/milvus/milvus.controller.ts

@@ -1,40 +0,0 @@
-import {
-  Body,
-  Controller,
-  Get,
-  Post,
-  Put,
-  Query,
-  UsePipes,
-} from '@nestjs/common';
-import { ApiTags } from '@nestjs/swagger';
-import { ValidationPipe } from '../pipe/validation.pipe';
-import { CheckMilvus, ConnectMilvus, Flush } from './dto';
-import { MilvusService } from './milvus.service';
-
-@ApiTags('milvus')
-@Controller('milvus')
-export class MilvusController {
-  constructor(private milvusService: MilvusService) {}
-
-  @Post('connect')
-  @UsePipes(new ValidationPipe())
-  async connect(@Body() body: ConnectMilvus): Promise<any> {
-    return await this.milvusService.connectMilvus(body.address);
-  }
-
-  @Get('check')
-  async checkConnect(@Query() query: CheckMilvus): Promise<any> {
-    return await this.milvusService.checkConnect(query.address);
-  }
-
-  @Put('flush')
-  async flush(@Body() data: Flush) {
-    return await this.milvusService.flush(data);
-  }
-
-  @Get('metrics')
-  async getMetrics() {
-    return await this.milvusService.getMetrics();
-  }
-}

+ 0 - 10
server/src/milvus/milvus.module.ts

@@ -1,10 +0,0 @@
-import { Module } from '@nestjs/common';
-import { MilvusController } from './milvus.controller';
-import { MilvusService } from './milvus.service';
-
-@Module({
-  controllers: [MilvusController],
-  providers: [MilvusService],
-  exports: [MilvusService],
-})
-export class MilvusModule {}

+ 0 - 13
server/src/milvus/milvus.service.mock.ts

@@ -1,13 +0,0 @@
-import { MilvusService } from './milvus.service';
-
-class MilvusServiceMock {
-  milvusClientGetter() {
-    return {};
-  }
-}
-
-export const MilvusServiceProvider = {
-  provide: MilvusService,
-  useClass: MilvusServiceMock,
-};
-

+ 0 - 18
server/src/milvus/milvus.service.spec.ts

@@ -1,18 +0,0 @@
-import { Test, TestingModule } from '@nestjs/testing';
-import { MilvusService } from './milvus.service';
-
-describe('MilvusService', () => {
-  let service: MilvusService;
-
-  beforeEach(async () => {
-    const module: TestingModule = await Test.createTestingModule({
-      providers: [MilvusService],
-    }).compile();
-
-    service = module.get<MilvusService>(MilvusService);
-  });
-
-  it('should be defined', () => {
-    expect(service).toBeDefined();
-  });
-});

+ 0 - 86
server/src/milvus/milvus.service.ts

@@ -1,86 +0,0 @@
-import { Injectable } from '@nestjs/common';
-import { MilvusClient } from '@zilliz/milvus2-sdk-node';
-import {
-  FlushReq,
-  GetMetricsResponse,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types';
-@Injectable()
-export class MilvusService {
-  private milvusAddress: string;
-  private milvusClient: MilvusClient;
-
-  constructor() {
-    this.milvusAddress = '';
-  }
-
-  get milvusAddressGetter() {
-    return this.milvusAddress;
-  }
-
-  get milvusClientGetter() {
-    return this.milvusClient;
-  }
-
-  get collectionManager() {
-    this.checkMilvus();
-    return this.milvusClient.collectionManager;
-  }
-
-  get partitionManager() {
-    this.checkMilvus();
-    return this.milvusClient.partitionManager;
-  }
-
-  get indexManager() {
-    this.checkMilvus();
-    return this.milvusClient.indexManager;
-  }
-
-  get dataManager() {
-    this.checkMilvus();
-    return this.milvusClient.dataManager;
-  }
-
-  private checkMilvus() {
-    if (!this.milvusClient) {
-      throw new Error('Please connect milvus first');
-    }
-  }
-
-  async connectMilvus(address: string) {
-    // grpc only need address without http
-    const milvusAddress = address.replace(/(http|https):\/\//, '');
-    try {
-      this.milvusClient = new MilvusClient(milvusAddress);
-      await this.milvusClient.collectionManager.hasCollection({
-        collection_name: 'not_exist',
-      });
-      this.milvusAddress = address;
-      return { address: this.milvusAddress };
-    } catch (error) {
-      throw new Error('Connect milvus failed, check your milvus address.');
-    }
-  }
-
-  async checkConnect(address: string) {
-    if (address !== this.milvusAddress) {
-      return { connected: false };
-    }
-    const res = await this.connectMilvus(address);
-    return {
-      connected: res.address ? true : false,
-    };
-  }
-
-  async flush(data: FlushReq) {
-    const res = await this.milvusClient.dataManager.flush(data);
-    return res;
-  }
-
-  async getMetrics(): Promise<GetMetricsResponse> {
-    const res = await this.milvusClient.dataManager.getMetric({
-      request: { metric_type: 'system_info' },
-    });
-    return res;
-  }
-}

+ 0 - 71
server/src/partitions/dto.ts

@@ -1,71 +0,0 @@
-import { ApiProperty } from '@nestjs/swagger';
-import {
-  IsNotEmpty,
-  IsString,
-  IsEnum,
-  IsArray,
-  ArrayNotEmpty,
-} from 'class-validator';
-
-export enum ManageType {
-  DELETE = 'delete',
-  CREATE = 'create',
-}
-export class GetPartitionsInfo {
-  @ApiProperty({
-    description: 'Milvus collection name',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'collection_name is empty',
-  })
-  readonly collection_name: string;
-}
-
-export class ManagePartition {
-  @ApiProperty({
-    description: 'Milvus collection name',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'collection_name is empty',
-  })
-  readonly collection_name: string;
-
-  @ApiProperty({
-    description: 'Milvus partition name',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'partition_name is empty',
-  })
-  readonly partition_name: string;
-
-  @ApiProperty({ 
-    description: 'Type allow delete and create',
-    enum: ManageType
-  })
-  @IsEnum(ManageType, { message: 'Type allow delete and create' })
-  readonly type: ManageType;
-}
-
-export class LoadPartitions {
-  @ApiProperty({
-    description: 'Milvus collection name',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'collection_name is empty',
-  })
-  readonly collection_name: string;
-
-  @ApiProperty({
-    description: 'Milvus partition name',
-  })
-  @IsArray()
-  @ArrayNotEmpty()
-  @IsNotEmpty({
-    message: 'partition_names is empty',
-  })
-  readonly partition_names: string[];
-}

+ 0 - 21
server/src/partitions/partitions.controller.spec.ts

@@ -1,21 +0,0 @@
-import { Test, TestingModule } from '@nestjs/testing';
-import { PartitionsController } from './partitions.controller';
-import { PartitionsService } from './partitions.service';
-import { MilvusServiceProvider } from '../milvus/milvus.service.mock';
-
-describe('PartitionsController', () => {
-  let controller: PartitionsController;
-
-  beforeEach(async () => {
-    const module: TestingModule = await Test.createTestingModule({
-      controllers: [PartitionsController],
-      providers: [PartitionsService, MilvusServiceProvider],
-    }).compile();
-
-    controller = module.get<PartitionsController>(PartitionsController);
-  });
-
-  it('should be defined', () => {
-    expect(controller).toBeDefined();
-  });
-});

+ 0 - 52
server/src/partitions/partitions.controller.ts

@@ -1,52 +0,0 @@
-import {
-  Body,
-  Controller,
-  Get,
-  Post,
-  Put,
-  Query,
-  UsePipes,
-  ValidationPipe,
-} from '@nestjs/common';
-import { ApiTags } from '@nestjs/swagger';
-import {
-  GetPartitionsInfo,
-  LoadPartitions,
-  ManagePartition,
-  ManageType,
-} from './dto';
-import { PartitionsService } from './partitions.service';
-
-@ApiTags('partitions')
-@Controller('partitions')
-export class PartitionsController {
-  constructor(private partitionsService: PartitionsService) {}
-
-  @Get()
-  @UsePipes(new ValidationPipe())
-  async getPartitions(@Query() query: GetPartitionsInfo) {
-    return await this.partitionsService.getPartitionsInfo(query);
-  }
-
-  @Post()
-  @UsePipes(new ValidationPipe())
-  async managePartition(@Body() body: ManagePartition) {
-    const { type, ...params } = body;
-
-    return type.toLocaleLowerCase() === ManageType.CREATE
-      ? await this.partitionsService.createPartition(params)
-      : await this.partitionsService.deletePartition(params);
-  }
-
-  @Put('load')
-  @UsePipes(new ValidationPipe())
-  async loadPartition(@Body() body: LoadPartitions) {
-    return await this.partitionsService.loadPartitions(body);
-  }
-
-  @Put('release')
-  @UsePipes(new ValidationPipe())
-  async releasePartitions(@Body() body: LoadPartitions) {
-    return await this.partitionsService.loadPartitions(body);
-  }
-}

+ 0 - 11
server/src/partitions/partitions.module.ts

@@ -1,11 +0,0 @@
-import { Module } from '@nestjs/common';
-import { PartitionsService } from './partitions.service';
-import { PartitionsController } from './partitions.controller';
-import { MilvusModule } from 'src/milvus/milvus.module';
-
-@Module({
-  imports: [MilvusModule],
-  providers: [PartitionsService],
-  controllers: [PartitionsController],
-})
-export class PartitionsModule {}

+ 0 - 19
server/src/partitions/partitions.service.spec.ts

@@ -1,19 +0,0 @@
-import { Test, TestingModule } from '@nestjs/testing';
-import { PartitionsService } from './partitions.service';
-import { MilvusServiceProvider } from '../milvus/milvus.service.mock';
-
-describe('PartitionsService', () => {
-  let service: PartitionsService;
-
-  beforeEach(async () => {
-    const module: TestingModule = await Test.createTestingModule({
-      providers: [PartitionsService, MilvusServiceProvider],
-    }).compile();
-
-    service = module.get<PartitionsService>(PartitionsService);
-  });
-
-  it('should be defined', () => {
-    expect(service).toBeDefined();
-  });
-});

+ 0 - 78
server/src/partitions/partitions.service.ts

@@ -1,78 +0,0 @@
-import { Injectable } from '@nestjs/common';
-import { MilvusService } from '../milvus/milvus.service';
-import {
-  CreatePartitionReq,
-  DropPartitionReq,
-  GetPartitionStatisticsReq,
-  LoadPartitionsReq,
-  ReleasePartitionsReq,
-  ShowPartitionsReq,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types';
-import { throwErrorFromSDK } from '../utils/Error';
-import { findKeyValue } from '../utils/Helper';
-import { ROW_COUNT } from '../utils/Const';
-
-@Injectable()
-export class PartitionsService {
-  constructor(private milvusService: MilvusService) {}
-
-  get partitionManager() {
-    return this.milvusService.partitionManager;
-  }
-
-  async getPartitionsInfo(data: ShowPartitionsReq) {
-    const result = [];
-    const res = await this.getPartitions(data);
-    if (res.partition_names && res.partition_names.length) {
-      for (const [index, name] of res.partition_names.entries()) {
-        const statistics = await this.getPartitionStatistics({
-          ...data,
-          partition_name: name,
-        });
-        result.push({
-          name,
-          id: res.partitionIDs[index],
-          rowCount: findKeyValue(statistics.stats, ROW_COUNT),
-          createdTime: res.created_utc_timestamps[index],
-        });
-      }
-    }
-    return result;
-  }
-
-  async getPartitions(data: ShowPartitionsReq) {
-    const res = await this.partitionManager.showPartitions(data);
-    throwErrorFromSDK(res.status);
-    return res;
-  }
-
-  async createPartition(data: CreatePartitionReq) {
-    const res = await this.partitionManager.createPartition(data);
-    throwErrorFromSDK(res);
-    return res;
-  }
-
-  async deletePartition(data: DropPartitionReq) {
-    const res = await this.partitionManager.dropPartition(data);
-    throwErrorFromSDK(res);
-    return res;
-  }
-
-  async getPartitionStatistics(data: GetPartitionStatisticsReq) {
-    const res = await this.partitionManager.getPartitionStatistics(data);
-    throwErrorFromSDK(res.status);
-    return res;
-  }
-
-  async loadPartitions(data: LoadPartitionsReq) {
-    const res = await this.partitionManager.loadPartitions(data);
-    throwErrorFromSDK(res);
-    return res;
-  }
-
-  async releasePartitions(data: ReleasePartitionsReq) {
-    const res = await this.partitionManager.releasePartitions(data);
-    throwErrorFromSDK(res);
-    return res;
-  }
-}

+ 0 - 60
server/src/pipe/validation.pipe.ts

@@ -1,60 +0,0 @@
-import {
-  PipeTransform,
-  Injectable,
-  ArgumentMetadata,
-  BadRequestException,
-} from '@nestjs/common';
-import { validate } from 'class-validator';
-import { plainToClass } from 'class-transformer';
-
-@Injectable()
-export class ValidationPipe implements PipeTransform<any> {
-  async transform(value, { metatype }: ArgumentMetadata) {
-    if (!metatype || !this.toValidate(metatype)) {
-      return value;
-    }
-    const object = plainToClass(metatype, value);
-    // when value is null, metatype exist, object will be null
-    if (object === null) {
-      throw new BadRequestException('params should not be empty');
-    }
-
-    // interface ValidatorOptions {
-    //   skipMissingProperties?: boolean;
-    //   whitelist?: boolean;
-    //   forbidNonWhitelisted?: boolean;
-    //   groups?: string[];
-    //   dismissDefaultMessages?: boolean;
-    //   validationError?: {
-    //     target?: boolean;
-    //     value?: boolean;
-    //   };
-
-    //   forbidUnknownValues?: boolean;
-    // }
-    const errors = await validate(object, {
-      skipMissingProperties: false,
-      whitelist: true,
-      forbidNonWhitelisted: true,
-    });
-
-    errors.forEach((error) => {
-      let constraints = error.constraints;
-      let currentError = error;
-      while (!constraints && currentError) {
-        constraints = currentError.constraints;
-        currentError = currentError.children[0];
-      }
-
-      for (const i in constraints) {
-        throw new BadRequestException(constraints[i]);
-      }
-    });
-    return value;
-  }
-
-  private toValidate(metatype): boolean {
-    const types = [String, Boolean, Number, Array, Object];
-    return !types.find((type) => metatype === type);
-  }
-}

+ 0 - 115
server/src/schema/dto.ts

@@ -1,115 +0,0 @@
-import { ApiProperty } from '@nestjs/swagger';
-import { CreateIndexParam } from '@zilliz/milvus2-sdk-node/dist/milvus/types';
-import {
-  IsNotEmpty,
-  IsString,
-  IsEnum,
-  IsOptional,
-  IsObject,
-} from 'class-validator';
-
-class KeyValuePair {
-  @ApiProperty()
-  key: string;
-  @ApiProperty()
-  value: string;
-}
-
-export enum ManageType {
-  DELETE = 'delete',
-  CREATE = 'create',
-}
-
-export class ManageIndex {
-  @ApiProperty({ enum: ManageType })
-  @IsEnum(ManageType, { message: 'Type allow delete and create' })
-  readonly type: ManageType;
-
-  @ApiProperty({
-    description: 'Milvus collection name',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'collection_name is empty',
-  })
-  readonly collection_name: string;
-
-  @ApiProperty({
-    description: 'field name',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'field_name is empty',
-  })
-  readonly field_name: string;
-
-  @ApiProperty({
-    type: [KeyValuePair],
-  })
-  @IsObject()
-  @IsOptional()
-  readonly extra_params?: CreateIndexParam;
-}
-
-export class DescribeIndex {
-  @ApiProperty({
-    description: 'Milvus collection description',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'collection_name is empty',
-  })
-  readonly collection_name: string;
-
-  @ApiProperty({
-    description: 'field name',
-  })
-  @IsString()
-  @IsOptional()
-  readonly field_name?: string;
-}
-
-export class GetIndexState {
-  @ApiProperty({
-    description: 'Milvus collection name',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'collection_name is empty',
-  })
-  readonly collection_name: string;
-
-  @ApiProperty({
-    description: 'field name',
-  })
-  @IsString()
-  @IsOptional()
-  readonly field_name?: string;
-}
-
-export class GetIndexProgress {
-  @ApiProperty({
-    description: 'Milvus collection name',
-  })
-  @IsString()
-  @IsNotEmpty({
-    message: 'collection_name is empty',
-  })
-  readonly collection_name: string;
-
-  @ApiProperty({
-    description: 'index name',
-  })
-  @IsString()
-  // @IsNotEmpty({
-  //   message: 'index_name is empty',
-  // })
-  readonly index_name: string;
-
-  @ApiProperty({
-    description: 'field name',
-  })
-  @IsString()
-  @IsOptional()
-  readonly field_name?: string;
-}

+ 0 - 21
server/src/schema/schema.controller.spec.ts

@@ -1,21 +0,0 @@
-import { Test, TestingModule } from '@nestjs/testing';
-import { SchemaController } from './schema.controller';
-import { SchemaService } from './schema.service';
-import { MilvusServiceProvider } from '../milvus/milvus.service.mock';
-
-describe('SchemaController', () => {
-  let controller: SchemaController;
-
-  beforeEach(async () => {
-    const module: TestingModule = await Test.createTestingModule({
-      controllers: [SchemaController],
-      providers: [SchemaService, MilvusServiceProvider],
-    }).compile();
-
-    controller = module.get<SchemaController>(SchemaController);
-  });
-
-  it('should be defined', () => {
-    expect(controller).toBeDefined();
-  });
-});

+ 0 - 55
server/src/schema/schema.controller.ts

@@ -1,55 +0,0 @@
-import {
-  Body,
-  Controller,
-  Get,
-  Post,
-  Query,
-  UsePipes,
-  ValidationPipe,
-} from '@nestjs/common';
-import { ApiTags } from '@nestjs/swagger';
-import {
-  DescribeIndex,
-  GetIndexProgress,
-  ManageIndex,
-  ManageType,
-  GetIndexState,
-} from './dto';
-import { SchemaService } from './schema.service';
-
-@ApiTags('schema')
-@Controller('schema')
-export class SchemaController {
-  constructor(private schemaService: SchemaService) {}
-
-  @Post('index')
-  @UsePipes(new ValidationPipe())
-  async manageIndex(@Body() body: ManageIndex) {
-    const { type, collection_name, extra_params, field_name } = body;
-    return type === ManageType.CREATE
-      ? await this.schemaService.createIndex({
-          collection_name,
-          extra_params,
-          field_name,
-        })
-      : await this.schemaService.dropIndex({ collection_name, field_name });
-  }
-
-  @Get('index')
-  @UsePipes(new ValidationPipe())
-  async describeIndex(@Query() query: DescribeIndex) {
-    return await this.schemaService.describeIndex(query);
-  }
-
-  @Get('index/progress')
-  @UsePipes(new ValidationPipe())
-  async getIndexProgress(@Query() query: GetIndexProgress) {
-    return await this.schemaService.getIndexBuildProgress(query);
-  }
-
-  @Get('index/state')
-  @UsePipes(new ValidationPipe())
-  async getIndexState(@Query() query: GetIndexState) {
-    return await this.schemaService.getIndexState(query);
-  }
-}

+ 0 - 11
server/src/schema/schema.module.ts

@@ -1,11 +0,0 @@
-import { Module } from '@nestjs/common';
-import { MilvusModule } from '../milvus/milvus.module';
-import { SchemaController } from './schema.controller';
-import { SchemaService } from './schema.service';
-
-@Module({
-  imports: [MilvusModule],
-  controllers: [SchemaController],
-  providers: [SchemaService],
-})
-export class SchemaModule {}

+ 0 - 19
server/src/schema/schema.service.spec.ts

@@ -1,19 +0,0 @@
-import { Test, TestingModule } from '@nestjs/testing';
-import { SchemaService } from './schema.service';
-import { MilvusServiceProvider } from '../milvus/milvus.service.mock';
-
-describe('SchemaService', () => {
-  let service: SchemaService;
-
-  beforeEach(async () => {
-    const module: TestingModule = await Test.createTestingModule({
-      providers: [SchemaService, MilvusServiceProvider],
-    }).compile();
-
-    service = module.get<SchemaService>(SchemaService);
-  });
-
-  it('should be defined', () => {
-    expect(service).toBeDefined();
-  });
-});

+ 0 - 52
server/src/schema/schema.service.ts

@@ -1,52 +0,0 @@
-import { Injectable } from '@nestjs/common';
-import {
-  CreateIndexReq,
-  DescribeIndexReq,
-  DropIndexReq,
-  GetIndexBuildProgressReq,
-  GetIndexStateReq,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types';
-import { throwErrorFromSDK } from '../utils/Error';
-import { MilvusService } from '../milvus/milvus.service';
-
-@Injectable()
-export class SchemaService {
-  constructor(private milvusService: MilvusService) {}
-
-  get indexManager() {
-    return this.milvusService.indexManager;
-  }
-
-  async createIndex(data: CreateIndexReq) {
-    const res = await this.indexManager.createIndex(data);
-    throwErrorFromSDK(res);
-    return res;
-  }
-
-  async describeIndex(data: DescribeIndexReq) {
-    const res = await this.indexManager.describeIndex(data);
-    if (res.status.error_code === 'IndexNotExist') {
-      return res;
-    }
-    throwErrorFromSDK(res.status);
-    return res;
-  }
-
-  async dropIndex(data: DropIndexReq) {
-    const res = await this.indexManager.dropIndex(data);
-    throwErrorFromSDK(res);
-    return res;
-  }
-
-  async getIndexState(data: GetIndexStateReq) {
-    const res = await this.indexManager.getIndexState(data);
-    throwErrorFromSDK(res.status);
-    return res;
-  }
-
-  async getIndexBuildProgress(data: GetIndexBuildProgressReq) {
-    const res = await this.indexManager.getIndexBuildProgress(data);
-    throwErrorFromSDK(res.status);
-    return res;
-  }
-}

+ 0 - 16
server/src/utils/Const.ts

@@ -1,16 +0,0 @@
-export const ROW_COUNT = 'row_count';
-
-export enum LOADING_STATE {
-  LOADED,
-  LOADING,
-  UNLOADED,
-}
-
-export enum WS_EVENTS {
-  COLLECTION = 'COLLECTION',
-}
-
-export enum WS_EVENTS_TYPE {
-  START,
-  STOP,
-}

+ 0 - 10
server/src/utils/Error.ts

@@ -1,10 +0,0 @@
-import {
-  ErrorCode,
-  ResStatus,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types/Response';
-
-export const throwErrorFromSDK = (res: ResStatus) => {
-  if (res.error_code !== ErrorCode.SUCCESS) {
-    throw res.reason;
-  }
-};

+ 0 - 4
server/src/utils/Helper.ts

@@ -1,4 +0,0 @@
-import { KeyValuePair } from '@zilliz/milvus2-sdk-node/dist/milvus/types/Common';
-
-export const findKeyValue = (obj: KeyValuePair[], key: string) =>
-  obj.find((v) => v.key === key)?.value;

Some files were not shown because too many files changed in this diff