diff --git a/client/src/consts/default.ts b/client/src/consts/default.ts index 96f6cb96..3b3d516d 100644 --- a/client/src/consts/default.ts +++ b/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_DIM = 128; 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, -}; diff --git a/client/src/pages/connect/AuthForm.tsx b/client/src/pages/connect/AuthForm.tsx index 05ae85f7..a12fea89 100644 --- a/client/src/pages/connect/AuthForm.tsx +++ b/client/src/pages/connect/AuthForm.tsx @@ -11,7 +11,7 @@ import { MILVUS_CLIENT_ID, ATTU_AUTH_HISTORY, MILVUS_DATABASE, - DEFAULT_CONNECTION, + MILVUS_URL, } from '@/consts'; import { CustomRadio } from '@/components/customRadio/CustomRadio'; import Icons from '@/components/icons/Icons'; @@ -24,6 +24,15 @@ type Connection = AuthReq & { time: number; }; +const DEFAULT_CONNECTION = { + address: MILVUS_URL || '127.0.0.1:19530', + database: MILVUS_DATABASE, + token: '', + username: '', + password: '', + time: -1, +}; + export const AuthForm = () => { // styles 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) { newHistory.shift(); } - + // save to local storage window.localStorage.setItem( ATTU_AUTH_HISTORY, @@ -173,8 +182,7 @@ export const AuthForm = () => { // save to local storage window.localStorage.setItem(ATTU_AUTH_HISTORY, JSON.stringify(newHistory)); - - // sort by time, put '--' to the end + // sort by time newHistory.sort((a, b) => { return new Date(b.time).getTime() - new Date(a.time).getTime(); }); @@ -194,7 +202,7 @@ export const AuthForm = () => { connections.push(DEFAULT_CONNECTION); } - // sort by time, put '--' to the end + // sort by time connections.sort((a, b) => { return new Date(b.time).getTime() - new Date(a.time).getTime(); });