Ver código fonte

FB: success to use object entries

kaori 4 anos atrás
pai
commit
d18a5839dc

+ 29 - 9
src/client/js/components/Admin/SlackIntegration/WithProxyAccordions.jsx

@@ -218,18 +218,38 @@ const WithProxyAccordions = (props) => {
     );
     );
   };
   };
 
 
+  const customBotCooperationProcedure = {
+    contents: [BotCreateProcess, BotInstallProcess, genelatingTokensAndRegisteringProxyServiceProcess, registeringProxyUrlProcess, testProcess],
+    i18n: ['create_bot', 'install_bot_to_slack', 'register_for_growi_official_bot_proxy_service', 'set_proxy_url_on_growi', 'accordion.test_connection'],
+  };
 
 
-  const customBotCooperationProcedure = [
-    BotCreateProcess, BotInstallProcess, genelatingTokensAndRegisteringProxyServiceProcess, registeringProxyUrlProcess, testProcess,
-  ];
-
-  const officialBotCooperationProcedure = [
-    BotInstallProcess, genelatingTokensAndRegisteringProxyServiceProcess, registeringProxyUrlProcess, testProcess,
-  ];
+  const officialBotCooperationProcedure = {
+    create_bot: BotInstallProcess(),
+    install_bot_to_slack: BotInstallProcess(),
+    register_for_growi_official_bot_proxy_service: genelatingTokensAndRegisteringProxyServiceProcess(),
+    set_proxy_url_on_growi:  registeringProxyUrlProcess(),
+    test_connection: testProcess(),
+  };
 
 
   return (
   return (
     <div className="card border-0 rounded-lg shadow overflow-hidden">
     <div className="card border-0 rounded-lg shadow overflow-hidden">
-      {props.botType === 'customBotWithProxy'
+      {Object.entries(officialBotCooperationProcedure).map(([key, value]) => {
+        return (
+          <Accordion
+            title={<><span className="mr-2">1</span>{t(`admin:slack_integration.accordion.${key}`)}</>}
+            key={key}
+          >
+            {/* {BotCreateProcess()} */}
+            {value}
+          </Accordion>
+        );
+      })}
+      {/* <Accordion
+        title={<><span className="mr-2">①</span>{t('admin:slack_integration.accordion.create_bot')}</>}
+      >
+        {BotCreateProcess()}
+      </Accordion> */}
+      {/* {props.botType === 'customBotWithProxy'
       && (
       && (
         <Accordion
         <Accordion
           title={<><span className="mr-2">①</span>{t('admin:slack_integration.accordion.create_bot')}</>}
           title={<><span className="mr-2">①</span>{t('admin:slack_integration.accordion.create_bot')}</>}
@@ -277,7 +297,7 @@ const WithProxyAccordions = (props) => {
         )}
         )}
       >
       >
         {testProcess()}
         {testProcess()}
-      </Accordion>
+      </Accordion> */}
     </div>
     </div>
   );
   );
 };
 };