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

fix useOnlyEnvVarsForIsBulkExportPagesEnabled usage in PageBulkExportSettings

Futa Arai 1 год назад
Родитель
Сommit
0de01373e8

+ 19 - 17
apps/app/src/client/components/Admin/App/PageBulkExportSettings.tsx

@@ -39,7 +39,12 @@ const PageBulkExportSettings = (): JSX.Element => {
   }, [isBulkExportPagesEnabled, bulkExportDownloadExpirationSeconds, mutate, t]);
   }, [isBulkExportPagesEnabled, bulkExportDownloadExpirationSeconds, mutate, t]);
 
 
   useEffect(() => {
   useEffect(() => {
-    setIsBulkExportPagesEnabled(data?.isBulkExportPagesEnabled);
+    if (data?.useOnlyEnvVarForFileUploadType) {
+      setIsBulkExportPagesEnabled(data?.envIsBulkExportPagesEnabled);
+    }
+    else {
+      setIsBulkExportPagesEnabled(data?.isBulkExportPagesEnabled);
+    }
     setBulkExportDownloadExpirationSeconds(data?.bulkExportDownloadExpirationSeconds);
     setBulkExportDownloadExpirationSeconds(data?.bulkExportDownloadExpirationSeconds);
   }, [data]);
   }, [data]);
 
 
@@ -75,13 +80,25 @@ const PageBulkExportSettings = (): JSX.Element => {
                   className="form-check-input"
                   className="form-check-input"
                   id="cbIsPageBulkExportEnabled"
                   id="cbIsPageBulkExportEnabled"
                   checked={isBulkExportPagesEnabled}
                   checked={isBulkExportPagesEnabled}
-                  disabled={data?.isFixedIsBulkExportPagesEnabled}
+                  disabled={data?.useOnlyEnvVarsForIsBulkExportPagesEnabled}
                   onChange={e => setIsBulkExportPagesEnabled(e.target.checked)}
                   onChange={e => setIsBulkExportPagesEnabled(e.target.checked)}
                 />
                 />
                 <label className="form-label form-check-label" htmlFor="cbIsPageBulkExportEnabled">
                 <label className="form-label form-check-label" htmlFor="cbIsPageBulkExportEnabled">
                   {t('app_setting.enable_page_bulk_export')}
                   {t('app_setting.enable_page_bulk_export')}
                 </label>
                 </label>
               </div>
               </div>
+              {data?.useOnlyEnvVarsForIsBulkExportPagesEnabled && (
+                <p className="form-text text-muted">
+                  {/* eslint-disable-next-line react/no-danger */}
+                  <b dangerouslySetInnerHTML={{
+                    __html: t('admin:app_setting.fixed_by_env_var', {
+                      envKey: 'BULK_EXPORT_PAGES_ENABLED',
+                      envVar: isBulkExportPagesEnabled,
+                    }),
+                  }}
+                  />
+                </p>
+              )}
             </div>
             </div>
           </div>
           </div>
 
 
@@ -107,21 +124,6 @@ const PageBulkExportSettings = (): JSX.Element => {
                 </select>
                 </select>
               </div>
               </div>
             </div>
             </div>
-
-            {data?.isFixedIsBulkExportPagesEnabled && (
-              <p className="alert alert-warning mt-2 text-start">
-                <span className="material-symbols-outlined">help</span>
-                <b>FIXED</b><br />
-                {/* eslint-disable-next-line react/no-danger */}
-                <b dangerouslySetInnerHTML={{
-                  __html: t('admin:app_setting.fixed_by_env_var', {
-                    envKey: 'BULK_EXPORT_PAGES_ENABLED',
-                    envVar: isBulkExportPagesEnabled,
-                  }),
-                }}
-                />
-              </p>
-            )}
           </div>
           </div>
 
 
           <AdminUpdateButtonRow onClick={onSubmitHandler} />
           <AdminUpdateButtonRow onClick={onSubmitHandler} />

+ 0 - 10
apps/app/src/client/services/AdminAppContainer.js

@@ -23,8 +23,6 @@ export default class AdminAppContainer extends Container {
       globalLang: '',
       globalLang: '',
       isEmailPublishedForNewUser: true,
       isEmailPublishedForNewUser: true,
       fileUpload: '',
       fileUpload: '',
-      isBulkExportPagesEnabled: false,
-      isFixedIsBulkExportPagesEnabled: false,
 
 
       isV5Compatible: null,
       isV5Compatible: null,
       siteUrl: '',
       siteUrl: '',
@@ -102,7 +100,6 @@ export default class AdminAppContainer extends Container {
       globalLang: appSettingsParams.globalLang,
       globalLang: appSettingsParams.globalLang,
       isEmailPublishedForNewUser: appSettingsParams.isEmailPublishedForNewUser,
       isEmailPublishedForNewUser: appSettingsParams.isEmailPublishedForNewUser,
       fileUpload: appSettingsParams.fileUpload,
       fileUpload: appSettingsParams.fileUpload,
-      isBulkExportPagesEnabled: appSettingsParams.isBulkExportPagesEnabled,
       isV5Compatible: appSettingsParams.isV5Compatible,
       isV5Compatible: appSettingsParams.isV5Compatible,
       siteUrl: appSettingsParams.siteUrl,
       siteUrl: appSettingsParams.siteUrl,
       siteUrlUseOnlyEnvVars: appSettingsParams.siteUrlUseOnlyEnvVars,
       siteUrlUseOnlyEnvVars: appSettingsParams.siteUrlUseOnlyEnvVars,
@@ -160,12 +157,6 @@ export default class AdminAppContainer extends Container {
       this.setState({ fileUploadType: appSettingsParams.envFileUploadType });
       this.setState({ fileUploadType: appSettingsParams.envFileUploadType });
       this.setState({ isFixedFileUploadByEnvVar: true });
       this.setState({ isFixedFileUploadByEnvVar: true });
     }
     }
-
-    if (appSettingsParams.useOnlyEnvVarsForIsBulkExportPagesEnabled) {
-      this.setState({ isBulkExportPagesEnabled: appSettingsParams.envIsBulkExportPagesEnabled });
-      this.setState({ isFixedIsBulkExportPagesEnabled: true });
-    }
-
   }
   }
 
 
   /**
   /**
@@ -405,7 +396,6 @@ export default class AdminAppContainer extends Container {
       globalLang: this.state.globalLang,
       globalLang: this.state.globalLang,
       isEmailPublishedForNewUser: this.state.isEmailPublishedForNewUser,
       isEmailPublishedForNewUser: this.state.isEmailPublishedForNewUser,
       fileUpload: this.state.fileUpload,
       fileUpload: this.state.fileUpload,
-      isBulkExportPagesEnabled: this.state.isBulkExportPagesEnabled,
     });
     });
     const { appSettingParams } = response.data;
     const { appSettingParams } = response.data;
     return appSettingParams;
     return appSettingParams;

+ 1 - 1
apps/app/src/interfaces/res/admin/app-settings.ts

@@ -63,5 +63,5 @@ export type IResAppSettings = {
   isBulkExportPagesEnabled: boolean,
   isBulkExportPagesEnabled: boolean,
   envIsBulkExportPagesEnabled: boolean,
   envIsBulkExportPagesEnabled: boolean,
   bulkExportDownloadExpirationSeconds: number,
   bulkExportDownloadExpirationSeconds: number,
-  isFixedIsBulkExportPagesEnabled: boolean,
+  useOnlyEnvVarsForIsBulkExportPagesEnabled: boolean,
 }
 }