Browse Source

Support ssl option for milvus connection (#790)

Abhay 4 months ago
parent
commit
c8b9394f13

+ 1 - 0
client/src/context/Auth.tsx

@@ -19,6 +19,7 @@ export const authContext = createContext<AuthContextType>({
     database: '',
     checkHealth: true,
     clientId: '',
+    ssl: false
   },
   setAuthReq: () => {},
   isManaged: false,

+ 1 - 0
client/src/i18n/cn/common.ts

@@ -10,6 +10,7 @@ const commonTrans = {
     unAuth: '用户名或密码不正确',
     username: '用户名',
     password: '密码',
+    ssl: '启用SSL',
     optional: '(可选)',
     prometheus: 'Prometheus',
     prometheusAddress: 'Prometheus地址',

+ 1 - 0
client/src/i18n/en/common.ts

@@ -10,6 +10,7 @@ const commonTrans = {
     unAuth: 'Username or password is not correct',
     username: 'username',
     password: 'password',
+    ssl: 'Enable SSL',
     optional: '(optional)',
     prometheus: 'Prometheus',
     prometheusAddress: 'Prometheus Address',

+ 16 - 0
client/src/pages/connect/AuthForm.tsx

@@ -16,6 +16,7 @@ import CustomToolTip from '@/components/customToolTip/CustomToolTip';
 import CustomIconButton from '@/components/customButton/CustomIconButton';
 import { useStyles } from './style';
 import type { AuthReq } from '@server/types';
+import FormControlLabel from '@mui/material/FormControlLabel';
 type Connection = AuthReq & {
   time: number;
 };
@@ -26,6 +27,7 @@ const DEFAULT_CONNECTION = {
   token: '',
   username: '',
   password: '',
+  ssl: false,
   checkHealth: true,
   time: -1,
   clientId: '',
@@ -70,6 +72,7 @@ export const AuthForm = () => {
       | 'address'
       | 'username'
       | 'password'
+      | 'ssl'
       | 'database'
       | 'token'
       | 'checkHealth',
@@ -371,6 +374,19 @@ export const AuthForm = () => {
           </>
         )}
 
+        {/* SSL toggle */}
+        <div className={classes.toggle}>
+          <FormControlLabel
+            control={
+              <Checkbox
+                checked={authReq.ssl}
+                onChange={(e) => handleInputChange('ssl', e.target.checked)}
+              />
+            }
+            label={attuTrans.ssl}
+          />
+        </div>
+
         <CustomButton type="submit" variant="contained" disabled={btnDisabled}>
           {btnTrans(isConnecting ? 'connecting' : 'connect')}
         </CustomButton>

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

@@ -26,6 +26,10 @@ export class ConnectMilvusDto {
   @IsOptional()
   readonly token: string;
 
+  @IsBoolean({ message: 'ssl must be a boolean.' })
+  @IsOptional()
+  readonly ssl: boolean;
+
   @IsBoolean({ message: 'checkHealth must be a boolean.' })
   @IsOptional()
   readonly checkHealth: boolean;

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

@@ -31,6 +31,7 @@ export class MilvusService {
       token,
       username,
       password,
+      ssl,
       database,
       checkHealth,
       clientId,
@@ -54,6 +55,7 @@ export class MilvusService {
         token,
         username,
         password,
+        ssl,
         logLevel: process.env.ATTU_LOG_LEVEL || 'info',
         database: database || this.DEFAULT_DATABASE,
         id: clientId,

+ 1 - 0
server/src/types/index.ts

@@ -15,6 +15,7 @@ export type AuthReq = {
   password: string;
   address: string;
   token: string;
+  ssl: boolean;
   database: string;
   checkHealth: boolean;
   clientId: string;