Просмотр исходного кода

Merge branch 'master' into fix/i18n-for-security-settings

Yuki Takei 1 год назад
Родитель
Сommit
7e5f5b6f9e
2 измененных файлов с 14 добавлено и 30 удалено
  1. 2 0
      .github/workflows/reusable-app-prod.yml
  2. 12 30
      apps/app/src/client/components/InstallerForm.tsx

+ 2 - 0
.github/workflows/reusable-app-prod.yml

@@ -296,6 +296,8 @@ jobs:
   report-playwright:
   report-playwright:
     needs: [run-playwright]
     needs: [run-playwright]
 
 
+    if: always() && needs.run-playwright.result != 'skipped'
+
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
 
 
     steps:
     steps:

+ 12 - 30
apps/app/src/client/components/InstallerForm.tsx

@@ -32,26 +32,13 @@ const InstallerForm = memo((props: Props): JSX.Element => {
 
 
   const tWithOpt = useTWithOpt();
   const tWithOpt = useTWithOpt();
 
 
-  const isSupportedLang = AllLang.includes(i18n.language as Lang);
+  const isSupportedLang = AllLang.includes(i18n.language);
 
 
-  const [isValidUserName, setValidUserName] = useState(true);
   const [isLoading, setIsLoading] = useState(false);
   const [isLoading, setIsLoading] = useState(false);
   const [currentLocale, setCurrentLocale] = useState(isSupportedLang ? i18n.language : Lang.en_US);
   const [currentLocale, setCurrentLocale] = useState(isSupportedLang ? i18n.language : Lang.en_US);
 
 
   const [registerErrors, setRegisterErrors] = useState<IErrorV3[]>([]);
   const [registerErrors, setRegisterErrors] = useState<IErrorV3[]>([]);
 
 
-  const checkUserName = useCallback(async(event) => {
-    const axios = require('axios').create({
-      headers: {
-        'Content-Type': 'application/json',
-        'X-Requested-With': 'XMLHttpRequest',
-      },
-      responseType: 'json',
-    });
-    const res = await axios.get('/_api/v3/check-username', { params: { username: event.target.value } });
-    setValidUserName(res.data.valid);
-  }, []);
-
   const onClickLanguageItem = useCallback((locale) => {
   const onClickLanguageItem = useCallback((locale) => {
     i18n.changeLanguage(locale);
     i18n.changeLanguage(locale);
     setCurrentLocale(locale);
     setCurrentLocale(locale);
@@ -101,13 +88,8 @@ const InstallerForm = memo((props: Props): JSX.Element => {
     }
     }
   }, [currentLocale, router, t]);
   }, [currentLocale, router, t]);
 
 
-  const hasErrorClass = isValidUserName ? '' : ' has-error';
-  const unavailableUserId = isValidUserName
-    ? ''
-    : <span><span className="material-symbols-outlined">block</span>{ t('installer.unavaliable_user_id') }</span>;
-
   return (
   return (
-    <div data-testid="installerForm" className={`${moduleClass} nologin-dialog py-3 px-4 rounded-4 rounded-top-0 mx-auto${hasErrorClass}`}>
+    <div data-testid="installerForm" className={`${moduleClass} nologin-dialog py-3 px-4 rounded-4 rounded-top-0 mx-auto`}>
       <div className="row mt-3">
       <div className="row mt-3">
         <div className="col-md-12">
         <div className="col-md-12">
           <p className="alert alert-success">
           <p className="alert alert-success">
@@ -120,13 +102,15 @@ const InstallerForm = memo((props: Props): JSX.Element => {
 
 
         {
         {
           registerErrors != null && registerErrors.length > 0 && (
           registerErrors != null && registerErrors.length > 0 && (
-            <p className="alert alert-danger text-center">
-              {registerErrors.map(err => (
-                <span>
-                  {tWithOpt(err.message, err.args)}<br />
-                </span>
-              ))}
-            </p>
+            <div className="col-12">
+              <div className="alert alert-danger text-center">
+                {registerErrors.map(err => (
+                  <span>
+                    {tWithOpt(err.message, err.args)}<br />
+                  </span>
+                ))}
+              </div>
+            </div>
           )
           )
         }
         }
 
 
@@ -179,7 +163,7 @@ const InstallerForm = memo((props: Props): JSX.Element => {
             </div>
             </div>
           </div>
           </div>
 
 
-          <div className={`input-group mb-3${hasErrorClass}`}>
+          <div className="input-group mb-3">
             <label className="p-2 text-white opacity-75" aria-label={t('User ID')} htmlFor="tiUsername">
             <label className="p-2 text-white opacity-75" aria-label={t('User ID')} htmlFor="tiUsername">
               <span className="material-symbols-outlined" aria-hidden>person</span>
               <span className="material-symbols-outlined" aria-hidden>person</span>
             </label>
             </label>
@@ -189,11 +173,9 @@ const InstallerForm = memo((props: Props): JSX.Element => {
               className="form-control rounded"
               className="form-control rounded"
               placeholder={t('User ID')}
               placeholder={t('User ID')}
               name="registerForm[username]"
               name="registerForm[username]"
-              // onBlur={checkUserName} // need not to check username before installation -- 2020.07.24 Yuki Takei
               required
               required
             />
             />
           </div>
           </div>
-          <p className="form-text">{ unavailableUserId }</p>
 
 
           <div className="input-group mb-3">
           <div className="input-group mb-3">
             <label className="p-2 text-white opacity-75" aria-label={t('Name')} htmlFor="tiName">
             <label className="p-2 text-white opacity-75" aria-label={t('Name')} htmlFor="tiName">