From ee877bb1a1fd8899b78bbf36f1fb3cb94cd11374 Mon Sep 17 00:00:00 2001 From: lihui Date: Thu, 16 Jan 2025 00:03:30 +0800 Subject: [PATCH 1/2] feat: add password hide show logic for init server --- ui/package.json | 1 + ui/pnpm-lock.yaml | 14 ++++- .../Install/components/FourthStep/index.tsx | 56 +++++++++++++------ 3 files changed, 54 insertions(+), 17 deletions(-) diff --git a/ui/package.json b/ui/package.json index 0e645d2e7..da8588e60 100644 --- a/ui/package.json +++ b/ui/package.json @@ -39,6 +39,7 @@ "qs": "^6.11.0", "react": "^18.2.0", "react-bootstrap": "^2.10.0", + "react-bootstrap-icons": "^1.11.5", "react-dom": "^18.2.0", "react-helmet-async": "^1.3.0", "react-i18next": "^11.18.3", diff --git a/ui/pnpm-lock.yaml b/ui/pnpm-lock.yaml index 32ce67e79..8aa2dffbc 100644 --- a/ui/pnpm-lock.yaml +++ b/ui/pnpm-lock.yaml @@ -77,6 +77,9 @@ importers: react-bootstrap: specifier: ^2.10.0 version: 2.10.0(@types/react@18.0.20)(react-dom@18.2.0)(react@18.2.0) + react-bootstrap-icons: + specifier: ^1.11.5 + version: 1.11.5(react@18.2.0) react-dom: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) @@ -8176,7 +8179,7 @@ packages: dependencies: universalify: 2.0.0 optionalDependencies: - graceful-fs: 4.2.10 + graceful-fs: 4.2.11 /jsonp@0.2.1: resolution: {integrity: sha512-pfog5gdDxPdV4eP7Kg87M8/bHgshlZ5pybl+yKxAnCZ5O7lCIn7Ixydj03wOlnDQesky2BPyA91SQ+5Y/mNwzw==} @@ -9913,6 +9916,15 @@ packages: semver: 5.7.1 dev: true + /react-bootstrap-icons@1.11.5(react@18.2.0): + resolution: {integrity: sha512-eOhtFJMUqw98IJcfKJsSMZkFHCeNPTTwXZAe9V9d4mT22ARmbrISxPO9GmtWWuf72zQctLeZMGodX/q6wrbYYg==} + peerDependencies: + react: '>=16.8.6' + dependencies: + prop-types: 15.8.1 + react: 18.2.0 + dev: false + /react-bootstrap@2.10.0(@types/react@18.0.20)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-87gRP69VAfeU2yKgp8RI3HvzhPNrnYIV2QNranYXataz3ef+k7OhvKGGdxQLQfUsQ2RTmlY66tn4pdFrZ94hNg==} peerDependencies: diff --git a/ui/src/pages/Install/components/FourthStep/index.tsx b/ui/src/pages/Install/components/FourthStep/index.tsx index 65ffd9d5a..066cd0799 100644 --- a/ui/src/pages/Install/components/FourthStep/index.tsx +++ b/ui/src/pages/Install/components/FourthStep/index.tsx @@ -17,8 +17,9 @@ * under the License. */ -import { FC, FormEvent } from 'react'; +import { FC, FormEvent, useState } from 'react'; import { Form, Button } from 'react-bootstrap'; +import { Eye, EyeSlash } from 'react-bootstrap-icons'; import { useTranslation } from 'react-i18next'; import type { FormDataType } from '@/common/interface'; @@ -34,6 +35,8 @@ interface Props { const Index: FC = ({ visible, data, changeCallback, nextCallback }) => { const { t } = useTranslation('translation', { keyPrefix: 'install' }); + const [showPassword, setShowPassword] = useState(false); + const checkValidated = (): boolean => { let bol = true; const { site_name, site_url, contact_email, name, password, email } = data; @@ -295,21 +298,42 @@ const Index: FC = ({ visible, data, changeCallback, nextCallback }) => { {t('admin_password.label')} - { - changeCallback({ - password: { - value: e.target.value, - isInvalid: false, - errorMsg: '', - }, - }); - }} - /> +
+ { + changeCallback({ + password: { + value: e.target.value, + isInvalid: false, + errorMsg: '', + }, + }); + }} + /> + +
{t('admin_password.text')} {data.password.errorMsg} From debee7da07c1118baa47c1b65e9d784903ea8420 Mon Sep 17 00:00:00 2001 From: lihui Date: Mon, 20 Jan 2025 23:17:00 +0800 Subject: [PATCH 2/2] refactor: refactor show password logic in init answer app --- ui/package.json | 1 - ui/pnpm-lock.yaml | 12 ------------ ui/src/pages/Install/components/FourthStep/index.tsx | 10 ++++------ 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/ui/package.json b/ui/package.json index da8588e60..0e645d2e7 100644 --- a/ui/package.json +++ b/ui/package.json @@ -39,7 +39,6 @@ "qs": "^6.11.0", "react": "^18.2.0", "react-bootstrap": "^2.10.0", - "react-bootstrap-icons": "^1.11.5", "react-dom": "^18.2.0", "react-helmet-async": "^1.3.0", "react-i18next": "^11.18.3", diff --git a/ui/pnpm-lock.yaml b/ui/pnpm-lock.yaml index 8aa2dffbc..4d122c58b 100644 --- a/ui/pnpm-lock.yaml +++ b/ui/pnpm-lock.yaml @@ -77,9 +77,6 @@ importers: react-bootstrap: specifier: ^2.10.0 version: 2.10.0(@types/react@18.0.20)(react-dom@18.2.0)(react@18.2.0) - react-bootstrap-icons: - specifier: ^1.11.5 - version: 1.11.5(react@18.2.0) react-dom: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) @@ -9916,15 +9913,6 @@ packages: semver: 5.7.1 dev: true - /react-bootstrap-icons@1.11.5(react@18.2.0): - resolution: {integrity: sha512-eOhtFJMUqw98IJcfKJsSMZkFHCeNPTTwXZAe9V9d4mT22ARmbrISxPO9GmtWWuf72zQctLeZMGodX/q6wrbYYg==} - peerDependencies: - react: '>=16.8.6' - dependencies: - prop-types: 15.8.1 - react: 18.2.0 - dev: false - /react-bootstrap@2.10.0(@types/react@18.0.20)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-87gRP69VAfeU2yKgp8RI3HvzhPNrnYIV2QNranYXataz3ef+k7OhvKGGdxQLQfUsQ2RTmlY66tn4pdFrZ94hNg==} peerDependencies: diff --git a/ui/src/pages/Install/components/FourthStep/index.tsx b/ui/src/pages/Install/components/FourthStep/index.tsx index 066cd0799..ad95c4d33 100644 --- a/ui/src/pages/Install/components/FourthStep/index.tsx +++ b/ui/src/pages/Install/components/FourthStep/index.tsx @@ -19,12 +19,12 @@ import { FC, FormEvent, useState } from 'react'; import { Form, Button } from 'react-bootstrap'; -import { Eye, EyeSlash } from 'react-bootstrap-icons'; import { useTranslation } from 'react-i18next'; import type { FormDataType } from '@/common/interface'; import Pattern from '@/common/pattern'; import Progress from '../Progress'; +import { Icon } from '@/components'; interface Props { data: FormDataType; @@ -317,20 +317,18 @@ const Index: FC = ({ visible, data, changeCallback, nextCallback }) => { />