This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 98c1117f4 refactor(config-ui): use new ui input.password to replace 
old form-password component (#6592)
98c1117f4 is described below

commit 98c1117f4635c32b930ec7c4f9289a604b6f3594
Author: 青湛 <0x1304...@gmail.com>
AuthorDate: Fri Dec 8 11:46:51 2023 +0800

    refactor(config-ui): use new ui input.password to replace old form-password 
component (#6592)
---
 config-ui/src/components/form/index.ts             |  1 -
 config-ui/src/components/form/password/index.tsx   | 42 ----------------------
 .../components/connection-form/fields/password.tsx | 22 ++----------
 .../connection-form/fields/secret-key.tsx          |  5 ++-
 .../components/connection-form/fields/token.tsx    |  5 ++-
 .../register/github/connection-fields/token.tsx    |  5 +--
 .../register/jira/connection-fields/auth.tsx       |  9 ++---
 7 files changed, 14 insertions(+), 75 deletions(-)

diff --git a/config-ui/src/components/form/index.ts 
b/config-ui/src/components/form/index.ts
index 70ace6d30..14ed54fe6 100644
--- a/config-ui/src/components/form/index.ts
+++ b/config-ui/src/components/form/index.ts
@@ -17,4 +17,3 @@
  */
 
 export * from './item';
-export * from './password';
diff --git a/config-ui/src/components/form/password/index.tsx 
b/config-ui/src/components/form/password/index.tsx
deleted file mode 100644
index b9de09a7d..000000000
--- a/config-ui/src/components/form/password/index.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import { useState } from 'react';
-import { InputGroup, InputGroupProps2 } from '@blueprintjs/core';
-
-import { IconButton } from '@/components';
-
-interface Props extends InputGroupProps2 {}
-
-export const FormPassword = ({ ...props }: Props) => {
-  const [showPass, setShowPass] = useState(false);
-
-  return (
-    <InputGroup
-      {...props}
-      type={showPass ? 'text' : 'password'}
-      rightElement={
-        <IconButton
-          icon={showPass ? 'unlock' : 'lock'}
-          tooltip={showPass ? 'Hide' : 'Show'}
-          onClick={() => setShowPass(!showPass)}
-        />
-      }
-    />
-  );
-};
diff --git 
a/config-ui/src/plugins/components/connection-form/fields/password.tsx 
b/config-ui/src/plugins/components/connection-form/fields/password.tsx
index 226a25994..98dcc0680 100644
--- a/config-ui/src/plugins/components/connection-form/fields/password.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/password.tsx
@@ -15,29 +15,11 @@
  * limitations under the License.
  *
  */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
 
 import { useEffect } from 'react';
+import { Input } from 'antd';
 import { FormGroup } from '@blueprintjs/core';
 
-import { FormPassword } from '@/components';
-
 import * as S from './styled';
 
 interface Props {
@@ -79,7 +61,7 @@ export const ConnectionPassword = ({
       labelInfo={<S.LabelInfo>*</S.LabelInfo>}
       subLabel={subLabel ? <S.LabelDescription>{subLabel}</S.LabelDescription> 
: null}
     >
-      <FormPassword placeholder={placeholder ?? 'Your Password'} value={value} 
onChange={handleChange} />
+      <Input.Password placeholder={placeholder ?? 'Your Password'} 
value={value} onChange={handleChange} />
     </FormGroup>
   );
 };
diff --git 
a/config-ui/src/plugins/components/connection-form/fields/secret-key.tsx 
b/config-ui/src/plugins/components/connection-form/fields/secret-key.tsx
index bdfe3cf7e..dd3fedcc5 100644
--- a/config-ui/src/plugins/components/connection-form/fields/secret-key.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/secret-key.tsx
@@ -34,10 +34,9 @@
  */
 
 import { useEffect } from 'react';
+import { Input } from 'antd';
 import { FormGroup } from '@blueprintjs/core';
 
-import { FormPassword } from '@/components';
-
 import * as S from './styled';
 
 interface Props {
@@ -79,7 +78,7 @@ export const ConnectionSecretKey = ({
       labelInfo={<S.LabelInfo>*</S.LabelInfo>}
       subLabel={subLabel ? <S.LabelDescription>{subLabel}</S.LabelDescription> 
: null}
     >
-      <FormPassword placeholder={placeholder ?? 'Your SecretKey'} 
value={value} onChange={handleChange} />
+      <Input.Password placeholder={placeholder ?? 'Your SecretKey'} 
value={value} onChange={handleChange} />
     </FormGroup>
   );
 };
diff --git a/config-ui/src/plugins/components/connection-form/fields/token.tsx 
b/config-ui/src/plugins/components/connection-form/fields/token.tsx
index bee803130..71e736a43 100644
--- a/config-ui/src/plugins/components/connection-form/fields/token.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/token.tsx
@@ -34,10 +34,9 @@
  */
 
 import { useEffect } from 'react';
+import { Input } from 'antd';
 import { FormGroup } from '@blueprintjs/core';
 
-import { FormPassword } from '@/components';
-
 import * as S from './styled';
 
 interface Props {
@@ -70,7 +69,7 @@ export const ConnectionToken = ({ label, subLabel, 
initialValue, value, setValue
       labelInfo={<S.LabelInfo>*</S.LabelInfo>}
       subLabel={subLabel && 
<S.LabelDescription>{subLabel}</S.LabelDescription>}
     >
-      <FormPassword placeholder="Your Token" value={value} 
onChange={handleChange} />
+      <Input.Password placeholder="Your Token" value={value} 
onChange={handleChange} />
     </FormGroup>
   );
 };
diff --git a/config-ui/src/plugins/register/github/connection-fields/token.tsx 
b/config-ui/src/plugins/register/github/connection-fields/token.tsx
index 889897880..a84f5c93e 100644
--- a/config-ui/src/plugins/register/github/connection-fields/token.tsx
+++ b/config-ui/src/plugins/register/github/connection-fields/token.tsx
@@ -17,10 +17,11 @@
  */
 
 import { useEffect, useState } from 'react';
+import { Input } from 'antd';
 import { FormGroup, Button, Icon, Intent } from '@blueprintjs/core';
 
 import API from '@/api';
-import { ExternalLink, FormPassword } from '@/components';
+import { ExternalLink } from '@/components';
 import { DOC_URL } from '@/release';
 
 import * as S from './styled';
@@ -126,7 +127,7 @@ export const Token = ({ endpoint, proxy, initialValue, 
value, error, setValue, s
       {tokens.map(({ value, isValid, status, from }, i) => (
         <S.Input key={i}>
           <div className="input">
-            <FormPassword
+            <Input.Password
               placeholder="Token"
               onChange={(e) => handleChangeToken(i, e.target.value)}
               onBlur={() => handleTestToken(i)}
diff --git a/config-ui/src/plugins/register/jira/connection-fields/auth.tsx 
b/config-ui/src/plugins/register/jira/connection-fields/auth.tsx
index 52b4b14a1..c18b900a3 100644
--- a/config-ui/src/plugins/register/jira/connection-fields/auth.tsx
+++ b/config-ui/src/plugins/register/jira/connection-fields/auth.tsx
@@ -17,9 +17,10 @@
  */
 
 import { useState, useEffect } from 'react';
+import { Input } from 'antd';
 import { FormGroup, RadioGroup, Radio, InputGroup } from '@blueprintjs/core';
 
-import { ExternalLink, FormPassword } from '@/components';
+import { ExternalLink } from '@/components';
 import { DOC_URL } from '@/release';
 
 import * as S from './styled';
@@ -159,7 +160,7 @@ export const Auth = ({ initialValues, values, setValues, 
setErrors }: Props) =>
               </S.LabelDescription>
             }
           >
-            <FormPassword placeholder="Your PAT" value={values.password} 
onChange={handleChangePassword} />
+            <Input.Password placeholder="Your PAT" value={values.password} 
onChange={handleChangePassword} />
           </FormGroup>
         </>
       )}
@@ -178,7 +179,7 @@ export const Auth = ({ initialValues, values, setValues, 
setErrors }: Props) =>
                 <InputGroup placeholder="Your Username" 
value={values.username} onChange={handleChangeUsername} />
               </FormGroup>
               <FormGroup label={<S.Label>Password</S.Label>} 
labelInfo={<S.LabelInfo>*</S.LabelInfo>}>
-                <FormPassword placeholder="Your Password" 
value={values.password} onChange={handleChangePassword} />
+                <Input.Password placeholder="Your Password" 
value={values.password} onChange={handleChangePassword} />
               </FormGroup>
             </>
           )}
@@ -194,7 +195,7 @@ export const Auth = ({ initialValues, values, setValues, 
setErrors }: Props) =>
                 </S.LabelDescription>
               }
             >
-              <FormPassword placeholder="Your PAT" value={values.token} 
onChange={handleChangeToken} />
+              <Input.Password placeholder="Your PAT" value={values.token} 
onChange={handleChangeToken} />
             </FormGroup>
           )}
         </>

Reply via email to