From 8f3eff139815dcc82195c4b6db6e897ee6193085 Mon Sep 17 00:00:00 2001 From: nameczz Date: Wed, 27 Jul 2022 09:44:33 +0800 Subject: [PATCH 1/2] add rpm Signed-off-by: nameczz --- server/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/package.json b/server/package.json index 1c403698..c673b0f3 100644 --- a/server/package.json +++ b/server/package.json @@ -124,7 +124,8 @@ "linux": { "icon": "./build/zilliz.icns", "target": [ - "deb" + "deb", + "rpm" ] }, "mac": { From 27ec77a181479b4a86b5c8555911aa26ec7ebdda Mon Sep 17 00:00:00 2001 From: nameczz Date: Thu, 8 Dec 2022 18:40:35 +0800 Subject: [PATCH 2/2] fix auth login Signed-off-by: nameczz --- client/src/i18n/cn/common.ts | 2 + client/src/i18n/en/common.ts | 1 + client/src/pages/connect/AuthForm.tsx | 80 +++++++++++---------------- server/package.json | 4 +- server/src/milvus/milvus.service.ts | 7 --- 5 files changed, 36 insertions(+), 58 deletions(-) diff --git a/client/src/i18n/cn/common.ts b/client/src/i18n/cn/common.ts index 0ba45dc5..ddedbed7 100644 --- a/client/src/i18n/cn/common.ts +++ b/client/src/i18n/cn/common.ts @@ -5,6 +5,8 @@ const commonTrans = { unAuth: 'Username or password is not correct', username: 'Username', password: 'Password', + optional: '(optional)', + ssl: 'SSL', }, status: { diff --git a/client/src/i18n/en/common.ts b/client/src/i18n/en/common.ts index 0ba45dc5..cb591de3 100644 --- a/client/src/i18n/en/common.ts +++ b/client/src/i18n/en/common.ts @@ -5,6 +5,7 @@ const commonTrans = { unAuth: 'Username or password is not correct', username: 'Username', password: 'Password', + optional: '(optional)', ssl: 'SSL', }, status: { diff --git a/client/src/pages/connect/AuthForm.tsx b/client/src/pages/connect/AuthForm.tsx index ab35709c..b2f8d61a 100644 --- a/client/src/pages/connect/AuthForm.tsx +++ b/client/src/pages/connect/AuthForm.tsx @@ -77,7 +77,7 @@ export const AuthForm = (props: any) => { const checkedForm = useMemo(() => { return formatForm(form); }, [form]); - const { validation, checkIsValid, disabled } = useFormValidation(checkedForm); + const { validation, checkIsValid } = useFormValidation(checkedForm); const handleInputChange = ( key: 'address' | 'username' | 'password' | 'ssl', @@ -105,56 +105,38 @@ export const AuthForm = (props: any) => { defaultValue: form.address, }, ]; - return showAuthForm - ? [ - ...noAuthConfigs, - { - label: attuTrans.username, - key: 'username', - onChange: (value: string) => handleInputChange('username', value), - variant: 'filled', - className: classes.input, - placeholder: attuTrans.username, - fullWidth: true, - validations: [ - { - rule: 'require', - errorText: warningTrans('required', { - name: attuTrans.username, - }), - }, - ], - defaultValue: form.username, - }, - { - label: attuTrans.password, - key: 'password', - onChange: (value: string) => handleInputChange('password', value), - variant: 'filled', - className: classes.input, - placeholder: attuTrans.password, - fullWidth: true, - type: 'password', - validations: [ - { - rule: 'require', - errorText: warningTrans('required', { - name: attuTrans.password, - }), - }, - ], - defaultValue: form.username, - }, - ] - : noAuthConfigs; - }, [form, attuTrans, warningTrans, classes.input, showAuthForm]); + return [ + ...noAuthConfigs, + { + label: `${attuTrans.username} ${attuTrans.optional}`, + key: 'username', + onChange: (value: string) => handleInputChange('username', value), + variant: 'filled', + className: classes.input, + placeholder: attuTrans.username, + fullWidth: true, + + defaultValue: form.username, + }, + { + label: `${attuTrans.password} ${attuTrans.optional}`, + key: 'password', + onChange: (value: string) => handleInputChange('password', value), + variant: 'filled', + className: classes.input, + placeholder: attuTrans.password, + fullWidth: true, + type: 'password', + + defaultValue: form.username, + }, + ]; + }, [form, attuTrans, warningTrans, classes.input]); const handleConnect = async () => { const address = formatAddress(form.address); try { - const data = showAuthForm - ? { ...form, address } - : { address, ssl: form.ssl }; + const data = { ...form, address }; await MilvusHttp.connect(data); setIsAuth(true); setAddress(address); @@ -172,8 +154,8 @@ export const AuthForm = (props: any) => { }; const btnDisabled = useMemo(() => { - return showAuthForm ? disabled : form.address.trim().length === 0; - }, [showAuthForm, disabled, form.address]); + return form.address.trim().length === 0; + }, [form.address]); return (
diff --git a/server/package.json b/server/package.json index bd1cc349..312909f3 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "attu", - "version": "2.2.0", + "version": "2.2.1", "license": "MIT", "author": { "name": "zilliz", @@ -140,4 +140,4 @@ ] } } -} +} \ No newline at end of file diff --git a/server/src/milvus/milvus.service.ts b/server/src/milvus/milvus.service.ts index 6fd13fd6..cfc7a2e1 100644 --- a/server/src/milvus/milvus.service.ts +++ b/server/src/milvus/milvus.service.ts @@ -81,13 +81,6 @@ export class MilvusService { } catch (error) { // if milvus is not working, delete connection. cache.del(milvusAddress); - /** - * When user change the user password, milvus will also return unauthenticated error. - * Need to care it in cloud service. - */ - if (error.toString().includes('unauthenticated')) { - throw HttpErrors(HTTP_STATUS_CODE.UNAUTHORIZED, error); - } throw HttpErrors(HTTP_STATUS_CODE.BAD_REQUEST, error); } }