Browse Source

use docker env to build the default connection

Signed-off-by: ryjiang <jiangruiyi@gmail.com>
ryjiang 11 months ago
parent
commit
32e1c8d26a
2 changed files with 14 additions and 14 deletions
  1. 0 8
      client/src/consts/default.ts
  2. 14 6
      client/src/pages/connect/AuthForm.tsx

+ 0 - 8
client/src/consts/default.ts

@@ -3,11 +3,3 @@ export const DEFAULT_ATTU_VARCHAR_MAX_LENGTH = 32;
 export const DEFAULT_ATTU_ELEMENT_TYPE = 4; // int32
 export const DEFAULT_ATTU_ELEMENT_TYPE = 4; // int32
 export const DEFAULT_ATTU_DIM = 128;
 export const DEFAULT_ATTU_DIM = 128;
 export const MIN_INT64 = `-9223372036854775807`; // safe int64 min value
 export const MIN_INT64 = `-9223372036854775807`; // safe int64 min value
-export const DEFAULT_CONNECTION = {
-  address: '127.0.0.1:19530',
-  database: 'default',
-  token: '',
-  username: '',
-  password: '',
-  time: -1,
-};

+ 14 - 6
client/src/pages/connect/AuthForm.tsx

@@ -11,7 +11,7 @@ import {
   MILVUS_CLIENT_ID,
   MILVUS_CLIENT_ID,
   ATTU_AUTH_HISTORY,
   ATTU_AUTH_HISTORY,
   MILVUS_DATABASE,
   MILVUS_DATABASE,
-  DEFAULT_CONNECTION,
+  MILVUS_URL,
 } from '@/consts';
 } from '@/consts';
 import { CustomRadio } from '@/components/customRadio/CustomRadio';
 import { CustomRadio } from '@/components/customRadio/CustomRadio';
 import Icons from '@/components/icons/Icons';
 import Icons from '@/components/icons/Icons';
@@ -24,6 +24,15 @@ type Connection = AuthReq & {
   time: number;
   time: number;
 };
 };
 
 
+const DEFAULT_CONNECTION = {
+  address: MILVUS_URL || '127.0.0.1:19530',
+  database: MILVUS_DATABASE,
+  token: '',
+  username: '',
+  password: '',
+  time: -1,
+};
+
 export const AuthForm = () => {
 export const AuthForm = () => {
   // styles
   // styles
   const classes = useStyles();
   const classes = useStyles();
@@ -122,11 +131,11 @@ export const AuthForm = () => {
         },
         },
       ];
       ];
 
 
-      // if history connections are more than 16, remove the first one, but it should keep the default one
+      // if the count of history connections are more than 16, remove the first one, but it should keep the default one
       if (newHistory.length > 16) {
       if (newHistory.length > 16) {
         newHistory.shift();
         newHistory.shift();
       }
       }
-     
+
       // save to local storage
       // save to local storage
       window.localStorage.setItem(
       window.localStorage.setItem(
         ATTU_AUTH_HISTORY,
         ATTU_AUTH_HISTORY,
@@ -173,8 +182,7 @@ export const AuthForm = () => {
 
 
     // save to local storage
     // save to local storage
     window.localStorage.setItem(ATTU_AUTH_HISTORY, JSON.stringify(newHistory));
     window.localStorage.setItem(ATTU_AUTH_HISTORY, JSON.stringify(newHistory));
-
-    // sort by time, put '--' to the end
+    // sort by time
     newHistory.sort((a, b) => {
     newHistory.sort((a, b) => {
       return new Date(b.time).getTime() - new Date(a.time).getTime();
       return new Date(b.time).getTime() - new Date(a.time).getTime();
     });
     });
@@ -194,7 +202,7 @@ export const AuthForm = () => {
       connections.push(DEFAULT_CONNECTION);
       connections.push(DEFAULT_CONNECTION);
     }
     }
 
 
-    // sort by time, put '--' to the end
+    // sort by time
     connections.sort((a, b) => {
     connections.sort((a, b) => {
       return new Date(b.time).getTime() - new Date(a.time).getTime();
       return new Date(b.time).getTime() - new Date(a.time).getTime();
     });
     });